Showing 4,939 of 4,939 total issues

Function analyzeFunctionLike has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function analyzeFunctionLike(CodeBase $code_base, FunctionInterface $method): void
    {
        if (Phan::isExcludedAnalysisFile($method->getContext()->getFile())) {
            // This has no side effects, so we can skip files that don't need to be analyzed
            return;
Severity: Minor
Found in .phan/plugins/PHPDocRedundantPlugin.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function isSelfOrParentCallUsingObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function isSelfOrParentCallUsingObject(CodeBase $code_base, FunctionInterface $method, Node $node): bool
    {
        $class_node = $node->children['class'];
        if (!($class_node instanceof Node && $class_node->kind === ast\AST_NAME)) {
            return false;
Severity: Minor
Found in .phan/plugins/PossiblyStaticMethodPlugin.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function analyzeMethod has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function analyzeMethod(
        CodeBase $code_base,
        Method $method
    ): void {
        // 1. Perform any checks that can be done immediately to rule out being able
Severity: Minor
Found in .phan/plugins/PossiblyStaticMethodPlugin.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function visitConst has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitConst(Node $node): void
    {
        $expression = $node->children['name'];
        if (!($expression instanceof Node) || $expression->kind !== ast\AST_NAME) {
            return;
Severity: Minor
Found in .phan/plugins/NotFullyQualifiedUsagePlugin.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid too many return statements within this method.
Open

                return get_class($value) . '(' . $value->getRepresentationForIssue() . ')';
Severity: Major
Found in src/Phan/Debug/Frame.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return true;
    Severity: Major
    Found in src/Phan/CLI.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return count($value) > 0 ? '[...]' : '[]';
      Severity: Major
      Found in src/Phan/Debug/Frame.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return '[' . \implode(', ', $result) . ']';
        Severity: Major
        Found in src/Phan/Debug/Frame.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return null;
          Severity: Major
          Found in src/Phan/CodeBase.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $variable_description;
            Severity: Major
            Found in src/Phan/LanguageServer/GoToDefinitionRequest.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return '';
              Severity: Major
              Found in src/Phan/CLI.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $generate_suggestion_text($similarity_values[0][2]);
                Severity: Major
                Found in src/Phan/CLI.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return null;
                  Severity: Major
                  Found in src/Phan/Daemon/Request.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $generate_suggestion_text($similarity_values[0][2], $similarity_values[1][2]);
                    Severity: Major
                    Found in src/Phan/CLI.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return get_class($value) . '(' . $value . ')';
                      Severity: Major
                      Found in src/Phan/Debug/Frame.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return \trim(\ob_get_clean() ?: 'resource');
                        Severity: Major
                        Found in src/Phan/Debug/Frame.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return $request_obj;
                          Severity: Major
                          Found in src/Phan/Daemon/Request.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return null;
                            Severity: Major
                            Found in src/Phan/LanguageServer/CompletionRequest.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $generate_suggestion_text($alternate);
                              Severity: Major
                              Found in src/Phan/CLI.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return CompletionItemKind::METHOD;
                                Severity: Major
                                Found in src/Phan/LanguageServer/CompletionRequest.php - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language