Showing 3,272 of 4,939 total issues

Function filterSimilarMethods has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function filterSimilarMethods(CodeBase $code_base, Context $context, array $methods, bool $is_static): array
    {
        $class_fqsen_in_current_scope = self::maybeGetClassInCurrentScope($context);

        $candidates = [];
Severity: Minor
Found in src/Phan/IssueFixSuggester.php - About 45 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 deeply nested control flow statements.
Open

                        if (!$current_function->isStatic()) {
                            $suggestions[] = '$this->' . $variable_name;
                        }
Severity: Major
Found in src/Phan/IssueFixSuggester.php - About 45 mins to fix

    Method suggestSimilarClass has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            CodeBase $code_base,
            Context $context,
            FullyQualifiedClassName $class_fqsen,
            ?Closure $filter = null,
            string $prefix = null,
    Severity: Minor
    Found in src/Phan/IssueFixSuggester.php - About 45 mins to fix

      Function generateSuppressIssueSummary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private function generateSuppressIssueSummary(string $baseline_summary_type): string
          {
              if ($baseline_summary_type === 'none') {
                  return '';
              }
      Severity: Minor
      Found in src/Phan/Plugin/Internal/BaselineSavingPlugin.php - About 45 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 visitClassConst has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function visitClassConst(Node $node): void
          {
              if (!isset($node->tolerant_ast_node)) {
                  return;
              }
      Severity: Minor
      Found in src/Phan/Plugin/Internal/PhantasmPlugin/PhantasmVisitor.php - About 45 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 walkcGraph has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private function walkcGraph(array $newgraph, string $node, int $depth = 0): array
          {
              static $i = 0;
              static $visited = [];
      
      
      Severity: Minor
      Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 45 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 deeply nested control flow statements.
      Open

                                      if ($file == $v) {
                                          $v = $cl;
                                          goto cfound;
                                      }
      Severity: Major
      Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if (!Config::get_quick_mode()) {
                                            $analyzer = new PostOrderAnalysisVisitor($code_base, $context, []);
                                            $analyzer->analyzeCallableWithArgumentTypes([$passed_array_element_types], $filter_function);
                                        }
        Severity: Major
        Found in src/Phan/Plugin/Internal/ArrayReturnTypeOverridePlugin.php - About 45 mins to fix

          Function yieldSuppressionCommentsPhpToken has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function yieldSuppressionCommentsPhpToken(
                  string $file_contents
              ): Generator {
                  // @phan-suppress-next-line PhanUndeclaredClassMethod missing in php 8 before 8.0.0RC4
                  foreach (PhpToken::tokenize($file_contents) as $token) {
          Severity: Minor
          Found in src/Phan/Plugin/Internal/BuiltinSuppressionPlugin.php - About 45 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 createClosures has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function createClosures(): array
              {
                  /**
                   * @return ?FileEditSet
                   */
          Severity: Minor
          Found in src/Phan/Plugin/Internal/IssueFixingPlugin/IssueFixer.php - About 45 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 getOrderKey has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getOrderKey(): string
              {
                  $is_analyzed_order = Phan::isExcludedAnalysisFile($this->context->getFile()) ? "1" : "0";
                  switch ($this->kind) {
                      case self::KIND_CLASS:
          Severity: Minor
          Found in src/Phan/Plugin/Internal/CtagsPlugin/CtagsEntry.php - About 45 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

          Method shouldSuppressIssue has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  CodeBase $code_base,
                  Context $context,
                  string $issue_type,
                  int $lineno,
                  array $parameters,
          Severity: Minor
          Found in src/Phan/Plugin/Internal/BuiltinSuppressionPlugin.php - About 45 mins to fix

            Function addEntriesForGlobalElements has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function addEntriesForGlobalElements(
                    CtagsEntrySet $entries,
                    CodeBase $code_base
                ): void {
                    foreach ($code_base->getFunctionMap() as $function_fqsen => $function) {
            Severity: Minor
            Found in src/Phan/Plugin/Internal/CtagsPlugin.php - About 45 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

            Method shouldSuppressIssue has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    CodeBase $code_base,
                    Context $context,
                    string $issue_type,
                    int $lineno,
                    array $parameters,
            Severity: Minor
            Found in src/Phan/Issue.php - About 45 mins to fix

              Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      string $type,
                      int $category,
                      int $severity,
                      string $template_raw,
                      int $remediation_difficulty,
              Severity: Minor
              Found in src/Phan/Issue.php - About 45 mins to fix

                Method emitWithParameters has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        string $type,
                        string $file,
                        int $line,
                        array $template_parameters,
                        Suggestion $suggestion = null,
                Severity: Minor
                Found in src/Phan/Issue.php - About 45 mins to fix

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

                      private function analyzeFunctionLike(Node $node): void
                      {
                          if (!$this->context->isInFunctionLikeScope()) {
                              return;
                          }
                  Severity: Minor
                  Found in src/Phan/Plugin/Internal/UseReturnValuePlugin/UseReturnValueVisitor.php - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function analyzeMethod(
                          CodeBase $code_base,
                          Method $method
                      ): void {
                          if ($method->isFromPHPDoc()) {
                  Severity: Minor
                  Found in src/Phan/Plugin/Internal/DumpPHPDocPlugin.php - About 45 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 checkSingleDefinitionReferenceOrGlobalOrStatic has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function checkSingleDefinitionReferenceOrGlobalOrStatic(
                          VariableGraph $graph,
                          string $variable_name,
                          array $issue_overrides_for_definition_ids
                      ): void {
                  Severity: Minor
                  Found in src/Phan/Plugin/Internal/VariableTrackerPlugin.php - About 45 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

                  Method checkUselessScalarComparison has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          Node $node,
                          UnionType $left,
                          UnionType $right,
                          $left_node,
                          $right_node,
                  Severity: Minor
                  Found in src/Phan/Plugin/Internal/RedundantConditionVisitor.php - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language