Showing 4,939 of 4,939 total issues

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

    public static function methodListFromReflectionClassAndMethod(
        Context $context,
        \ReflectionClass $class,
        \ReflectionMethod $reflection_method
    ): 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

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 class FunctionLikeDeclarationType has 1054 lines of code. Current threshold is 1000. Avoid really long classes.
Open

abstract class FunctionLikeDeclarationType extends Type implements FunctionInterface
{
    // Subclasses will override this
    public const NAME = '';

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

    public function asFunctionInterfaceOrNull(CodeBase $code_base, Context $context): ?FunctionInterface
    {
        if (\count($this->field_types) !== 2) {
            Issue::maybeEmit(
                $code_base,

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

    protected function canCastToNonNullableTypeHandlingTemplates(Type $type, CodeBase $code_base): bool
    {
        if (parent::canCastToNonNullableTypeHandlingTemplates($type, $code_base)) {
            return true;
        }

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() 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 class ArrayShapeType has 1108 lines of code. Current threshold is 1000. Avoid really long classes.
Open

final class ArrayShapeType extends ArrayType implements GenericArrayInterface
{
    /** @phan-override */
    public const NAME = 'array';

The method fromArgv() contains an exit expression.
Open

            exit((int)$e->getCode());  // unreachable
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 getFlagSuggestionString() has an NPath complexity of 1672. The configured NPath complexity threshold is 200.
Open

    public static function getFlagSuggestionString(
        string $key
    ): string {
        $trim = static function (string $s): string {
            return \rtrim($s, ':');
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 canCastToNonNullableType() has an NPath complexity of 304. The configured NPath complexity threshold is 200.
Open

    protected function canCastToNonNullableType(Type $type): bool
    {
        if ($type instanceof ArrayType) {
            if ($type instanceof GenericArrayType) {
                if (!$this->element_type->canCastToType($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

The 'getPhanFlagsHasState()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    abstract public function getPhanFlagsHasState(int $bits): bool;

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 fromArgv() contains an exit expression.
Open

            exit($e->getCode());
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 directoryNameToFileList() has an NPath complexity of 3032. The configured NPath complexity threshold is 200.
Open

    private static function directoryNameToFileList(
        string $directory_name
    ): array {
        $file_list = [];

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

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

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

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 151 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    private function analyzeReturnTypesInner(CodeBase $code_base): void
    {
        if ($this->isPHPInternal()) {
            // nothing to do, no known Node
            return;

The method isStrictSubtypeOf() has an NPath complexity of 1152. The configured NPath complexity threshold is 200.
Open

    public function isStrictSubtypeOf(CodeBase $code_base, UnionType $target): bool
    {
        // Fast-track most common cases first
        $type_set = $this->type_set;
        // If either type is unknown, we can't call it
Severity: Minor
Found in src/Phan/Language/UnionType.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 fromStringInContext() has 281 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public static function fromStringInContext(
        string $string,
        Context $context,
        int $source,
        CodeBase $code_base = null
Severity: Minor
Found in src/Phan/Language/Type.php by phpmd

The method canCastToUnionTypeHandlingTemplates() has an NPath complexity of 17280. The configured NPath complexity threshold is 200.
Open

    public function canCastToUnionTypeHandlingTemplates(
        UnionType $target,
        CodeBase $code_base
    ): bool {
        // Fast-track most common cases first
Severity: Minor
Found in src/Phan/Language/UnionType.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

Severity
Category
Status
Source
Language