src/Phan/Analysis/PostOrderAnalysisVisitor.php

Summary

Maintainability
F
1 mo
Test Coverage

File PostOrderAnalysisVisitor.php has 3473 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Phan\Analysis;
Severity: Major
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 wk to fix

    PostOrderAnalysisVisitor has 128 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PostOrderAnalysisVisitor extends AnalysisVisitor
    {
        /**
         * @var list<Node> a list of parent nodes of the currently analyzed node,
         * within the current global or function-like scope
    Severity: Major
    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 days to fix

      Function analyzePassByReferenceArgument has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function analyzePassByReferenceArgument(
              CodeBase $code_base,
              Context $context,
              Node $argument,
              array $argument_list,
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 4 hrs 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 visitReturn has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          public function visitReturn(Node $node): Context
          {
              $context = $this->context;
              // Make sure we're actually returning from a method.
              if (!$context->isInFunctionLikeScope()) {
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 4 hrs 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 analyzeCallToFunctionLike has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          private function analyzeCallToFunctionLike(
              FunctionInterface $method,
              Node $node
          ): void {
              $code_base = $this->code_base;
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs 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 visitArgList has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          public function visitArgList(Node $node): Context
          {
              $argument_name_set = [];
              $has_unpack = false;
      
      
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs 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 analyzeReturnStrict has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          private function analyzeReturnStrict(
              CodeBase $code_base,
              FunctionInterface $method,
              UnionType $expression_type,
              UnionType $method_return_type,
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs 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 visitStaticCall has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function visitStaticCall(Node $node): Context
          {
              // Get the name of the method being called
              $method_name = $node->children['method'];
      
      
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs 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 createPassByReferenceArgumentInCall has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          private function createPassByReferenceArgumentInCall(FunctionInterface $method, Node $argument, Parameter $parameter, ?Parameter $real_parameter): void
          {
              if ($argument->kind === ast\AST_VAR) {
                  // We don't do anything with the new variable; just create it
                  // if it doesn't exist
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs 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 updateParameterTypeByArgument has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          private function updateParameterTypeByArgument(
              FunctionInterface $method,
              Parameter $parameter,
              $argument,
              array $argument_types,
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs 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 warnNoopNew has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          private function warnNoopNew(
              Node $node,
              array $class_list
          ): void {
              $has_constructor_or_destructor = \count($class_list) === 0;
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs 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

      The class PostOrderAnalysisVisitor has an overall complexity of 756 which is very high. The configured complexity threshold is 50.
      Open

      class PostOrderAnalysisVisitor extends AnalysisVisitor
      {
          /**
           * @var list<Node> a list of parent nodes of the currently analyzed node,
           * within the current global or function-like scope

      The class PostOrderAnalysisVisitor has 116 non-getter- and setter-methods. Consider refactoring PostOrderAnalysisVisitor to keep number of methods under 25.
      Open

      class PostOrderAnalysisVisitor extends AnalysisVisitor
      {
          /**
           * @var list<Node> a list of parent nodes of the currently analyzed node,
           * within the current global or function-like scope

      TooManyMethods

      Since: 0.1

      A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      The default was changed from 10 to 25 in PHPMD 2.3.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanymethods

      The class PostOrderAnalysisVisitor has 63 public methods. Consider refactoring PostOrderAnalysisVisitor to keep number of public methods under 10.
      Open

      class PostOrderAnalysisVisitor extends AnalysisVisitor
      {
          /**
           * @var list<Node> a list of parent nodes of the currently analyzed node,
           * within the current global or function-like scope

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      Function checkForInvalidNewType has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private function checkForInvalidNewType(Node $node, array $class_list): void
          {
              // This is either a string (new 'something'()) or a class name (new something())
              $class_node = $node->children['class'];
              if (!$class_node instanceof Node) {
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs 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 visitStaticCall has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function visitStaticCall(Node $node): Context
          {
              // Get the name of the method being called
              $method_name = $node->children['method'];
      
      
      Severity: Major
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs to fix

        Function analyzeProp has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            public function analyzeProp(Node $node, bool $is_static): Context
            {
                $exception_or_null = null;
        
                try {
        Severity: Minor
        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs 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 analyzePassByReferenceArgument has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function analyzePassByReferenceArgument(
                CodeBase $code_base,
                Context $context,
                Node $argument,
                array $argument_list,
        Severity: Major
        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs to fix

          Method updateParameterTypeByArgument has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function updateParameterTypeByArgument(
                  FunctionInterface $method,
                  Parameter $parameter,
                  $argument,
                  array $argument_types,
          Severity: Major
          Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs to fix

            Method visitReturn has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function visitReturn(Node $node): Context
                {
                    $context = $this->context;
                    // Make sure we're actually returning from a method.
                    if (!$context->isInFunctionLikeScope()) {
            Severity: Major
            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

              Function analyzeCallableWithArgumentTypes has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function analyzeCallableWithArgumentTypes(
                      array $argument_types,
                      FunctionInterface $method,
                      array $arguments = [],
                      bool $erase_old_return_type = false
              Severity: Minor
              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs 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 analyzeIncOrDec has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function analyzeIncOrDec(Node $node): Context
                  {
                      $var = $node->children['var'];
                      $old_type = UnionTypeVisitor::unionTypeFromNode($this->code_base, $this->context, $var);
                      if (!$old_type->canCastToUnionType(UnionType::fromFullyQualifiedPHPDocString('int|string|float'))) {
              Severity: Minor
              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs 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 analyzeUnsetProp has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function analyzeUnsetProp(Node $node): Context
                  {
                      $expr_node = $node->children['expr'];
                      $context = $this->context;
                      if (!($expr_node instanceof Node)) {
              Severity: Minor
              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs 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 checkForInfiniteRecursionWithSameArgs has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function checkForInfiniteRecursionWithSameArgs(Node $node, FunctionInterface $method): void
                  {
                      $argument_list_node = $node->children['args'];
                      $parameter_list = $method->getParameterList();
                      if (\count($argument_list_node->children) !== \count($parameter_list)) {
              Severity: Minor
              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs 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 analyzeProp has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function analyzeProp(Node $node, bool $is_static): Context
                  {
                      $exception_or_null = null;
              
                      try {
              Severity: Major
              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                Method analyzeCallToFunctionLike has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function analyzeCallToFunctionLike(
                        FunctionInterface $method,
                        Node $node
                    ): void {
                        $code_base = $this->code_base;
                Severity: Major
                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                  Function analyzeMethodWithArgumentTypes has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function analyzeMethodWithArgumentTypes(
                          Node $argument_list_node,
                          FunctionInterface $method
                      ): void {
                          $method = $this->findDefiningMethod($method);
                  Severity: Minor
                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs 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 getReturnTypesOfConditional has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getReturnTypesOfConditional(Context $context, Node $node): \Generator
                      {
                          $cond_node = $node->children['cond'];
                          $cond_truthiness = UnionTypeVisitor::checkCondUnconditionalTruthiness($cond_node);
                          // For the shorthand $a ?: $b, the cond node will be the truthy value.
                  Severity: Minor
                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs 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 visitArgList has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function visitArgList(Node $node): Context
                      {
                          $argument_name_set = [];
                          $has_unpack = false;
                  
                  
                  Severity: Major
                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                    Method analyzeCallableWithArgumentTypes has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function analyzeCallableWithArgumentTypes(
                            array $argument_types,
                            FunctionInterface $method,
                            array $arguments = [],
                            bool $erase_old_return_type = false
                    Severity: Major
                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                      Method analyzeMethodWithArgumentTypes has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function analyzeMethodWithArgumentTypes(
                              Node $argument_list_node,
                              FunctionInterface $method
                          ): void {
                              $method = $this->findDefiningMethod($method);
                      Severity: Major
                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                        Function emitTypeMismatchReturnIssue has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function emitTypeMismatchReturnIssue(UnionType $expression_type, FunctionInterface $method, UnionType $method_return_type, int $lineno, $inner_node): void
                            {
                                if ($this->shouldSuppressIssue(Issue::TypeMismatchReturnReal, $lineno)) {
                                    // Suppressing TypeMismatchReturnReal also suppresses less severe return type mismatches
                                    return;
                        Severity: Minor
                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs 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 visitMethodCall has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function visitMethodCall(Node $node): Context
                            {
                                $method_name = $node->children['method'];
                        
                                if (!\is_string($method_name)) {
                        Severity: Minor
                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs 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 emitTypeMismatchReturnIssue has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function emitTypeMismatchReturnIssue(UnionType $expression_type, FunctionInterface $method, UnionType $method_return_type, int $lineno, $inner_node): void
                            {
                                if ($this->shouldSuppressIssue(Issue::TypeMismatchReturnReal, $lineno)) {
                                    // Suppressing TypeMismatchReturnReal also suppresses less severe return type mismatches
                                    return;
                        Severity: Major
                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                          Method visitMethodCall has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function visitMethodCall(Node $node): Context
                              {
                                  $method_name = $node->children['method'];
                          
                                  if (!\is_string($method_name)) {
                          Severity: Major
                          Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                            Method visitNew has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function visitNew(Node $node): Context
                                {
                                    $class_list = [];
                                    try {
                                        $context_node = new ContextNode(
                            Severity: Major
                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                              Function visitPrint has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function visitPrint(Node $node): Context
                                  {
                                      $code_base = $this->code_base;
                                      $context = $this->context;
                                      $expr_node = $node->children['expr'];
                              Severity: Minor
                              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs 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 analyzeIncOrDec has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function analyzeIncOrDec(Node $node): Context
                                  {
                                      $var = $node->children['var'];
                                      $old_type = UnionTypeVisitor::unionTypeFromNode($this->code_base, $this->context, $var);
                                      if (!$old_type->canCastToUnionType(UnionType::fromFullyQualifiedPHPDocString('int|string|float'))) {
                              Severity: Minor
                              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                                Function checkNonAncestorConstructCall has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function checkNonAncestorConstructCall(
                                        Node $node,
                                        string $static_class,
                                        string $method_name
                                    ): void {
                                Severity: Minor
                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 analyzeUnsetDim has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function analyzeUnsetDim(Node $node): void
                                    {
                                        $expr_node = $node->children['expr'];
                                        if (!($expr_node instanceof Node)) {
                                            // php -l would warn
                                Severity: Minor
                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 analyzeUnsetDim has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function analyzeUnsetDim(Node $node): void
                                    {
                                        $expr_node = $node->children['expr'];
                                        if (!($expr_node instanceof Node)) {
                                            // php -l would warn
                                Severity: Minor
                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                  Method checkForInfiniteRecursionWithSameArgs has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private function checkForInfiniteRecursionWithSameArgs(Node $node, FunctionInterface $method): void
                                      {
                                          $argument_list_node = $node->children['args'];
                                          $parameter_list = $method->getParameterList();
                                          if (\count($argument_list_node->children) !== \count($parameter_list)) {
                                  Severity: Minor
                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                    Method analyzeReturnStrict has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private function analyzeReturnStrict(
                                            CodeBase $code_base,
                                            FunctionInterface $method,
                                            UnionType $expression_type,
                                            UnionType $method_return_type,
                                    Severity: Minor
                                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                      Method checkUnionTypeCompatibility has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          private function checkUnionTypeCompatibility(?Node $type): void
                                          {
                                              if (!$type) {
                                                  return;
                                              }
                                      Severity: Minor
                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                        Method compareYieldAgainstDeclaredType has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            private function compareYieldAgainstDeclaredType(Node $node, FunctionInterface $method, Context $context, array $template_type_list): Context
                                            {
                                                $code_base = $this->code_base;
                                        
                                                $type_list_count = \count($template_type_list);
                                        Severity: Minor
                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                          Method createPassByReferenceArgumentInCall has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              private function createPassByReferenceArgumentInCall(FunctionInterface $method, Node $argument, Parameter $parameter, ?Parameter $real_parameter): void
                                              {
                                                  if ($argument->kind === ast\AST_VAR) {
                                                      // We don't do anything with the new variable; just create it
                                                      // if it doesn't exist
                                          Severity: Minor
                                          Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                            Method getReturnTypesOfConditional has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                private function getReturnTypesOfConditional(Context $context, Node $node): \Generator
                                                {
                                                    $cond_node = $node->children['cond'];
                                                    $cond_truthiness = UnionTypeVisitor::checkCondUnconditionalTruthiness($cond_node);
                                                    // For the shorthand $a ?: $b, the cond node will be the truthy value.
                                            Severity: Minor
                                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                              Method checkNonAncestorConstructCall has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  private function checkNonAncestorConstructCall(
                                                      Node $node,
                                                      string $static_class,
                                                      string $method_name
                                                  ): void {
                                              Severity: Minor
                                              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                Method analyzeUnsetProp has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    private function analyzeUnsetProp(Node $node): Context
                                                    {
                                                        $expr_node = $node->children['expr'];
                                                        $context = $this->context;
                                                        if (!($expr_node instanceof Node)) {
                                                Severity: Minor
                                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                  Method getReturnTypes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      private function getReturnTypes(Context $context, $node, int $return_lineno): \Generator
                                                      {
                                                          if (!($node instanceof Node)) {
                                                              if (null === $node) {
                                                                  yield $return_lineno => [VoidType::instance(false)->asRealUnionType(), null];
                                                  Severity: Minor
                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                    Method checkForInvalidNewType has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        private function checkForInvalidNewType(Node $node, array $class_list): void
                                                        {
                                                            // This is either a string (new 'something'()) or a class name (new something())
                                                            $class_node = $node->children['class'];
                                                            if (!$class_node instanceof Node) {
                                                    Severity: Minor
                                                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                      Method visitAssign has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          public function visitAssign(Node $node): Context
                                                          {
                                                              // Get the type of the right side of the
                                                              // assignment
                                                              $right_type = UnionTypeVisitor::unionTypeFromNode(
                                                      Severity: Minor
                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                        Method checkPassingPropertyByReference has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                            private static function checkPassingPropertyByReference(CodeBase $code_base, Context $context, FunctionInterface $method, Parameter $parameter, Node $argument, Property $property, int $parameter_offset): void
                                                            {
                                                                $parameter_type = $parameter->getNonVariadicUnionType();
                                                                $expr_node = $argument->children['expr'] ?? null;
                                                                if ($expr_node instanceof Node &&
                                                        Severity: Minor
                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                          Method getStaticMethodOrEmitIssue has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                              private function getStaticMethodOrEmitIssue(Node $node, string $method_name): ?Method
                                                              {
                                                                  try {
                                                                      // Get a reference to the method being called
                                                                      $result = (new ContextNode(
                                                          Severity: Minor
                                                          Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                            Function getStaticMethodOrEmitIssue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                private function getStaticMethodOrEmitIssue(Node $node, string $method_name): ?Method
                                                                {
                                                                    try {
                                                                        // Get a reference to the method being called
                                                                        $result = (new ContextNode(
                                                            Severity: Minor
                                                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 visitPrint has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                                            Open

                                                                public function visitPrint(Node $node): Context
                                                                {
                                                                    $code_base = $this->code_base;
                                                                    $context = $this->context;
                                                                    $expr_node = $node->children['expr'];
                                                            Severity: Minor
                                                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                              Method visitBinaryOp has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                  public function visitBinaryOp(Node $node): Context
                                                                  {
                                                                      $flags = $node->flags;
                                                                      if ($this->isInNoOpPosition($node)) {
                                                                          if (\in_array($flags, [flags\BINARY_BOOL_AND, flags\BINARY_BOOL_OR, flags\BINARY_COALESCE], true)) {
                                                              Severity: Minor
                                                              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                Method getReturnTypesOfArray has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                    private function getReturnTypesOfArray(Context $context, Node $node): \Generator
                                                                    {
                                                                        if (\count($node->children) === 0) {
                                                                            // Possibly unreachable (array shape would be returned instead)
                                                                            yield $node->lineno => [MixedType::instance(false)->asPHPDocUnionType(), $node];
                                                                Severity: Minor
                                                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                  Method compareYieldFromAgainstDeclaredType has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                  Open

                                                                      private function compareYieldFromAgainstDeclaredType(Node $node, FunctionInterface $method, Context $context, array $template_type_list, UnionType $yield_from_type): Context
                                                                      {
                                                                          $code_base = $this->code_base;
                                                                  
                                                                          $type_list_count = \count($template_type_list);
                                                                  Severity: Minor
                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                    Method visitYieldFrom has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                        public function visitYieldFrom(Node $node): Context
                                                                        {
                                                                            $context = $this->context;
                                                                            // Make sure we're actually returning from a method.
                                                                            if (!$context->isInFunctionLikeScope()) {
                                                                    Severity: Minor
                                                                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                      Function visitBinaryOp has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          public function visitBinaryOp(Node $node): Context
                                                                          {
                                                                              $flags = $node->flags;
                                                                              if ($this->isInNoOpPosition($node)) {
                                                                                  if (\in_array($flags, [flags\BINARY_BOOL_AND, flags\BINARY_BOOL_OR, flags\BINARY_COALESCE], true)) {
                                                                      Severity: Minor
                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 isAssignmentOrNestedAssignmentOrModification has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          private function isAssignmentOrNestedAssignmentOrModification(Node $node): ?bool
                                                                          {
                                                                              $parent_node_list = $this->parent_node_list;
                                                                              $parent_node = \end($parent_node_list);
                                                                              if (!$parent_node instanceof Node) {
                                                                      Severity: Minor
                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 checkExpressionInDynamicString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                      Open

                                                                          private function checkExpressionInDynamicString(Node $expr_node): void
                                                                          {
                                                                              $code_base = $this->code_base;
                                                                              $context = $this->context;
                                                                              $type = UnionTypeVisitor::unionTypeFromNode(
                                                                      Severity: Minor
                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                        Method visitMethod has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                        Open

                                                                            public function visitMethod(Node $node): Context
                                                                            {
                                                                                if (!$this->context->isInFunctionLikeScope()) {
                                                                                    throw new AssertionError("Must be in function-like scope to get method");
                                                                                }
                                                                        Severity: Minor
                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                          Consider simplifying this complex logical expression.
                                                                          Open

                                                                                  if (!$method->isAbstract()
                                                                                      && !$method->isFromPHPDoc()
                                                                                      && !$has_interface_class
                                                                                      && !$return_type->isEmpty()
                                                                                      && !$method->hasReturn()
                                                                          Severity: Critical
                                                                          Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                            Method warnNoopNew has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                            Open

                                                                                private function warnNoopNew(
                                                                                    Node $node,
                                                                                    array $class_list
                                                                                ): void {
                                                                                    $has_constructor_or_destructor = \count($class_list) === 0;
                                                                            Severity: Minor
                                                                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                              Method analyzeMethodVisibility has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                              Open

                                                                                  private function analyzeMethodVisibility(
                                                                                      Method $method,
                                                                                      Node $node
                                                                                  ): void {
                                                                                      if ($method->isPublic()) {
                                                                              Severity: Minor
                                                                              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                Method checkDeprecatedUnparenthesizedConditional has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                Open

                                                                                    private function checkDeprecatedUnparenthesizedConditional(Node $node, Node $cond): void
                                                                                    {
                                                                                        if ($cond->flags & flags\PARENTHESIZED_CONDITIONAL) {
                                                                                            // The condition is unambiguously parenthesized.
                                                                                            return;
                                                                                Severity: Minor
                                                                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                  Function visitUnaryOp has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                                  Open

                                                                                      public function visitUnaryOp(Node $node): Context
                                                                                      {
                                                                                          if ($node->flags === flags\UNARY_SILENCE) {
                                                                                              $expr = $node->children['expr'];
                                                                                              if ($expr instanceof Node) {
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 checkUnionTypeCompatibility has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                                  Open

                                                                                      private function checkUnionTypeCompatibility(?Node $type): void
                                                                                      {
                                                                                          if (!$type) {
                                                                                              return;
                                                                                          }
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 checkExpressionInDynamicString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                                  Open

                                                                                      private function checkExpressionInDynamicString(Node $expr_node): void
                                                                                      {
                                                                                          $code_base = $this->code_base;
                                                                                          $context = $this->context;
                                                                                          $type = UnionTypeVisitor::unionTypeFromNode(
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 isAssignmentOrNestedAssignment has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                                  Open

                                                                                      private function isAssignmentOrNestedAssignment(Node $node): ?bool
                                                                                      {
                                                                                          $parent_node_list = $this->parent_node_list;
                                                                                          $parent_node = \end($parent_node_list);
                                                                                          if (!$parent_node instanceof Node) {
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 checkDeprecatedUnparenthesizedConditional has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                                  Open

                                                                                      private function checkDeprecatedUnparenthesizedConditional(Node $node, Node $cond): void
                                                                                      {
                                                                                          if ($cond->flags & flags\PARENTHESIZED_CONDITIONAL) {
                                                                                              // The condition is unambiguously parenthesized.
                                                                                              return;
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 getReturnTypesOfArray has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                                  Open

                                                                                      private function getReturnTypesOfArray(Context $context, Node $node): \Generator
                                                                                      {
                                                                                          if (\count($node->children) === 0) {
                                                                                              // Possibly unreachable (array shape would be returned instead)
                                                                                              yield $node->lineno => [MixedType::instance(false)->asPHPDocUnionType(), $node];
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 visitNew has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                                  Open

                                                                                      public function visitNew(Node $node): Context
                                                                                      {
                                                                                          $class_list = [];
                                                                                          try {
                                                                                              $context_node = new ContextNode(
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 visitContinue has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                  Open

                                                                                      public function visitContinue(Node $node): Context
                                                                                      {
                                                                                          $nodes = $this->parent_node_list;
                                                                                          $depth = $node->children['depth'] ?? 1;
                                                                                          if (!\is_int($depth)) {
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                    Method visitDim has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                    Open

                                                                                        public function visitDim(Node $node): Context
                                                                                        {
                                                                                            $code_base = $this->code_base;
                                                                                            $context = $this->context;
                                                                                            // Check the dimension type to trigger PhanUndeclaredVariable, etc.
                                                                                    Severity: Minor
                                                                                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                      The class PostOrderAnalysisVisitor has 63 public methods and attributes. Consider reducing the number of public items to less than 45.
                                                                                      Open

                                                                                      class PostOrderAnalysisVisitor extends AnalysisVisitor
                                                                                      {
                                                                                          /**
                                                                                           * @var list<Node> a list of parent nodes of the currently analyzed node,
                                                                                           * within the current global or function-like scope

                                                                                      ExcessivePublicCount

                                                                                      Since: 0.1

                                                                                      A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

                                                                                      Example

                                                                                      public class Foo {
                                                                                          public $value;
                                                                                          public $something;
                                                                                          public $var;
                                                                                          // [... more more public attributes ...]
                                                                                      
                                                                                          public function doWork() {}
                                                                                          public function doMoreWork() {}
                                                                                          public function doWorkAgain() {}
                                                                                          // [... more more public methods ...]
                                                                                      }

                                                                                      Source https://phpmd.org/rules/codesize.html#excessivepubliccount

                                                                                      Method analyzeBinaryBitwiseOp has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                      Open

                                                                                          private function analyzeBinaryBitwiseOp(Node $node): void
                                                                                          {
                                                                                              $left = UnionTypeVisitor::unionTypeFromNode(
                                                                                                  $this->code_base,
                                                                                                  $this->context,
                                                                                      Severity: Minor
                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                        Method analyzeBinaryShift has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                        Open

                                                                                            private function analyzeBinaryShift(Node $node): void
                                                                                            {
                                                                                                $left = UnionTypeVisitor::unionTypeFromNode(
                                                                                                    $this->code_base,
                                                                                                    $this->context,
                                                                                        Severity: Minor
                                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                          Method analyzeBinaryNumericOp has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                          Open

                                                                                              private function analyzeBinaryNumericOp(Node $node): void
                                                                                              {
                                                                                                  $left = UnionTypeVisitor::unionTypeFromNode(
                                                                                                      $this->code_base,
                                                                                                      $this->context,
                                                                                          Severity: Minor
                                                                                          Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                            Function compareYieldAgainstDeclaredType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                                                            Open

                                                                                                private function compareYieldAgainstDeclaredType(Node $node, FunctionInterface $method, Context $context, array $template_type_list): Context
                                                                                                {
                                                                                                    $code_base = $this->code_base;
                                                                                            
                                                                                                    $type_list_count = \count($template_type_list);
                                                                                            Severity: Minor
                                                                                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr 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 isAssignmentOrNestedAssignmentOrModification has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                            Open

                                                                                                private function isAssignmentOrNestedAssignmentOrModification(Node $node): ?bool
                                                                                                {
                                                                                                    $parent_node_list = $this->parent_node_list;
                                                                                                    $parent_node = \end($parent_node_list);
                                                                                                    if (!$parent_node instanceof Node) {
                                                                                            Severity: Minor
                                                                                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                              Method visitUnaryOp has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                              Open

                                                                                                  public function visitUnaryOp(Node $node): Context
                                                                                                  {
                                                                                                      if ($node->flags === flags\UNARY_SILENCE) {
                                                                                                          $expr = $node->children['expr'];
                                                                                                          if ($expr instanceof Node) {
                                                                                              Severity: Minor
                                                                                              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                                Method isAssignmentOrNestedAssignment has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                Open

                                                                                                    private function isAssignmentOrNestedAssignment(Node $node): ?bool
                                                                                                    {
                                                                                                        $parent_node_list = $this->parent_node_list;
                                                                                                        $parent_node = \end($parent_node_list);
                                                                                                        if (!$parent_node instanceof Node) {
                                                                                                Severity: Minor
                                                                                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                                  Method checkForInfiniteRecursion has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      private function checkForInfiniteRecursion(Node $node, FunctionInterface $method): void
                                                                                                      {
                                                                                                          $argument_list_node = $node->children['args'];
                                                                                                          $kind = $node->kind;
                                                                                                          if ($kind === ast\AST_METHOD_CALL || $kind === ast\AST_NULLSAFE_METHOD_CALL) {
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                                    Method visitInstanceof has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                        public function visitInstanceof(Node $node): Context
                                                                                                        {
                                                                                                            try {
                                                                                                                // Fetch the class list, and emit warnings as a side effect.
                                                                                                                // TODO: Unify UnionTypeVisitor, AssignmentVisitor, and PostOrderAnalysisVisitor
                                                                                                    Severity: Minor
                                                                                                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                                      Method analyzePassByReferenceArgument has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                              CodeBase $code_base,
                                                                                                              Context $context,
                                                                                                              Node $argument,
                                                                                                              array $argument_list,
                                                                                                              FunctionInterface $method,
                                                                                                      Severity: Major
                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                                                                                        Function shouldSkipNestedAssignDim has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                            private static function shouldSkipNestedAssignDim(array $parent_node_list): bool
                                                                                                            {
                                                                                                                $cur_parent_node = \end($parent_node_list);
                                                                                                                for (;; $cur_parent_node = $prev_parent_node) {
                                                                                                                    $prev_parent_node = \prev($parent_node_list);
                                                                                                        Severity: Minor
                                                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 55 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 visitContinue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                            public function visitContinue(Node $node): Context
                                                                                                            {
                                                                                                                $nodes = $this->parent_node_list;
                                                                                                                $depth = $node->children['depth'] ?? 1;
                                                                                                                if (!\is_int($depth)) {
                                                                                                        Severity: Minor
                                                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 55 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 visitClassConstDecl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                            public function visitClassConstDecl(Node $node): Context
                                                                                                            {
                                                                                                                $class = $this->context->getClassInScope($this->code_base);
                                                                                                        
                                                                                                                foreach ($node->children as $child_node) {
                                                                                                        Severity: Minor
                                                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 55 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 getReturnTypes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                            private function getReturnTypes(Context $context, $node, int $return_lineno): \Generator
                                                                                                            {
                                                                                                                if (!($node instanceof Node)) {
                                                                                                                    if (null === $node) {
                                                                                                                        yield $return_lineno => [VoidType::instance(false)->asRealUnionType(), null];
                                                                                                        Severity: Minor
                                                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 55 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 checkForInfiniteRecursion has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                            private function checkForInfiniteRecursion(Node $node, FunctionInterface $method): void
                                                                                                            {
                                                                                                                $argument_list_node = $node->children['args'];
                                                                                                                $kind = $node->kind;
                                                                                                                if ($kind === ast\AST_METHOD_CALL || $kind === ast\AST_NULLSAFE_METHOD_CALL) {
                                                                                                        Severity: Minor
                                                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 55 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 visitConstDecl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                            public function visitConstDecl(Node $node): Context
                                                                                                            {
                                                                                                                foreach ($node->children as $child_node) {
                                                                                                                    if (!$child_node instanceof Node) {
                                                                                                                        throw new AssertionError('expected const element to be a Node');
                                                                                                        Severity: Minor
                                                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 55 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 checkPassingPropertyByReference has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                            private static function checkPassingPropertyByReference(CodeBase $code_base, Context $context, FunctionInterface $method, Parameter $parameter, Node $argument, Property $property, int $parameter_offset): void
                                                                                                        Severity: Major
                                                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 50 mins to fix

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

                                                                                                                  CodeBase $code_base,
                                                                                                                  FunctionInterface $method,
                                                                                                                  UnionType $expression_type,
                                                                                                                  UnionType $method_return_type,
                                                                                                                  int $lineno,
                                                                                                          Severity: Minor
                                                                                                          Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 45 mins to fix

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

                                                                                                                    Node $node,
                                                                                                                    Closure $is_valid_type,
                                                                                                                    UnionType $left,
                                                                                                                    UnionType $right,
                                                                                                                    string $left_issue_type,
                                                                                                            Severity: Minor
                                                                                                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 45 mins to fix

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

                                                                                                                      CodeBase $code_base,
                                                                                                                      Context $context,
                                                                                                                      FunctionInterface $method,
                                                                                                                      Closure $set_variable_type,
                                                                                                                      array $argument_list,
                                                                                                              Severity: Minor
                                                                                                              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 45 mins to fix

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

                                                                                                                        FunctionInterface $method,
                                                                                                                        Parameter $parameter,
                                                                                                                        $argument,
                                                                                                                        array $argument_types,
                                                                                                                        array &$parameter_list,
                                                                                                                Severity: Minor
                                                                                                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 45 mins to fix

                                                                                                                  Method emitTypeMismatchReturnIssue has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                  Open

                                                                                                                      private function emitTypeMismatchReturnIssue(UnionType $expression_type, FunctionInterface $method, UnionType $method_return_type, int $lineno, $inner_node): void
                                                                                                                  Severity: Minor
                                                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 35 mins to fix

                                                                                                                    Method compareYieldFromAgainstDeclaredType has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                    Open

                                                                                                                        private function compareYieldFromAgainstDeclaredType(Node $node, FunctionInterface $method, Context $context, array $template_type_list, UnionType $yield_from_type): Context
                                                                                                                    Severity: Minor
                                                                                                                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 35 mins to fix

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

                                                                                                                          public function visitBreak(Node $node): Context
                                                                                                                          {
                                                                                                                              $depth = $node->children['depth'] ?? 1;
                                                                                                                              if (!\is_int($depth)) {
                                                                                                                                  return $this->context;
                                                                                                                      Severity: Minor
                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.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 analyzeMethodVisibility has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                                                      Open

                                                                                                                          private function analyzeMethodVisibility(
                                                                                                                              Method $method,
                                                                                                                              Node $node
                                                                                                                          ): void {
                                                                                                                              if ($method->isPublic()) {
                                                                                                                      Severity: Minor
                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.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 deduplicateUnionTypes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                                                      Open

                                                                                                                          private static function deduplicateUnionTypes($types): \Generator
                                                                                                                          {
                                                                                                                              $unique_types = [];
                                                                                                                              foreach ($types as $lineno => $details) {
                                                                                                                                  $type = $details[0];
                                                                                                                      Severity: Minor
                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.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 checkCanCastToReturnType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                                                      Open

                                                                                                                          private function checkCanCastToReturnType(UnionType $expression_type, UnionType $method_return_type): bool
                                                                                                                          {
                                                                                                                              if ($expression_type->hasRealTypeSet() && $method_return_type->hasRealTypeSet()) {
                                                                                                                                  $real_expression_type = $expression_type->getRealUnionType();
                                                                                                                                  $real_method_return_type = $method_return_type->getRealUnionType();
                                                                                                                      Severity: Minor
                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.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 analyzeReturnInGenerator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                                                      Open

                                                                                                                          private function analyzeReturnInGenerator(
                                                                                                                              FunctionInterface $method,
                                                                                                                              Node $node
                                                                                                                          ): void {
                                                                                                                              $method_generator_type = $method->getReturnTypeAsGeneratorTemplateType();
                                                                                                                      Severity: Minor
                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.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 checkPassingPropertyByReference has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                                                      Open

                                                                                                                          private static function checkPassingPropertyByReference(CodeBase $code_base, Context $context, FunctionInterface $method, Parameter $parameter, Node $argument, Property $property, int $parameter_offset): void
                                                                                                                          {
                                                                                                                              $parameter_type = $parameter->getNonVariadicUnionType();
                                                                                                                              $expr_node = $argument->children['expr'] ?? null;
                                                                                                                              if ($expr_node instanceof Node &&
                                                                                                                      Severity: Minor
                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.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;
                                                                                                                      Severity: Major
                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

                                                                                                                                return $context;
                                                                                                                        Severity: Major
                                                                                                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this method.
                                                                                                                          Open

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

                                                                                                                            Avoid too many return statements within this method.
                                                                                                                            Open

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

                                                                                                                              Avoid too many return statements within this method.
                                                                                                                              Open

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

                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                Open

                                                                                                                                        return false;
                                                                                                                                Severity: Major
                                                                                                                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                  Open

                                                                                                                                          return false;
                                                                                                                                  Severity: Major
                                                                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                    Open

                                                                                                                                            return $this->compareYieldFromAgainstDeclaredType($node, $method, $context, $type_list, $yield_from_type);
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                      Open

                                                                                                                                                  return $parent_node->children['var'] === $node;
                                                                                                                                      Severity: Major
                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                        Open

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

                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                          Open

                                                                                                                                                              return $type->isNullableLabeled() ? MixedType::instance(true) : NonNullMixedType::instance(false);
                                                                                                                                          Severity: Major
                                                                                                                                          Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                            Open

                                                                                                                                                            return $type;
                                                                                                                                            Severity: Major
                                                                                                                                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                              Open

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

                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                Open

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

                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                  Open

                                                                                                                                                              return \in_array($parent_kind, self::READ_AND_WRITE_KINDS, true);
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                    Open

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

                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                      Open

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

                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                        Open

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

                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                          Open

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

                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                            Open

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

                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                              Open

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

                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                Open

                                                                                                                                                                            return $parent_node->children['var'] === $node;
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                  Open

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

                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                    Open

                                                                                                                                                                                    return $parent_node !== ($parent_parent_node->children['cond'] ?? null);
                                                                                                                                                                    Severity: Major
                                                                                                                                                                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 30 mins to fix

                                                                                                                                                                      Function warnAboutInvalidUnionType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          private function warnAboutInvalidUnionType(
                                                                                                                                                                              Node $node,
                                                                                                                                                                              Closure $is_valid_type,
                                                                                                                                                                              UnionType $left,
                                                                                                                                                                              UnionType $right,
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 25 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 compareYieldFromAgainstDeclaredType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          private function compareYieldFromAgainstDeclaredType(Node $node, FunctionInterface $method, Context $context, array $template_type_list, UnionType $yield_from_type): Context
                                                                                                                                                                          {
                                                                                                                                                                              $code_base = $this->code_base;
                                                                                                                                                                      
                                                                                                                                                                              $type_list_count = \count($template_type_list);
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 25 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 visitYieldFrom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitYieldFrom(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $context = $this->context;
                                                                                                                                                                              // Make sure we're actually returning from a method.
                                                                                                                                                                              if (!$context->isInFunctionLikeScope()) {
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 25 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 checkForFunctionInterfaceIssues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          private function checkForFunctionInterfaceIssues(Node $node, FunctionInterface $function): void
                                                                                                                                                                          {
                                                                                                                                                                              $parameters_seen = [];
                                                                                                                                                                              foreach ($function->getParameterList() as $i => $parameter) {
                                                                                                                                                                                  if (isset($parameters_seen[$parameter->getName()])) {
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 25 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 checkForPHP4StyleConstructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          private function checkForPHP4StyleConstructor(Clazz $class, Method $method): void
                                                                                                                                                                          {
                                                                                                                                                                              if ($class->isClass()
                                                                                                                                                                                  && ($class->getElementNamespace() ?: "\\") === "\\"
                                                                                                                                                                                  && \strcasecmp($class->getName(), $method->getName()) === 0
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 25 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 findDefiningMethod has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          private function findDefiningMethod(FunctionInterface $method): FunctionInterface
                                                                                                                                                                          {
                                                                                                                                                                              if ($method instanceof Method) {
                                                                                                                                                                                  $defining_fqsen = $method->getDefiningFQSEN();
                                                                                                                                                                                  if ($method->getFQSEN() !== $defining_fqsen) {
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 25 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 visitMethod has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitMethod(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              if (!$this->context->isInFunctionLikeScope()) {
                                                                                                                                                                                  throw new AssertionError("Must be in function-like scope to get method");
                                                                                                                                                                              }
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 25 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 visitUnset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitUnset(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $context = $this->context;
                                                                                                                                                                              // Get the type of the thing being unset
                                                                                                                                                                              $var_node = $node->children['var'];
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 25 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 visitClone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitClone(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $type = UnionTypeVisitor::unionTypeFromNode(
                                                                                                                                                                                  $this->code_base,
                                                                                                                                                                                  $this->context,
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 25 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

                                                                                                                                                                      The method updateParameterTypeByArgument() has an NPath complexity of 6240. The configured NPath complexity threshold is 200.
                                                                                                                                                                      Open

                                                                                                                                                                          private function updateParameterTypeByArgument(
                                                                                                                                                                              FunctionInterface $method,
                                                                                                                                                                              Parameter $parameter,
                                                                                                                                                                              $argument,
                                                                                                                                                                              array $argument_types,

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

                                                                                                                                                                          public function visitArgList(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $argument_name_set = [];
                                                                                                                                                                              $has_unpack = false;
                                                                                                                                                                      
                                                                                                                                                                      

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

                                                                                                                                                                          public function visitReturn(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $context = $this->context;
                                                                                                                                                                              // Make sure we're actually returning from a method.
                                                                                                                                                                              if (!$context->isInFunctionLikeScope()) {

                                                                                                                                                                      The method checkUnionTypeCompatibility() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
                                                                                                                                                                      Open

                                                                                                                                                                          private function checkUnionTypeCompatibility(?Node $type): void
                                                                                                                                                                          {
                                                                                                                                                                              if (!$type) {
                                                                                                                                                                                  return;
                                                                                                                                                                              }

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

                                                                                                                                                                          private static function analyzePassByReferenceArgument(
                                                                                                                                                                              CodeBase $code_base,
                                                                                                                                                                              Context $context,
                                                                                                                                                                              Node $argument,
                                                                                                                                                                              array $argument_list,

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

                                                                                                                                                                          public function visitStaticCall(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              // Get the name of the method being called
                                                                                                                                                                              $method_name = $node->children['method'];
                                                                                                                                                                      
                                                                                                                                                                      

                                                                                                                                                                      The method analyzePassByReferenceArgument() has an NPath complexity of 348. The configured NPath complexity threshold is 200.
                                                                                                                                                                      Open

                                                                                                                                                                          private static function analyzePassByReferenceArgument(
                                                                                                                                                                              CodeBase $code_base,
                                                                                                                                                                              Context $context,
                                                                                                                                                                              Node $argument,
                                                                                                                                                                              array $argument_list,

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

                                                                                                                                                                          private function checkForInfiniteRecursionWithSameArgs(Node $node, FunctionInterface $method): void
                                                                                                                                                                          {
                                                                                                                                                                              $argument_list_node = $node->children['args'];
                                                                                                                                                                              $parameter_list = $method->getParameterList();
                                                                                                                                                                              if (\count($argument_list_node->children) !== \count($parameter_list)) {

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

                                                                                                                                                                          private function analyzeCallToFunctionLike(
                                                                                                                                                                              FunctionInterface $method,
                                                                                                                                                                              Node $node
                                                                                                                                                                          ): void {
                                                                                                                                                                              $code_base = $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 method visitReturn() has an NPath complexity of 23424. The configured NPath complexity threshold is 200.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitReturn(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $context = $this->context;
                                                                                                                                                                              // Make sure we're actually returning from a method.
                                                                                                                                                                              if (!$context->isInFunctionLikeScope()) {

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

                                                                                                                                                                          public function analyzeCallableWithArgumentTypes(
                                                                                                                                                                              array $argument_types,
                                                                                                                                                                              FunctionInterface $method,
                                                                                                                                                                              array $arguments = [],
                                                                                                                                                                              bool $erase_old_return_type = false

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

                                                                                                                                                                          private function analyzeUnsetProp(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $expr_node = $node->children['expr'];
                                                                                                                                                                              $context = $this->context;
                                                                                                                                                                              if (!($expr_node instanceof 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 analyzeUnsetDim() has an NPath complexity of 1154. The configured NPath complexity threshold is 200.
                                                                                                                                                                      Open

                                                                                                                                                                          private function analyzeUnsetDim(Node $node): void
                                                                                                                                                                          {
                                                                                                                                                                              $expr_node = $node->children['expr'];
                                                                                                                                                                              if (!($expr_node instanceof Node)) {
                                                                                                                                                                                  // php -l would warn

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

                                                                                                                                                                          private function warnNoopNew(
                                                                                                                                                                              Node $node,
                                                                                                                                                                              array $class_list
                                                                                                                                                                          ): void {
                                                                                                                                                                              $has_constructor_or_destructor = \count($class_list) === 0;

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

                                                                                                                                                                      class PostOrderAnalysisVisitor extends AnalysisVisitor
                                                                                                                                                                      {
                                                                                                                                                                          /**
                                                                                                                                                                           * @var list<Node> a list of parent nodes of the currently analyzed node,
                                                                                                                                                                           * within the current global or function-like scope

                                                                                                                                                                      The method visitStaticCall() has an NPath complexity of 1092. The configured NPath complexity threshold is 200.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitStaticCall(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              // Get the name of the method being called
                                                                                                                                                                              $method_name = $node->children['method'];
                                                                                                                                                                      
                                                                                                                                                                      

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

                                                                                                                                                                          public function visitMethod(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              if (!$this->context->isInFunctionLikeScope()) {
                                                                                                                                                                                  throw new AssertionError("Must be in function-like scope to get method");
                                                                                                                                                                              }

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

                                                                                                                                                                          private function updateParameterTypeByArgument(
                                                                                                                                                                              FunctionInterface $method,
                                                                                                                                                                              Parameter $parameter,
                                                                                                                                                                              $argument,
                                                                                                                                                                              array $argument_types,

                                                                                                                                                                      The method analyzeCallableWithArgumentTypes() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function analyzeCallableWithArgumentTypes(
                                                                                                                                                                              array $argument_types,
                                                                                                                                                                              FunctionInterface $method,
                                                                                                                                                                              array $arguments = [],
                                                                                                                                                                              bool $erase_old_return_type = false

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method analyzeUnsetProp() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function analyzeUnsetProp(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $expr_node = $node->children['expr'];
                                                                                                                                                                              $context = $this->context;
                                                                                                                                                                              if (!($expr_node instanceof Node)) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method checkForInfiniteRecursion() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function checkForInfiniteRecursion(Node $node, FunctionInterface $method): void
                                                                                                                                                                          {
                                                                                                                                                                              $argument_list_node = $node->children['args'];
                                                                                                                                                                              $kind = $node->kind;
                                                                                                                                                                              if ($kind === ast\AST_METHOD_CALL || $kind === ast\AST_NULLSAFE_METHOD_CALL) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method emitTypeMismatchReturnIssue() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function emitTypeMismatchReturnIssue(UnionType $expression_type, FunctionInterface $method, UnionType $method_return_type, int $lineno, $inner_node): void
                                                                                                                                                                          {
                                                                                                                                                                              if ($this->shouldSuppressIssue(Issue::TypeMismatchReturnReal, $lineno)) {
                                                                                                                                                                                  // Suppressing TypeMismatchReturnReal also suppresses less severe return type mismatches
                                                                                                                                                                                  return;

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method visitMethod() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitMethod(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              if (!$this->context->isInFunctionLikeScope()) {
                                                                                                                                                                                  throw new AssertionError("Must be in function-like scope to get method");
                                                                                                                                                                              }

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method visitBinaryOp() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitBinaryOp(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $flags = $node->flags;
                                                                                                                                                                              if ($this->isInNoOpPosition($node)) {
                                                                                                                                                                                  if (\in_array($flags, [flags\BINARY_BOOL_AND, flags\BINARY_BOOL_OR, flags\BINARY_COALESCE], true)) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method visitMethodCall() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitMethodCall(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $method_name = $node->children['method'];
                                                                                                                                                                      
                                                                                                                                                                              if (!\is_string($method_name)) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method analyzeProp() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function analyzeProp(Node $node, bool $is_static): Context
                                                                                                                                                                          {
                                                                                                                                                                              $exception_or_null = null;
                                                                                                                                                                      
                                                                                                                                                                              try {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method createPassByReferenceArgumentInCall() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function createPassByReferenceArgumentInCall(FunctionInterface $method, Node $argument, Parameter $parameter, ?Parameter $real_parameter): void
                                                                                                                                                                          {
                                                                                                                                                                              if ($argument->kind === ast\AST_VAR) {
                                                                                                                                                                                  // We don't do anything with the new variable; just create it
                                                                                                                                                                                  // if it doesn't exist

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method visitContinue() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitContinue(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $nodes = $this->parent_node_list;
                                                                                                                                                                              $depth = $node->children['depth'] ?? 1;
                                                                                                                                                                              if (!\is_int($depth)) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method analyzeCallToFunctionLike() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function analyzeCallToFunctionLike(
                                                                                                                                                                              FunctionInterface $method,
                                                                                                                                                                              Node $node
                                                                                                                                                                          ): void {
                                                                                                                                                                              $code_base = $this->code_base;

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method visitReturn() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitReturn(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $context = $this->context;
                                                                                                                                                                              // Make sure we're actually returning from a method.
                                                                                                                                                                              if (!$context->isInFunctionLikeScope()) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method visitStaticCall() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitStaticCall(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              // Get the name of the method being called
                                                                                                                                                                              $method_name = $node->children['method'];
                                                                                                                                                                      
                                                                                                                                                                      

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method analyzeMethodWithArgumentTypes() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function analyzeMethodWithArgumentTypes(
                                                                                                                                                                              Node $argument_list_node,
                                                                                                                                                                              FunctionInterface $method
                                                                                                                                                                          ): void {
                                                                                                                                                                              $method = $this->findDefiningMethod($method);

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method isAssignmentOrNestedAssignment() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function isAssignmentOrNestedAssignment(Node $node): ?bool
                                                                                                                                                                          {
                                                                                                                                                                              $parent_node_list = $this->parent_node_list;
                                                                                                                                                                              $parent_node = \end($parent_node_list);
                                                                                                                                                                              if (!$parent_node instanceof Node) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method updateParameterTypeByArgument() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function updateParameterTypeByArgument(
                                                                                                                                                                              FunctionInterface $method,
                                                                                                                                                                              Parameter $parameter,
                                                                                                                                                                              $argument,
                                                                                                                                                                              array $argument_types,

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method visitNew() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitNew(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $class_list = [];
                                                                                                                                                                              try {
                                                                                                                                                                                  $context_node = new ContextNode(

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method checkNonAncestorConstructCall() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function checkNonAncestorConstructCall(
                                                                                                                                                                              Node $node,
                                                                                                                                                                              string $static_class,
                                                                                                                                                                              string $method_name
                                                                                                                                                                          ): void {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method getStaticMethodOrEmitIssue() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function getStaticMethodOrEmitIssue(Node $node, string $method_name): ?Method
                                                                                                                                                                          {
                                                                                                                                                                              try {
                                                                                                                                                                                  // Get a reference to the method being called
                                                                                                                                                                                  $result = (new ContextNode(

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method checkUnionTypeCompatibility() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function checkUnionTypeCompatibility(?Node $type): void
                                                                                                                                                                          {
                                                                                                                                                                              if (!$type) {
                                                                                                                                                                                  return;
                                                                                                                                                                              }

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method checkForInfiniteRecursionWithSameArgs() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function checkForInfiniteRecursionWithSameArgs(Node $node, FunctionInterface $method): void
                                                                                                                                                                          {
                                                                                                                                                                              $argument_list_node = $node->children['args'];
                                                                                                                                                                              $parameter_list = $method->getParameterList();
                                                                                                                                                                              if (\count($argument_list_node->children) !== \count($parameter_list)) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method analyzeUnsetDim() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function analyzeUnsetDim(Node $node): void
                                                                                                                                                                          {
                                                                                                                                                                              $expr_node = $node->children['expr'];
                                                                                                                                                                              if (!($expr_node instanceof Node)) {
                                                                                                                                                                                  // php -l would warn

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method analyzePassByReferenceArgument() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private static function analyzePassByReferenceArgument(
                                                                                                                                                                              CodeBase $code_base,
                                                                                                                                                                              Context $context,
                                                                                                                                                                              Node $argument,
                                                                                                                                                                              array $argument_list,

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method analyzeReturnStrict() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function analyzeReturnStrict(
                                                                                                                                                                              CodeBase $code_base,
                                                                                                                                                                              FunctionInterface $method,
                                                                                                                                                                              UnionType $expression_type,
                                                                                                                                                                              UnionType $method_return_type,

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method analyzeIncOrDec() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function analyzeIncOrDec(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $var = $node->children['var'];
                                                                                                                                                                              $old_type = UnionTypeVisitor::unionTypeFromNode($this->code_base, $this->context, $var);
                                                                                                                                                                              if (!$old_type->canCastToUnionType(UnionType::fromFullyQualifiedPHPDocString('int|string|float'))) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method isAssignmentOrNestedAssignmentOrModification() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function isAssignmentOrNestedAssignmentOrModification(Node $node): ?bool
                                                                                                                                                                          {
                                                                                                                                                                              $parent_node_list = $this->parent_node_list;
                                                                                                                                                                              $parent_node = \end($parent_node_list);
                                                                                                                                                                              if (!$parent_node instanceof Node) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method visitArgList() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          public function visitArgList(Node $node): Context
                                                                                                                                                                          {
                                                                                                                                                                              $argument_name_set = [];
                                                                                                                                                                              $has_unpack = false;
                                                                                                                                                                      
                                                                                                                                                                      

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method checkForInvalidNewType() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function checkForInvalidNewType(Node $node, array $class_list): void
                                                                                                                                                                          {
                                                                                                                                                                              // This is either a string (new 'something'()) or a class name (new something())
                                                                                                                                                                              $class_node = $node->children['class'];
                                                                                                                                                                              if (!$class_node instanceof Node) {

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The method warnNoopNew() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                      Open

                                                                                                                                                                          private function warnNoopNew(
                                                                                                                                                                              Node $node,
                                                                                                                                                                              array $class_list
                                                                                                                                                                          ): void {
                                                                                                                                                                              $has_constructor_or_destructor = \count($class_list) === 0;

                                                                                                                                                                      CyclomaticComplexity

                                                                                                                                                                      Since: 0.1

                                                                                                                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                                                                                                                      Example

                                                                                                                                                                      // Cyclomatic Complexity = 11
                                                                                                                                                                      class Foo {
                                                                                                                                                                      1   public function example() {
                                                                                                                                                                      2       if ($a == $b) {
                                                                                                                                                                      3           if ($a1 == $b1) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                      4           } elseif ($a2 == $b2) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  } else {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      5       } elseif ($c == $d) {
                                                                                                                                                                      6           while ($c == $d) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                      7        } elseif ($e == $f) {
                                                                                                                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                                                                                                                      fiddle();
                                                                                                                                                                                  }
                                                                                                                                                                              } else {
                                                                                                                                                                                  switch ($z) {
                                                                                                                                                                      9               case 1:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      10              case 2:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                      11              case 3:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                      default:
                                                                                                                                                                                          fiddle();
                                                                                                                                                                                          break;
                                                                                                                                                                                  }
                                                                                                                                                                              }
                                                                                                                                                                          }
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                                                                                                                      The class PostOrderAnalysisVisitor has a coupling between objects value of 60. Consider to reduce the number of dependencies under 13.
                                                                                                                                                                      Open

                                                                                                                                                                      class PostOrderAnalysisVisitor extends AnalysisVisitor
                                                                                                                                                                      {
                                                                                                                                                                          /**
                                                                                                                                                                           * @var list<Node> a list of parent nodes of the currently analyzed node,
                                                                                                                                                                           * within the current global or function-like scope

                                                                                                                                                                      CouplingBetweenObjects

                                                                                                                                                                      Since: 1.1.0

                                                                                                                                                                      A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                                                                                                                                                                      Example

                                                                                                                                                                      class Foo {
                                                                                                                                                                          /**
                                                                                                                                                                           * @var \foo\bar\X
                                                                                                                                                                           */
                                                                                                                                                                          private $x = null;
                                                                                                                                                                      
                                                                                                                                                                          /**
                                                                                                                                                                           * @var \foo\bar\Y
                                                                                                                                                                           */
                                                                                                                                                                          private $y = null;
                                                                                                                                                                      
                                                                                                                                                                          /**
                                                                                                                                                                           * @var \foo\bar\Z
                                                                                                                                                                           */
                                                                                                                                                                          private $z = null;
                                                                                                                                                                      
                                                                                                                                                                          public function setFoo(\Foo $foo) {}
                                                                                                                                                                          public function setBar(\Bar $bar) {}
                                                                                                                                                                          public function setBaz(\Baz $baz) {}
                                                                                                                                                                      
                                                                                                                                                                          /**
                                                                                                                                                                           * @return \SplObjectStorage
                                                                                                                                                                           * @throws \OutOfRangeException
                                                                                                                                                                           * @throws \InvalidArgumentException
                                                                                                                                                                           * @throws \ErrorException
                                                                                                                                                                           */
                                                                                                                                                                          public function process(\Iterator $it) {}
                                                                                                                                                                      
                                                                                                                                                                          // ...
                                                                                                                                                                      }

                                                                                                                                                                      Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

                                                                                                                                                                      Avoid using empty try-catch blocks in compareYieldAgainstDeclaredType.
                                                                                                                                                                      Open

                                                                                                                                                                              } catch (RecursionDepthException $_) {
                                                                                                                                                                              }

                                                                                                                                                                      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

                                                                                                                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          private function warnAboutInvalidUnionType(
                                                                                                                                                                              Node $node,
                                                                                                                                                                              Closure $is_valid_type,
                                                                                                                                                                              UnionType $left,
                                                                                                                                                                              UnionType $right,
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 4 hrs to fix
                                                                                                                                                                      src/Phan/Analysis/BinaryOperatorFlagVisitor.php on lines 671..699

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 168.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                              if (!\is_string($method_name)) {
                                                                                                                                                                                  if ($method_name instanceof Node) {
                                                                                                                                                                                      $method_name = UnionTypeVisitor::anyStringLiteralForNode($this->code_base, $this->context, $method_name);
                                                                                                                                                                                  }
                                                                                                                                                                                  if (!\is_string($method_name)) {
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 3 hrs to fix
                                                                                                                                                                      src/Phan/Analysis/PostOrderAnalysisVisitor.php on lines 3088..3105

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 154.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                              if (!\is_string($method_name)) {
                                                                                                                                                                                  if ($method_name instanceof Node) {
                                                                                                                                                                                      $method_name = UnionTypeVisitor::anyStringLiteralForNode($this->code_base, $this->context, $method_name);
                                                                                                                                                                                  }
                                                                                                                                                                                  if (!\is_string($method_name)) {
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 3 hrs to fix
                                                                                                                                                                      src/Phan/Analysis/PostOrderAnalysisVisitor.php on lines 2613..2630

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 154.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          private const SKIP_VAR_CHECK_TYPES = [
                                                                                                                                                                              ast\AST_ARG_LIST       => true,  // may be a reference
                                                                                                                                                                              ast\AST_ARRAY_ELEM     => true,  // [$x, $y] = expr() is an AST_ARRAY_ELEM. visitArray() checks the right-hand side.
                                                                                                                                                                              ast\AST_ASSIGN_OP      => true,  // checked in visitAssignOp
                                                                                                                                                                              ast\AST_ASSIGN_REF     => true,  // Creates by reference?
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 3 hrs to fix
                                                                                                                                                                      .phan/plugins/DuplicateExpressionPlugin.php on lines 106..120

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 150.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                                  if (!$yield_key_type->withStaticResolvedInContext($context)->asExpandedTypes($code_base)->canCastToUnionType($expected_key_type)) {
                                                                                                                                                                                      $this->emitIssue(
                                                                                                                                                                                          Issue::TypeMismatchGeneratorYieldKey,
                                                                                                                                                                                          $node->lineno,
                                                                                                                                                                                          sprintf('(keys of %s)', ASTReverter::toShortString($node)),
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 55 mins to fix
                                                                                                                                                                      src/Phan/Analysis/PostOrderAnalysisVisitor.php on lines 1929..1939

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 99.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                              if (!$yield_value_type->withStaticResolvedInContext($context)->asExpandedTypes($code_base)->canCastToUnionType($expected_value_type)) {
                                                                                                                                                                                  $this->emitIssue(
                                                                                                                                                                                      Issue::TypeMismatchGeneratorYieldValue,
                                                                                                                                                                                      $node->lineno,
                                                                                                                                                                                      sprintf('(values of %s)', ASTReverter::toShortString($node)),
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 55 mins to fix
                                                                                                                                                                      src/Phan/Analysis/PostOrderAnalysisVisitor.php on lines 1945..1955

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 99.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                          public const AST_CAST_FLAGS_LOOKUP = [
                                                                                                                                                                              flags\TYPE_NULL => 'unset',
                                                                                                                                                                              flags\TYPE_BOOL => 'bool',
                                                                                                                                                                              flags\TYPE_LONG => 'int',
                                                                                                                                                                              flags\TYPE_DOUBLE => 'float',
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 2 other locations - About 55 mins to fix
                                                                                                                                                                      src/Phan/Debug.php on lines 332..345
                                                                                                                                                                      src/Phan/Debug.php on lines 389..402

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 98.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                              while ($parent_kind === ast\AST_ARRAY_ELEM) {
                                                                                                                                                                                  if ($parent_node->children['value'] !== $node) {
                                                                                                                                                                                      // e.g. analyzing `$v = [$x => $y];` for $x
                                                                                                                                                                                      return false;
                                                                                                                                                                                  }
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 50 mins to fix
                                                                                                                                                                      src/Phan/Analysis/PostOrderAnalysisVisitor.php on lines 3662..3675

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 97.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                              while ($parent_kind === ast\AST_ARRAY_ELEM) {
                                                                                                                                                                                  if ($parent_node->children['value'] !== $node) {
                                                                                                                                                                                      // e.g. analyzing `$v = [$x => $y];` for $x
                                                                                                                                                                                      return false;
                                                                                                                                                                                  }
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 50 mins to fix
                                                                                                                                                                      src/Phan/Analysis/PostOrderAnalysisVisitor.php on lines 3712..3725

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 97.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                              if (BlockAnalysisVisitor::isEmptyIterable($yield_from_type)) {
                                                                                                                                                                                  RedundantCondition::emitInstance(
                                                                                                                                                                                      $node->children['expr'],
                                                                                                                                                                                      $this->code_base,
                                                                                                                                                                                      (clone($this->context))->withLineNumberStart($node->children['expr']->lineno ?? $node->lineno),
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 45 mins to fix
                                                                                                                                                                      src/Phan/BlockAnalysisVisitor.php on lines 1129..1138

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 95.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                                  if (!$yield_key_type->withStaticResolvedInContext($context)->asExpandedTypes($code_base)->canCastToUnionType($expected_key_type->withStaticResolvedInContext($context))) {
                                                                                                                                                                                      $this->emitIssue(
                                                                                                                                                                                          Issue::TypeMismatchGeneratorYieldKey,
                                                                                                                                                                                          $node->lineno,
                                                                                                                                                                                          ASTReverter::toShortString($yield_key_node),
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 45 mins to fix
                                                                                                                                                                      src/Phan/Analysis/PostOrderAnalysisVisitor.php on lines 1814..1824

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 95.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                      Open

                                                                                                                                                                                  if (!$yield_value_type->withStaticResolvedInContext($context)->asExpandedTypes($code_base)->canCastToUnionType($expected_value_type->withStaticResolvedInContext($context))) {
                                                                                                                                                                                      $this->emitIssue(
                                                                                                                                                                                          Issue::TypeMismatchGeneratorYieldValue,
                                                                                                                                                                                          $node->lineno,
                                                                                                                                                                                          ASTReverter::toShortString($yield_value_node),
                                                                                                                                                                      Severity: Minor
                                                                                                                                                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php and 1 other location - About 45 mins to fix
                                                                                                                                                                      src/Phan/Analysis/PostOrderAnalysisVisitor.php on lines 1837..1847

                                                                                                                                                                      Duplicated Code

                                                                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                      Tuning

                                                                                                                                                                      This issue has a mass of 95.

                                                                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                      Refactorings

                                                                                                                                                                      Further Reading

                                                                                                                                                                      There are no issues that match your filters.

                                                                                                                                                                      Category
                                                                                                                                                                      Status