Showing 3,272 of 4,939 total issues
Function getClassList
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public function getClassList(
bool $ignore_missing_classes = false,
int $expected_type_categories = self::CLASS_LIST_ACCEPT_ANY,
string $custom_issue_type = null,
bool $warn_if_wrong_type = true
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getMethod
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMethod(
$method_name,
bool $is_static,
bool $is_direct = false,
bool $is_new_expression = false
IncompatibleXMLSignatureDetector
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
class IncompatibleXMLSignatureDetector extends IncompatibleSignatureDetectorBase
{
use Memoize;
/** @var string the directory for english PHP element references */
Function analyzeFileList
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public static function analyzeFileList(
CodeBase $code_base,
Closure $file_path_lister
): bool {
if (Config::getValue('dump_parsed_file_list') === true) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function visitClosure
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function visitClosure(Node $node): Context
{
$code_base = $this->code_base;
$context = $this->context->withoutLoops();
$closure_fqsen = FullyQualifiedFunctionName::fromClosureInContext(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File DuplicateExpressionPlugin.php
has 418 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use ast\flags;
Builder
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
final class Builder
{
/** @var string the original raw comment */
public $comment;
/** @var list<string> the list of lines of the doc comment */
ParseVisitor
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
class ParseVisitor extends ScopeVisitor
{
/**
* @param Context $context
File Comment.php
has 416 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Element;
Method getFlagInfo
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getFlagInfo(): array
{
// TODO: Use AST's built in flag info if available.
static $exclusive, $combinable;
// Write this in a way that lets Phan infer the value of $combinable at the end.
Function parseCommentLine
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
private function parseCommentLine(int $i, string $line): void
{
// https://secure.php.net/manual/en/regexp.reference.internal-options.php
// (?i) makes this case-sensitive, (?-1) makes it case-insensitive
// phpcs:ignore Generic.Files.LineLength.MaxExceeded
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File FallbackUnionTypeVisitor.php
has 411 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\AST;
GenericArrayType
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
class GenericArrayType extends ArrayType implements GenericArrayInterface
{
/** @phan-override */
public const NAME = 'array';
BlockExitStatusChecker
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
final class BlockExitStatusChecker extends KindVisitorImplementation
{
// These should be at most 1 << 31, in order to work in 32-bit php.
// NOTE: Any exit status must be a combination of at least one of these bits
// E.g. if STATUS_PROCEED is mixed with STATUS_RETURN, it would mean it is possible both to go to completion or return.
Method analyzeParameterList
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function analyzeParameterList(
CodeBase $code_base,
FunctionInterface $method,
Node $node,
Context $context
Function astNodeToPrimitive
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
protected function astNodeToPrimitive(CodeBase $code_base, Context $context, $ast_node): ?PrimitiveValue
{
// Base case: convert primitive tokens such as numbers and strings.
if (!($ast_node instanceof Node)) {
return new PrimitiveValue($ast_node);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method analyzeParameterTypesInner
has 143 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function analyzeParameterTypesInner(
CodeBase $code_base,
FunctionInterface $method
): void {
if (Config::getValue('check_docblock_signature_param_type_match')) {
Method
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class Method extends ClassElement implements FunctionInterface
{
use Analyzable;
use Memoize;
use FunctionTrait;
File CompletionResolver.php
has 400 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\LanguageServer;
Method createPhanSettingsForComposerSettings
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createPhanSettingsForComposerSettings(array $composer_settings, ?string $vendor_path, array $opts): InitializedSettings
{
$level = $opts['init-level'] ?? 3;
$level = self::LEVEL_MAP[\strtolower((string)$level)] ?? $level;
if (\filter_var($level, FILTER_VALIDATE_INT) === false) {