Showing 4,939 of 4,939 total issues

The method main() contains an exit expression.
Open

            exit(0);
Severity: Minor
Found in internal/line_deleter.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

The class VariableTrackerVisitor has 1150 lines of code. Current threshold is 1000. Avoid really long classes.
Open

final class VariableTrackerVisitor extends AnalysisVisitor
{
    /**
     * This shared graph instance maps definitions of variables (in a function-like context)
     * to the uses of that variable.

The method isRedundantFunctionComment() has an NPath complexity of 5904. The configured NPath complexity threshold is 200.
Open

    private static function isRedundantFunctionComment(FunctionInterface $method, string $doc_comment): bool
    {
        $lines = explode("\n", $doc_comment);
        foreach ($lines as $line) {
            $line = trim($line, " \r\n\t*/");

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method visitAssign() has an NPath complexity of 331776. The configured NPath complexity threshold is 200.
Open

    public function visitAssign(Node $node): void
    {
        $var = $node->children['var'];
        if (!$var instanceof Node) {
            return;

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method checkMovedArg() has an NPath complexity of 245. The configured NPath complexity threshold is 200.
Open

    private function checkMovedArg(FunctionInterface $function, array $args, Node $node, array $arg_names, array $places_set = []): void
    {
        $real_parameters = $function->getRealParameterList();
        $parameters = $function->getParameterList();
        /** @var associative-array<string,?int> maps lowercase param names to their unique index, or null */

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method dumpGraphML() has 113 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    private function dumpGraphML(string $title, array $graph, bool $is_classgraph, bool $hide_labels): void
    {
        $node_id = 0;
        $edge_id = 0;

The method printUsageAndExit() contains an exit expression.
Open

        exit($exit_code);

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

The method shouldWarnAboutImpossibleArrayKeyExists() has an NPath complexity of 1033920. The configured NPath complexity threshold is 200.
Open

    private static function shouldWarnAboutImpossibleArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?UnionType $key_type = null, ?UnionType $array_type = null): bool
    {
        $array_type = $array_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
        if (!$array_type->hasRealTypeSet()) {
            return false;

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method checkMultipleReturns() has an NPath complexity of 324. The configured NPath complexity threshold is 200.
Open

    private function checkMultipleReturns(array $possible_return_nodes): void
    {
        if (\count($possible_return_nodes) <= 1) {
            return;
        }

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method finalizeProcess() has an NPath complexity of 292. The configured NPath complexity threshold is 200.
Open

    public function finalizeProcess(CodeBase $code_base): void
    {
        if (!self::$use_dynamic) {
            return;
        }

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method getAnalyzeFunctionCallClosures() has 102 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
    {
        /**
         * Analyzes a printf-like function with a format directive in the first position.
         * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
Severity: Minor
Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

The method analyzeReturnValue() has an NPath complexity of 800. The configured NPath complexity threshold is 200.
Open

    private function analyzeReturnValue($expr_node, int $lineno, array &$sleep_properties): void
    {
        $context = clone($this->context)->withLineNumberStart($lineno);
        if (!($expr_node instanceof Node)) {
            $this->emitPluginIssue(
Severity: Minor
Found in .phan/plugins/SleepCheckerPlugin.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid using empty try-catch blocks in isParameterFinal.
Open

            } catch (CodeBaseException $_) {
            }

EmptyCatchBlock

Since: 2.7.0

Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.

Example

class Foo {

  public function bar()
  {
      try {
          // ...
      } catch (Exception $e) {} // empty catch block
  }
}

Source https://phpmd.org/rules/design.html#emptycatchblock

The method visitIf() has an NPath complexity of 241. The configured NPath complexity threshold is 200.
Open

    public function visitIf(Node $node): Context
    {
        // Here, we visit the group of if/elseif/else instead of the individuals (visitIfElem)
        // so that we have the Union types of the variables **before** the PreOrderAnalysisVisitor makes inferences
        foreach ($node->children as $if_node) {
Severity: Minor
Found in .phan/plugins/NonBoolBranchPlugin.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method getAnalyzeFunctionCallClosures() has 105 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
    {
        /**
         * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
         */

The method analyzePrintfPattern() has 269 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    protected function analyzePrintfPattern(CodeBase $code_base, Context $context, FunctionInterface $function, $pattern_node, $arg_nodes): void
    {
        // Given a node, extract the printf directive and whether or not it could be translated
        $primitive_for_fmtstr = $this->astNodeToPrimitive($code_base, $context, $pattern_node);
        /**
Severity: Minor
Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

The method main() contains an exit expression.
Open

            exit(1);
Severity: Minor
Found in internal/line_deleter.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

The method getAnalyzeFunctionCallClosuresStatic() has 864 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    private static function getAnalyzeFunctionCallClosuresStatic(): array
    {
        $stop_exception = new StopParamAnalysisException();

        /**

The method getAnalyzeFunctionCallClosures() has an NPath complexity of 1024. The configured NPath complexity threshold is 200.
Open

    public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
    {
        /**
         * Analyzes a printf-like function with a format directive in the first position.
         * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
Severity: Minor
Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method visitVar() has an NPath complexity of 1728. The configured NPath complexity threshold is 200.
Open

    public function visitVar(Node $node): void
    {
        // @phan-suppress-next-line PhanUndeclaredProperty
        if ($node->flags & PhanAnnotationAdder::FLAG_INITIALIZES || isset($node->is_reference)) {
            return;

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Severity
Category
Status
Source
Language