Showing 3,272 of 4,939 total issues

Function astDump has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function astDump($ast, int $options = 0): string
    {
        if ($ast instanceof Node) {
            $result = Parser::getKindName($ast->kind);

Severity: Minor
Found in src/Phan/Debug.php - About 2 hrs to fix

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 beforeAnalyze has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function beforeAnalyze(CodeBase $code_base): void
    {
        self::addMissingNamespacesToTypes($code_base);

        $code_base->eagerlyLoadAllSignatures();
Severity: Minor
Found in src/Phan/Plugin/Internal/MethodSearcherPlugin.php - About 2 hrs to fix

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 checkUselessScalarComparison has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkUselessScalarComparison(
        Node $node,
        UnionType $left,
        UnionType $right,
        $left_node,
Severity: Minor
Found in src/Phan/Plugin/Internal/RedundantConditionVisitor.php - About 2 hrs to fix

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 functionMatchesSignature has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function functionMatchesSignature(
        CodeBase $code_base,
        FunctionInterface $function
    ): float {
        // TODO: Account for visibility
Severity: Minor
Found in src/Phan/Plugin/Internal/MethodSearcherPlugin.php - About 2 hrs to fix

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 onEmitIssue has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function onEmitIssue(IssueInstance $issue_instance): bool
    {
        if (is_null($this->plugin_set)) {
            $this->deferred_emitted_issues[] = $issue_instance;
            return false;
Severity: Minor
Found in src/Phan/Plugin/ConfigPluginSet.php - About 2 hrs to fix

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 analyzeDimAssignmentTarget has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function analyzeDimAssignmentTarget(Node $node): VariableTrackingScope
    {
        // Treat $y in `$x[$y] = $z;` as a usage of $y
        $this->scope = $this->analyzeWhenValidNode($this->scope, $node->children['dim']);
        $expr = $node->children['expr'];
Severity: Minor
Found in src/Phan/Plugin/Internal/VariableTracker/VariableTrackerVisitor.php - About 2 hrs to fix

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 initPhanConfig has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function initPhanConfig(array $opts): void
    {
        Config::setValue('use_polyfill_parser', true);
        $cwd = \getcwd();

Severity: Minor
Found in src/Phan/Config/Initializer.php - About 2 hrs to fix

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 visitEmpty has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitEmpty(Node $node): Context
    {
        $context = $this->context;
        $var_node = $node->children['expr'];
        if (!($var_node instanceof Node)) {
Severity: Minor
Found in src/Phan/Analysis/NegatedConditionVisitor.php - About 2 hrs to fix

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 visitPrint has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitPrint(Node $node): Context
    {
        $code_base = $this->code_base;
        $context = $this->context;
        $expr_node = $node->children['expr'];
Severity: Minor
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

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 mergeCatchContext has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function mergeCatchContext(Node $node): Context
    {
        if (\count($this->child_context_list) < 2) {
            throw new AssertionError("Expected at least two contexts in " . __METHOD__);
        }
Severity: Minor
Found in src/Phan/Analysis/ContextMergeVisitor.php - About 2 hrs to fix

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 buildUses has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildUses(Node $n): void
    {
        switch ($n->kind) {
            case ast\AST_VAR:
                $name = $n->children['name'];
Severity: Minor
Found in src/Phan/AST/ArrowFunc.php - About 2 hrs to fix

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 phpParserUnionTypeToAstNode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function phpParserUnionTypeToAstNode($type, ?PhpParser\Node\DelimitedList\QualifiedNameList $other_types, int $line): ?\ast\Node
    {
        $types = [];
        if (!\is_null($type) && !($type instanceof Token && $type->kind === TokenKind::BarToken)) {
            $result = static::phpParserTypeToAstNode($type, $line);
Severity: Minor
Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 2 hrs to fix

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 normalizeWhileStatement has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private static function normalizeWhileStatement(Node $original_node): array
    {
        $node = $original_node;
        // Repeatedly apply these rules
        while (true) {
Severity: Minor
Found in src/Phan/AST/ASTSimplifier.php - About 2 hrs to fix

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 findFunctionLikeDeclaration has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private static function findFunctionLikeDeclaration(
        FileCacheEntry $contents,
        int $line,
        string $name
    ): ?FunctionLike {
Severity: Minor
Found in .phan/plugins/PHPDocToRealTypesPlugin/Fixers.php - About 2 hrs to fix

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 visitClass has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitClass(Node $node): void
    {
        if (!$this->context->isInClassScope()) {
            // should be impossible
            return;
Severity: Minor
Found in .phan/plugins/AvoidableGetterPlugin.php - About 2 hrs to fix

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 main has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function main(): void
    {
        error_reporting(E_ALL);
        ini_set('memory_limit', '2G');
        global $argv;
Severity: Minor
Found in internal/lib/IncompatibleXMLSignatureDetector.php - About 2 hrs to fix

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 visitVar has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitVar(Node $node): void
    {
        // @phan-suppress-next-line PhanUndeclaredProperty
        if ($node->flags & PhanAnnotationAdder::FLAG_INITIALIZES || isset($node->is_reference)) {
            return;
Severity: Minor
Found in .phan/plugins/ConstantVariablePlugin.php - About 2 hrs to fix

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 findFunctionLikeDeclaration has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private static function findFunctionLikeDeclaration(
        FileCacheEntry $contents,
        int $line,
        string $name
    ): ?FunctionLike {
Severity: Minor
Found in .phan/plugins/PHPDocRedundantPlugin/Fixers.php - About 2 hrs to fix

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 findFunctionLikeDeclaration has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private static function findFunctionLikeDeclaration(
        FileCacheEntry $contents,
        int $line,
        string $name
    ): ?FunctionLike {
Severity: Minor
Found in .phan/plugins/PreferNamespaceUsePlugin/Fixers.php - About 2 hrs to fix

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 visitIsset has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitIsset(Node $node): Context
    {
        $argument = $node->children['var'];
        $variable = $argument;

Severity: Minor
Found in .phan/plugins/InvalidVariableIssetPlugin.php - About 2 hrs to fix

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

Severity
Category
Status
Source
Language