Showing 4,939 of 4,939 total issues

The method analyzeComposition() has an NPath complexity of 3078. The configured NPath complexity threshold is 200.
Open

    public static function analyzeComposition(
        CodeBase $code_base,
        Clazz $class
    ): void {
        // Get the list of all inherited classes.

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

    private static function initTypeModifyingClosuresForVisitCall(): array
    {
        $make_direct_assertion_callback = static function (string $union_type_string): Closure {
            $asserted_union_type = UnionType::fromFullyQualifiedRealString(
                $union_type_string

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

class ParameterTypesAnalyzer
{

    /**
     * Check function, closure, and method parameters to make sure they're valid

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

    public function __construct(
        array $process_task_data_iterator,
        Closure $startup_closure,
        Closure $task_closure,
        Closure $shutdown_closure
Severity: Minor
Found in src/Phan/ForkPool.php by phpmd

The method suggestSimilarProperty() has an NPath complexity of 432. The configured NPath complexity threshold is 200.
Open

    public static function suggestSimilarProperty(CodeBase $code_base, Context $context, Clazz $class, string $wanted_property_name, bool $is_static): ?Suggestion
    {
        if (Config::getValue('disable_suggestions')) {
            return null;
        }
Severity: Minor
Found in src/Phan/IssueFixSuggester.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 nodeToString() has an NPath complexity of 768. The configured NPath complexity threshold is 200.
Open

    public static function nodeToString(
        $node,
        $name = null,
        int $indent = 0
    ): string {
Severity: Minor
Found in src/Phan/Debug.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 class AssignmentVisitor has 1924 lines of code. Current threshold is 1000. Avoid really long classes.
Open

class AssignmentVisitor extends AnalysisVisitor
{
    /**
     * @var UnionType
     * The type of the element on the right side of the assignment

The method assertAnalysisWorkersExitedNormally() contains an exit expression.
Open

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

    public function visitVar(Node $node): Context
    {
        try {
            $variable_name = (new ContextNode(
                $this->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 class Issue has 5671 lines of code. Current threshold is 1000. Avoid really long classes.
Open

class Issue
{
    // phpcs:disable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase
    // this is deliberate for issue names
    // Issue::CATEGORY_SYNTAX
Severity: Minor
Found in src/Phan/Issue.php by phpmd

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

    public static function analyzeComposition(
        CodeBase $code_base,
        Clazz $class
    ): void {
        // Get the list of all inherited classes.

The method build() has an NPath complexity of 252. The configured NPath complexity threshold is 200.
Open

    public function build(): Comment
    {
        foreach ($this->lines as $i => $line) {
            if (\strpos($line, '@') === false) {
                continue;

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

    private function parseCommentLine(int $i, string $line): void
    {
        // https://secure.php.net/manual/en/regexp.reference.internal-options.php
        // (?i) makes this case-sensitive, (?-1) makes it case-insensitive
        // phpcs:ignore Generic.Files.LineLength.MaxExceeded

The method analyzeGenericArrayAssignment() has an NPath complexity of 363. The configured NPath complexity threshold is 200.
Open

    private function analyzeGenericArrayAssignment(Node $node): void
    {
        // Figure out the type of elements in the list
        $right_type = $this->right_type;
        if ($right_type->isEmpty()) {

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

    public function typeCheckDimAssignment(UnionType $assign_type, Node $node): UnionType
    {
        static $int_or_string_type = null;
        static $string_array_type = null;
        static $simple_xml_element_type = 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 checkComplexIsset() has an NPath complexity of 2640. The configured NPath complexity threshold is 200.
Open

    private function checkComplexIsset(Node $node): Context
    {
        // Loop to support getting the var name in is_array($x['field'][0])
        $has_prop_access = false;
        $context = $this->context;

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

    public function analyzeClassAssertion($object_node, $expr_node): ?Context
    {
        if (!($object_node instanceof Node)) {
            return 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

Avoid using empty try-catch blocks in determineUnionType.
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

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

    private static function createNegationCallbackMap(): array
    {
        /** @param list<Node|mixed> $unused_args */
        $remove_null_cb = static function (CodeBase $unused_code_base, Context $unused_context, Variable $variable, array $unused_args): void {
            $variable->setUnionType($variable->getUnionType()->nonNullableClone());

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

    private static function generateIssueMap(): array
    {
        // phpcs:disable Generic.Files.LineLength
        /**
         * @var list<Issue>
Severity: Minor
Found in src/Phan/Issue.php by phpmd
Severity
Category
Status
Source
Language