Showing 4,939 of 4,939 total issues

The method iterableKeyUnionType() has an NPath complexity of 261. The configured NPath complexity threshold is 200.
Open

    public function iterableKeyUnionType(CodeBase $code_base): UnionType
    {
        // This is frequently called, and has been optimized
        $new_type_builder = new UnionTypeBuilder();
        foreach ($this->type_set as $type) {
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 'getFlagsHasState()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getFlagsHasState(int $flag): bool
    {
        return ($this->flags & $flag) === $flag;
    }

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

final class EmptyUnionType extends UnionType
{
    /**
     * An optional list of types represented by this union
     * @internal
Severity: Minor
Found in src/Phan/Language/EmptyUnionType.php by phpmd

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

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

    public function iterableKeyUnionType(CodeBase $code_base): ?UnionType
    {
        if ($this->namespace === '\\') {
            $name = strtolower($this->name);
            if ($name === 'traversable' || $name === 'iterator') {
Severity: Minor
Found in src/Phan/Language/Type.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 'getFlagsHasState()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getFlagsHasState(int $flag): bool
    {
        return ($this->flags & $flag) === $flag;
    }

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

    public function hasSubtypeOf(
        UnionType $target
    ): bool {
        // Fast-track most common cases first
        $type_set = $this->type_set;
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 fromNode() has an NPath complexity of 954. The configured NPath complexity threshold is 200.
Open

    public static function fromNode(
        Context $context,
        CodeBase $code_base,
        Node $node
    ): Parameter {

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

    protected static function make(
        string $namespace,
        string $type_name,
        array $template_parameter_type_list,
        bool $is_nullable,
Severity: Minor
Found in src/Phan/Language/Type.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 locateMiscellaneousTokenCompletion() has an NPath complexity of 264. The configured NPath complexity threshold is 200.
Open

    private static function locateMiscellaneousTokenCompletion(
        CompletionRequest $request,
        CodeBase $code_base,
        Context $context,
        Node $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 parseGenericArrayTypeFromTemplateParameterList() has an NPath complexity of 864. The configured NPath complexity threshold is 200.
Open

    private static function parseGenericArrayTypeFromTemplateParameterList(
        array $template_parameter_type_list,
        bool $is_nullable,
        bool $always_has_elements,
        bool $is_associative
Severity: Minor
Found in src/Phan/Language/Type.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 extractDocComment() has an NPath complexity of 804. The configured NPath complexity threshold is 200.
Open

    public static function extractDocComment(string $doc_comment, int $comment_category = null, UnionType $element_type = null, bool $remove_type = false): string
    {
        // Trim the start and the end of the doc comment.
        //
        // We leave in the second `*` of `/**` so that every single non-empty line

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 143 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,
        FullyQualifiedMethodName $fqsen,
Severity: Minor
Found in src/Phan/Language/Element/Method.php by phpmd

The method getShortRepresentationForIssue() has an NPath complexity of 912. The configured NPath complexity threshold is 200.
Open

    public function getShortRepresentationForIssue(bool $is_internal = false): string
    {
        $string = '';

        $union_type_string = $this->getUnionTypeRepresentationForIssue();

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

    public function getPhanFlagsHasState(int $flag): bool
    {
        return ($this->phan_flags & $flag) === $flag;
    }

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

    public function canStrictCastToUnionType(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 merge() has an NPath complexity of 80688. The configured NPath complexity threshold is 200.
Open

    public static function merge(array $union_types, bool $normalize_array_shapes = true): UnionType
    {
        $n = \count($union_types);
        if ($n < 2) {
            return \reset($union_types) ?: UnionType::$empty_instance;
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 resolveTemplateType() has an NPath complexity of 338. The configured NPath complexity threshold is 200.
Open

    public function resolveTemplateType(
        CodeBase $code_base,
        UnionType $object_union_type
    ): Method {
        $defining_fqsen = $this->getDefiningClassFQSEN();
Severity: Minor
Found in src/Phan/Language/Element/Method.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 canPossiblyCastToClass() has an NPath complexity of 1440. The configured NPath complexity threshold is 200.
Open

    public function canPossiblyCastToClass(CodeBase $code_base, Type $other): bool
    {
        if (!$this->isPossiblyObject()) {
            return false;
        }
Severity: Minor
Found in src/Phan/Language/Type.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 extractDescriptionFromDocComment.
Open

                    } catch (Exception $_) {
                    }

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

Severity
Category
Status
Source
Language