Showing 4,939 of 4,939 total issues

The method exit() contains an exit expression.
Open

            exit($exit_code);
Severity: Minor
Found in src/Phan/Daemon/Request.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 accept() has an NPath complexity of 792. The configured NPath complexity threshold is 200.
Open

    public static function accept(CodeBase $code_base, Closure $file_path_lister, Responder $responder, bool $fork): ?Request
    {
        FileCache::clear();

        $request = $responder->getRequestData();
Severity: Minor
Found in src/Phan/Daemon/Request.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 visitArray() has an NPath complexity of 1345. The configured NPath complexity threshold is 200.
Open

    public function visitArray(Node $node): UnionType
    {
        $children = $node->children;
        if (\count($children) > 0) {
            $key_set = $this->getEquivalentArraySet($node);
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.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 createPhanSettingsForComposerSettings() has 158 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public static function createPhanSettingsForComposerSettings(array $composer_settings, ?string $vendor_path, array $opts): InitializedSettings
    {
        $level = $opts['init-level'] ?? 3;
        $level = self::LEVEL_MAP[\strtolower((string)$level)] ?? $level;
        if (\filter_var($level, FILTER_VALIDATE_INT) === false) {
Severity: Minor
Found in src/Phan/Config/Initializer.php by phpmd

The method resolveDocCommentForClosure() has an NPath complexity of 70682. The configured NPath complexity threshold is 200.
Open

    private static function resolveDocCommentForClosure(PhpParser\Node\Expression $node): ?string
    {
        $doc_comment = $node->getDocCommentText();
        if (\Phan\Library\StringUtil::isNonZeroLengthString($doc_comment)) {
            return $doc_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 functionLikeFQSENListFromNode() has an NPath complexity of 420. The configured NPath complexity threshold is 200.
Open

    private function functionLikeFQSENListFromNode($node): array
    {
        $orig_node = $node;
        if ($node instanceof Node) {
            $node = (new ContextNode($this->code_base, $this->context, $node))->getEquivalentPHPValue();
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.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 getConfigErrors() has 234 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public static function getConfigErrors(array $configuration): array
    {
        /**
         * @param mixed $value
         */
Severity: Minor
Found in src/Phan/Config.php by phpmd

The method methodFQSENListFromParts() has an NPath complexity of 672. The configured NPath complexity threshold is 200.
Open

    private function methodFQSENListFromParts($class_or_expr, $method_name): array
    {
        $code_base = $this->code_base;
        $context = $this->context;

Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.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 getPrinter() contains an exit expression.
Open

            exit(0);
Severity: Minor
Found in src/Phan/Daemon/Request.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 121 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function visitVar(Node $node): UnionType
    {
        // $$var or ${...} (whose idea was that anyway?)
        $name_node = $node->children['name'];
        if (($name_node instanceof Node)) {
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

The method analyzeProp() has an NPath complexity of 1926. The configured NPath complexity threshold is 200.
Open

    private function analyzeProp(Node $node, bool $is_static): UnionType
    {
        // Either expr(instance) or class(static) is set
        $expr_node = $node->children['expr'] ?? null;
        try {
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.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 visitMethodCall.
Open

                        } catch (RecursionDepthException $_) {
                        }
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

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

    public static function unionTypeFromClassNode(
        CodeBase $code_base,
        Context $context,
        $node
    ): UnionType {
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.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 hasInternalFunctionWithFQSEN() has an NPath complexity of 610. The configured NPath complexity threshold is 200.
Open

    private function hasInternalFunctionWithFQSEN(
        FullyQualifiedFunctionName $fqsen
    ): bool {
        $canonical_fqsen = $fqsen->withAlternateId(0);
        $found = isset($this->internal_function_fqsen_set[$canonical_fqsen]);
Severity: Minor
Found in src/Phan/CodeBase.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 initHandleMap() has 1161 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    protected static function initHandleMap(): array
    {
        $closures = [
            /** @return ?ast\Node */
            'Microsoft\PhpParser\Node\SourceFileNode' => static function (PhpParser\Node\SourceFileNode $n, int $start_line): ?\ast\Node {

The method visitConditional() has an NPath complexity of 18306. The configured NPath complexity threshold is 200.
Open

    public function visitConditional(Node $node): UnionType
    {
        $cond_node = $node->children['cond'];
        $cond_truthiness = self::checkCondUnconditionalTruthiness($cond_node);
        // For the shorthand $a ?: $b, the cond node will be the truthy value.
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.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 getConfigErrors() has an NPath complexity of 933120. The configured NPath complexity threshold is 200.
Open

    public static function getConfigErrors(array $configuration): array
    {
        /**
         * @param mixed $value
         */
Severity: Minor
Found in src/Phan/Config.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 phpParserUnionTypeToAstNode() has an NPath complexity of 210. The configured NPath complexity threshold is 200.
Open

    protected static function phpParserUnionTypeToAstNode($type, ?PhpParser\Node\DelimitedList\QualifiedNameList $other_types, int $line): ?\ast\Node
    {
        $types = [];
        if (!\is_null($type) && !($type instanceof Token && $type->kind === TokenKind::BarToken)) {
            $result = static::phpParserTypeToAstNode($type, $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 visitConditional() has 142 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function visitConditional(Node $node): UnionType
    {
        $cond_node = $node->children['cond'];
        $cond_truthiness = self::checkCondUnconditionalTruthiness($cond_node);
        // For the shorthand $a ?: $b, the cond node will be the truthy value.
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

The method resolveArrayShapeElementTypes() has an NPath complexity of 3752. The configured NPath complexity threshold is 200.
Open

    private function resolveArrayShapeElementTypes(Node $node, UnionType $union_type): ?UnionType
    {
        $dim_node = $node->children['dim'];
        $dim_value = $dim_node instanceof Node ? (new ContextNode($this->code_base, $this->context, $dim_node))->getEquivalentPHPScalarValue() : $dim_node;
        // TODO: detect and warn about null
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.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