Showing 4,939 of 4,939 total issues

The method shouldWarnAboutMoreSpecificType() has an NPath complexity of 576. The configured NPath complexity threshold is 200.
Open

    private static function shouldWarnAboutMoreSpecificType(CodeBase $code_base, UnionType $actual_type, UnionType $declared_return_type): bool
    {
        if ($declared_return_type->isEmpty()) {
            // There was no phpdoc type declaration, so let UnknownElementTypePlugin warn about that instead of this.
            // This plugin warns about `@return mixed` but not the absence of a declaration because the former normally prevents phan from inferring something more specific.

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 getReturnTypeOverridesStatic() has an NPath complexity of 361184624640. The configured NPath complexity threshold is 200.
Open

    public static function getReturnTypeOverridesStatic(CodeBase $code_base): array
    {
        $string_union_type = StringType::instance(false)->asPHPDocUnionType();
        $string_union_type_real = StringType::instance(false)->asRealUnionType();
        $string_union_type_with_false_in_real = UnionType::fromFullyQualifiedPHPDocAndRealString('string', 'string|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 class MiscParamPlugin has 1258 lines of code. Current threshold is 1000. Avoid really long classes.
Open

final class MiscParamPlugin extends PluginV3 implements
    AnalyzeFunctionCallCapability
{
    /**
     * @param list<Node|string|int|float> $args

The method visitCall() has an NPath complexity of 300. The configured NPath complexity threshold is 200.
Open

    public function visitCall(Node $node): void
    {
        [$parent, $used] = $this->findNonUnaryParentNode($node);
        if (!$parent) {
            //fwrite(STDERR, "No parent in " . __METHOD__ . "\n");

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 visitCall.
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 visitSwitchList() has an NPath complexity of 1736. The configured NPath complexity threshold is 200.
Open

    public function visitSwitchList(Node $node): void
    {
        $children = $node->children;
        if (count($children) <= 1) {
            // This plugin will never emit errors if there are 0 or 1 elements.

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 astNodeToPrimitive() has an NPath complexity of 2400. The configured NPath complexity threshold is 200.
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);
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 analyzeFunction() has 127 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function analyzeFunction(
        CodeBase $code_base,
        Func $function
    ): void {
        // NOTE: Placeholders can be found in \Phan\Issue::uncolored_format_string_for_replace

The method checkIsRedundantReturn() has an NPath complexity of 1056. The configured NPath complexity threshold is 200.
Open

    private static function checkIsRedundantReturn(CodeBase $code_base, FunctionInterface $method, string $doc_comment): void
    {
        if (strpos($doc_comment, '@return') === false) {
            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 an NPath complexity of 6144. The configured NPath complexity threshold is 200.
Open

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

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 analyzePrintfPattern() has an NPath complexity of 49014400. The configured NPath complexity threshold is 200.
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

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 warnAboutTransientSleepProperties() has an NPath complexity of 258. The configured NPath complexity threshold is 200.
Open

    private function warnAboutTransientSleepProperties(array $sleep_properties): void
    {
        if (count($sleep_properties) === 0) {
            // Give up, failed to extract property names
            return;
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

The method checkCall() has an NPath complexity of 15444. The configured NPath complexity threshold is 200.
Open

    private function checkCall(FunctionInterface $function, array $args, Node $node): void
    {
        $arg_names = [];
        foreach ($args as $i => $arg_node) {
            $name = self::extractName($arg_node);

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 checkCall() has 110 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    private function checkCall(FunctionInterface $function, array $args, Node $node): void
    {
        $arg_names = [];
        foreach ($args as $i => $arg_node) {
            $name = self::extractName($arg_node);

The method checkPossiblyInfiniteLoopNodes() has an NPath complexity of 890. The configured NPath complexity threshold is 200.
Open

    private function checkPossiblyInfiniteLoopNodes(
        VariableGraph $variable_graph,
        VariableTrackerVisitor $variable_tracker_visitor
    ): void {
        $loop_nodes = $variable_tracker_visitor->getPossiblyInfiniteLoopNodes();

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 getReturnTypeOverrides() has an NPath complexity of 588. The configured NPath complexity threshold is 200.
Open

    public function getReturnTypeOverrides(CodeBase $code_base): array
    {
        $string_union_type = StringType::instance(false)->asPHPDocUnionType();
        /**
         * @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 createClosureForMethod() has 177 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    private function createClosureForMethod(CodeBase $code_base, Method $method, string $name): ?Closure
    {
        // TODO: Add a helper method which will convert a doc comment and a stub php function source code to a closure for a param index (or indices)
        switch (\strtolower($name)) {
            case 'asserttrue':

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

    public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
    {
        /**
         * @return Closure(CodeBase, Context, FunctionInterface, list<mixed>):void
         */
Severity: Minor
Found in .phan/plugins/PhanSelfCheckPlugin.php by phpmd

The function phan_repl_help() has an NPath complexity of 10656. The configured NPath complexity threshold is 200.
Open

function phan_repl_help($value = "\x00extended_help"): void
{
    if ($value === "\x00extended_help") {
        echo "Phan " . CLI::PHAN_VERSION . " CLI autocompletion utilities.\n";
        echo "Type help(\$value); or help('function or constant or class name'); for help.\n";
Severity: Minor
Found in tool/phan_repl_helpers.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 addParametersAndUseVariablesToGraph() has an NPath complexity of 612. The configured NPath complexity threshold is 200.
Open

    private static function addParametersAndUseVariablesToGraph(
        Node $node,
        VariableGraph $graph,
        VariableTrackingScope $scope
    ): array {

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