Showing 4,939 of 4,939 total issues

The method checkAllArgsUsed() has an NPath complexity of 308. The configured NPath complexity threshold is 200.
Open

    private static function checkAllArgsUsed(array $opts, array &$argv): void
    {
        $pruneargv = [];
        foreach ($opts as $opt => $value) {
            foreach ($argv as $key => $chunk) {
Severity: Minor
Found in src/Phan/CLI.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 ensureASTParserExists() contains an exit expression.
Open

            exit(EXIT_FAILURE);
Severity: Minor
Found in src/Phan/CLI.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 'getForbidUndeclaredMagicProperties()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getForbidUndeclaredMagicProperties(): bool
    {
        return ($this->comment_flags & Flags::CLASS_FORBID_UNDECLARED_MAGIC_PROPERTIES) !== 0;
    }
Severity: Minor
Found in src/Phan/Language/Element/Comment.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

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

    public static function functionListFromFunction(
        FunctionInterface $function
    ): array {
        // See if we have any type information for this
        // internal function

The method addParamToScopeOfFunctionOrMethod() has an NPath complexity of 1320. The configured NPath complexity threshold is 200.
Open

    public static function addParamToScopeOfFunctionOrMethod(
        Context $context,
        CodeBase $code_base,
        FunctionInterface $function,
        Comment $comment,

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

    private function __construct(array $opts, array $argv)
    {
        self::detectAndConfigureColorSupport($opts);

        if (\array_key_exists('extended-help', $opts)) {
Severity: Minor
Found in src/Phan/CLI.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 usage() has 442 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public static function usage(string $msg = '', ?int $exit_code = EXIT_SUCCESS, int $usage_type = UsageException::PRINT_NORMAL, bool $forbid_color = true): void
    {
        global $argv;

        if ($msg !== '') {
Severity: Minor
Found in src/Phan/CLI.php by phpmd

The method renderLongProgress() has an NPath complexity of 216. The configured NPath complexity threshold is 200.
Open

    private static function renderLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): string
    {
        $buf = '';
        if ($msg !== self::$current_progress_state_long_progress) {
            switch ($msg) {
Severity: Minor
Found in src/Phan/CLI.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 analyzeReturnTypesInner() has an NPath complexity of 418770. The configured NPath complexity threshold is 200.
Open

    private function analyzeReturnTypesInner(CodeBase $code_base): void
    {
        if ($this->isPHPInternal()) {
            // nothing to do, no known 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 __construct() contains an exit expression.
Open

            exit(EXIT_SUCCESS);
Severity: Minor
Found in src/Phan/CLI.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 usage() contains an exit expression.
Open

            exit($exit_code);
Severity: Minor
Found in src/Phan/CLI.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 sanityCheckAstVersion() contains an exit expression.
Open

            exit(1);
Severity: Minor
Found in src/Phan/CLI.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 combineArrayTypeListsOverriding() has an NPath complexity of 4320. The configured NPath complexity threshold is 200.
Open

    private static function combineArrayTypeListsOverriding(array $left_types, array $right_types, bool $is_assignment, bool $is_real): array
    {
        if ($is_real && !$right_types) {
            return [];
        }
Severity: Minor
Found in src/Phan/Language/Type/ArrayType.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 __construct() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
Open

    public function __construct(
        int $comment_flags,
        array $variable_list,
        array $parameter_list,
        array $template_type_list,
Severity: Minor
Found in src/Phan/Language/Element/Comment.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 fromNode() has 156 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public static function fromNode(
        Context $context,
        CodeBase $code_base,
        Node $node,
        FullyQualifiedFunctionName $fqsen
Severity: Minor
Found in src/Phan/Language/Element/Func.php by phpmd

The method canCastToNonNullableTypeWithoutConfig() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
Open

    protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
    {
        if ($type instanceof ArrayType) {
            if ($type instanceof GenericArrayType) {
                if (!$this->element_type->canCastToTypeWithoutConfig($type->element_type)) {

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 analyzeReturnTypes.
Open

        } catch (RecursionDepthException $_) {
        }

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

    private function __construct(array $opts, array $argv)
    {
        self::detectAndConfigureColorSupport($opts);

        if (\array_key_exists('extended-help', $opts)) {
Severity: Minor
Found in src/Phan/CLI.php by phpmd

The method __construct() contains an exit expression.
Open

            exit(1);
Severity: Minor
Found in src/Phan/CLI.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 checkPluginsExist() contains an exit expression.
Open

            exit(1);
Severity: Minor
Found in src/Phan/CLI.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

Severity
Category
Status
Source
Language