src/Phan/BlockAnalysisVisitor.php

Summary

Maintainability
F
3 wks
Test Coverage

File BlockAnalysisVisitor.php has 2010 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Phan;
Severity: Major
Found in src/Phan/BlockAnalysisVisitor.php - About 5 days to fix

    Function visitSwitchList has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
    Open

        public function visitSwitchList(Node $node): Context
        {
            // Make a copy of the internal context so that we don't
            // leak any changes within the closed context to the
            // outer scope
    Severity: Minor
    Found in src/Phan/BlockAnalysisVisitor.php - About 1 day 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

    BlockAnalysisVisitor has 56 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BlockAnalysisVisitor extends AnalysisVisitor
    {
    
        /**
         * @var Node[]
    Severity: Major
    Found in src/Phan/BlockAnalysisVisitor.php - About 1 day to fix

      Method visitSwitchList has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function visitSwitchList(Node $node): Context
          {
              // Make a copy of the internal context so that we don't
              // leak any changes within the closed context to the
              // outer scope
      Severity: Major
      Found in src/Phan/BlockAnalysisVisitor.php - About 5 hrs to fix

        Method visitFor has 115 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function visitFor(Node $node): Context
            {
                $context = $this->context->withLineNumberStart(
                    $node->lineno
                );
        Severity: Major
        Found in src/Phan/BlockAnalysisVisitor.php - About 4 hrs to fix

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

              public function visitMatchArmList(Node $node): Context
              {
                  // Make a copy of the internal context so that we don't
                  // leak any changes within the closed context to the
                  // outer scope
          Severity: Minor
          Found in src/Phan/BlockAnalysisVisitor.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 createSwitchConditionAnalyzer has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              private function createSwitchConditionAnalyzer($switch_case_node): array
              {
                  $switch_kind = ($switch_case_node->kind ?? null);
                  try {
                      if ($switch_kind === ast\AST_VAR) {
          Severity: Minor
          Found in src/Phan/BlockAnalysisVisitor.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

          Method visitMatchArmList has 100 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function visitMatchArmList(Node $node): Context
              {
                  // Make a copy of the internal context so that we don't
                  // leak any changes within the closed context to the
                  // outer scope
          Severity: Major
          Found in src/Phan/BlockAnalysisVisitor.php - About 4 hrs to fix

            Function visitIf has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function visitIf(Node $node): Context
                {
                    $context = $this->context->withLineNumberStart(
                        $node->lineno
                    );
            Severity: Minor
            Found in src/Phan/BlockAnalysisVisitor.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 analyzeSubstituteVarAssert has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                private function analyzeSubstituteVarAssert(CodeBase $code_base, Context $context, string $text): void
                {
                    $has_known_annotations = false;
                    if (\preg_match_all(self::PHAN_VAR_REGEX, $text, $matches, \PREG_SET_ORDER) > 0) {
                        $has_known_annotations = true;
            Severity: Minor
            Found in src/Phan/BlockAnalysisVisitor.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 visitForeach has 86 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function visitForeach(Node $node): Context
                {
                    $code_base = $this->code_base;
                    $context = $this->context;
                    $context->setLineNumberStart($node->lineno);
            Severity: Major
            Found in src/Phan/BlockAnalysisVisitor.php - About 3 hrs to fix

              Function visitFor has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function visitFor(Node $node): Context
                  {
                      $context = $this->context->withLineNumberStart(
                          $node->lineno
                      );
              Severity: Minor
              Found in src/Phan/BlockAnalysisVisitor.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 BlockAnalysisVisitor has 32 public methods. Consider refactoring BlockAnalysisVisitor to keep number of public methods under 10.
              Open

              class BlockAnalysisVisitor extends AnalysisVisitor
              {
              
                  /**
                   * @var Node[]
              Severity: Minor
              Found in src/Phan/BlockAnalysisVisitor.php by phpmd

              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

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

              class BlockAnalysisVisitor extends AnalysisVisitor
              {
              
                  /**
                   * @var Node[]
              Severity: Minor
              Found in src/Phan/BlockAnalysisVisitor.php by phpmd

              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 BlockAnalysisVisitor has an overall complexity of 388 which is very high. The configured complexity threshold is 50.
              Open

              class BlockAnalysisVisitor extends AnalysisVisitor
              {
              
                  /**
                   * @var Node[]
              Severity: Minor
              Found in src/Phan/BlockAnalysisVisitor.php by phpmd

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

                  private function createMatchConditionAnalyzer($match_case_node): array
                  {
                      $match_kind = ($match_case_node->kind ?? null);
                      try {
                          if ($match_kind === ast\AST_VAR) {
              Severity: Minor
              Found in src/Phan/BlockAnalysisVisitor.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 visitIf has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function visitIf(Node $node): Context
                  {
                      $context = $this->context->withLineNumberStart(
                          $node->lineno
                      );
              Severity: Major
              Found in src/Phan/BlockAnalysisVisitor.php - About 3 hrs to fix

                Method visitWhile has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function visitWhile(Node $node): Context
                    {
                        $context = $this->context->withLineNumberStart(
                            $node->lineno
                        )->withEnterLoop($node);
                Severity: Major
                Found in src/Phan/BlockAnalysisVisitor.php - About 2 hrs to fix

                  Method createSwitchConditionAnalyzer has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function createSwitchConditionAnalyzer($switch_case_node): array
                      {
                          $switch_kind = ($switch_case_node->kind ?? null);
                          try {
                              if ($switch_kind === ast\AST_VAR) {
                  Severity: Major
                  Found in src/Phan/BlockAnalysisVisitor.php - About 2 hrs to fix

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

                        public function visitForeach(Node $node): Context
                        {
                            $code_base = $this->code_base;
                            $context = $this->context;
                            $context->setLineNumberStart($node->lineno);
                    Severity: Minor
                    Found in src/Phan/BlockAnalysisVisitor.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 createMatchConditionAnalyzer has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function createMatchConditionAnalyzer($match_case_node): array
                        {
                            $match_kind = ($match_case_node->kind ?? null);
                            try {
                                if ($match_kind === ast\AST_VAR) {
                    Severity: Major
                    Found in src/Phan/BlockAnalysisVisitor.php - About 2 hrs to fix

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

                          private function checkCanIterate(UnionType $union_type, Node $node): void
                          {
                              if ($union_type->isEmpty()) {
                                  return;
                              }
                      Severity: Minor
                      Found in src/Phan/BlockAnalysisVisitor.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 analyzeSubstituteVarAssert has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function analyzeSubstituteVarAssert(CodeBase $code_base, Context $context, string $text): void
                          {
                              $has_known_annotations = false;
                              if (\preg_match_all(self::PHAN_VAR_REGEX, $text, $matches, \PREG_SET_ORDER) > 0) {
                                  $has_known_annotations = true;
                      Severity: Major
                      Found in src/Phan/BlockAnalysisVisitor.php - About 2 hrs to fix

                        Method visitTry has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function visitTry(Node $node): Context
                            {
                                $context = $this->context->withLineNumberStart(
                                    $node->lineno
                                );
                        Severity: Major
                        Found in src/Phan/BlockAnalysisVisitor.php - About 2 hrs to fix

                          Method visitConditional has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function visitConditional(Node $node): Context
                              {
                                  $context = $this->context->withLineNumberStart(
                                      $node->lineno
                                  );
                          Severity: Major
                          Found in src/Phan/BlockAnalysisVisitor.php - About 2 hrs to fix

                            Method analyzeBinaryCoalesceForRedundantCondition has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function analyzeBinaryCoalesceForRedundantCondition(Context $context, Node $node): void
                                {
                                    $left_node = $node->children['left'];
                                    $right_node = $node->children['right'];
                                    // @phan-suppress-next-line PhanPartialTypeMismatchArgumentInternal, PhanPossiblyUndeclaredProperty
                            Severity: Major
                            Found in src/Phan/BlockAnalysisVisitor.php - About 2 hrs to fix

                              Method checkCanIterate has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function checkCanIterate(UnionType $union_type, Node $node): void
                                  {
                                      if ($union_type->isEmpty()) {
                                          return;
                                      }
                              Severity: Minor
                              Found in src/Phan/BlockAnalysisVisitor.php - About 2 hrs to fix

                                Function checkUnreachableCatch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function checkUnreachableCatch(array $catch_nodes, Context $context): void
                                    {
                                        if (count($catch_nodes) <= 1) {
                                            return;
                                        }
                                Severity: Minor
                                Found in src/Phan/BlockAnalysisVisitor.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 analyzeBinaryBoolOr has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function analyzeBinaryBoolOr(Node $node): Context
                                    {
                                        $context = $this->context->withLineNumberStart(
                                            $node->lineno
                                        );
                                Severity: Minor
                                Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                      public function analyzeBinaryBoolAnd(Node $node): Context
                                      {
                                          $context = $this->context->withLineNumberStart(
                                              $node->lineno
                                          );
                                  Severity: Minor
                                  Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                        private static function canNodeKindBeNull($node): bool
                                        {
                                            if (!$node instanceof Node) {
                                                return false;
                                            }
                                    Severity: Minor
                                    Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

                                      Method visitDoWhile has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function visitDoWhile(Node $node): Context
                                          {
                                              $context = $this->context;
                                              $context->setLineNumberStart($node->lineno);
                                              $context = $context->withEnterLoop($node);
                                      Severity: Minor
                                      Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                            public function visitWhile(Node $node): Context
                                            {
                                                $context = $this->context->withLineNumberStart(
                                                    $node->lineno
                                                )->withEnterLoop($node);
                                        Severity: Minor
                                        Found in src/Phan/BlockAnalysisVisitor.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 analyzeForeachIteration has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            private function analyzeForeachIteration(Context $context, UnionType $expression_union_type, Node $node): Context
                                            {
                                                $code_base = $this->code_base;
                                                $value_node = $node->children['value'];
                                                if ($value_node instanceof Node) {
                                        Severity: Minor
                                        Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                              private function checkUnreachableCatch(array $catch_nodes, Context $context): void
                                              {
                                                  if (count($catch_nodes) <= 1) {
                                                      return;
                                                  }
                                          Severity: Minor
                                          Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                                public function visitConditional(Node $node): Context
                                                {
                                                    $context = $this->context->withLineNumberStart(
                                                        $node->lineno
                                                    );
                                            Severity: Minor
                                            Found in src/Phan/BlockAnalysisVisitor.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 analyzeAndGetUpdatedContextAndAssertTruthy has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                private function analyzeAndGetUpdatedContextAndAssertTruthy(
                                                    Context $context,
                                                    Node $parent_node,
                                                    $condition_node
                                                ): Context {
                                            Severity: Minor
                                            Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                                  private function analyzeMatchArm(
                                                      Context $child_context,
                                                      Context $fallthrough_context,
                                                      ?Closure $match_variable_condition,
                                                      ?Closure $match_variable_negated_condition,
                                              Severity: Minor
                                              Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                                    private static function createVarForInlineComment(CodeBase $code_base, Context $context, string $variable_name, UnionType $type, bool $create_variable): void
                                                    {
                                                        if (!$context->getScope()->hasVariableWithName($variable_name)) {
                                                            if (Variable::isHardcodedVariableInScopeWithName($variable_name, $context->isInGlobalScope())) {
                                                                return;
                                                Severity: Minor
                                                Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                                      private function warnAboutNonTraversableType(Node $node, Type $type): void
                                                      {
                                                          $fqsen = FullyQualifiedClassName::fromType($type);
                                                          if (!$this->code_base->hasClassWithFQSEN($fqsen)) {
                                                              return;
                                                  Severity: Minor
                                                  Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                                        private function preAnalyzeIfElemCondition(Node $if_elem_node, Context $fallthrough_context): array
                                                        {
                                                            $condition_node = $if_elem_node->children['cond'];
                                                            if ($condition_node instanceof Node) {
                                                                if ($condition_node->kind === ast\AST_BINARY_OP) {
                                                    Severity: Minor
                                                    Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                                          private function analyzeMatchArm(
                                                              Context $child_context,
                                                              Context $fallthrough_context,
                                                              ?Closure $match_variable_condition,
                                                              ?Closure $match_variable_negated_condition,
                                                      Severity: Minor
                                                      Found in src/Phan/BlockAnalysisVisitor.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 analyzeForeachIteration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          private function analyzeForeachIteration(Context $context, UnionType $expression_union_type, Node $node): Context
                                                          {
                                                              $code_base = $this->code_base;
                                                              $value_node = $node->children['value'];
                                                              if ($value_node instanceof Node) {
                                                      Severity: Minor
                                                      Found in src/Phan/BlockAnalysisVisitor.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 visitArray has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          public function visitArray(Node $node): Context
                                                          {
                                                              $context = $this->context;
                                                              $context->setLineNumberStart($node->lineno);
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                                            public function visitIfElem(Node $node): Context
                                                            {
                                                                $context = $this->context->withLineNumberStart(
                                                                    $node->lineno
                                                                );
                                                        Severity: Minor
                                                        Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                                              public function visitStmtList(Node $node): Context
                                                              {
                                                                  $context = $this->context;
                                                                  $plugin_set = ConfigPluginSet::instance();
                                                                  $plugin_set->preAnalyzeNode(
                                                          Severity: Minor
                                                          Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

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

                                                                private function analyzeBinaryCoalesceForRedundantCondition(Context $context, Node $node): void
                                                                {
                                                                    $left_node = $node->children['left'];
                                                                    $right_node = $node->children['right'];
                                                                    // @phan-suppress-next-line PhanPartialTypeMismatchArgumentInternal, PhanPossiblyUndeclaredProperty
                                                            Severity: Minor
                                                            Found in src/Phan/BlockAnalysisVisitor.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 visitArray has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                public function visitArray(Node $node): Context
                                                                {
                                                                    $context = $this->context;
                                                                    $context->setLineNumberStart($node->lineno);
                                                            
                                                            
                                                            Severity: Minor
                                                            Found in src/Phan/BlockAnalysisVisitor.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 analyzeBinaryBoolOr has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                public function analyzeBinaryBoolOr(Node $node): Context
                                                                {
                                                                    $context = $this->context->withLineNumberStart(
                                                                        $node->lineno
                                                                    );
                                                            Severity: Minor
                                                            Found in src/Phan/BlockAnalysisVisitor.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 analyzeBinaryBoolAnd has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                public function analyzeBinaryBoolAnd(Node $node): Context
                                                                {
                                                                    $context = $this->context->withLineNumberStart(
                                                                        $node->lineno
                                                                    );
                                                            Severity: Minor
                                                            Found in src/Phan/BlockAnalysisVisitor.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 analyzeMatchArm has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                            Open

                                                                    Context $child_context,
                                                                    Context $fallthrough_context,
                                                                    ?Closure $match_variable_condition,
                                                                    ?Closure $match_variable_negated_condition,
                                                                    Node $arm_node,
                                                            Severity: Major
                                                            Found in src/Phan/BlockAnalysisVisitor.php - About 50 mins to fix

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

                                                                  public static function isEmptyIterable(UnionType $union_type): bool
                                                                  {
                                                                      $has_iterable_types = false;
                                                                      foreach ($union_type->getRealTypeSet() as $type) {
                                                                          if ($type->isPossiblyObject()) {
                                                              Severity: Minor
                                                              Found in src/Phan/BlockAnalysisVisitor.php - About 45 mins to fix

                                                              Cognitive Complexity

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

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

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

                                                              Further reading

                                                              Consider simplifying this complex logical expression.
                                                              Open

                                                                      if (Config::getValue('unused_variable_detection') &&
                                                                          !$expression_union_type->isEmpty() && !$expression_union_type->hasPossiblyObjectTypes() &&
                                                                          InferPureSnippetVisitor::isSideEffectFreeSnippet($this->code_base, $inner_context, $stmts_node) &&
                                                                          self::isLoopVariableWithoutSideEffects($node->children['key']) &&
                                                                          self::isLoopVariableWithoutSideEffects($node->children['value'])
                                                              Severity: Major
                                                              Found in src/Phan/BlockAnalysisVisitor.php - About 40 mins to fix

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

                                                                    private static function createVarForInlineComment(CodeBase $code_base, Context $context, string $variable_name, UnionType $type, bool $create_variable): void
                                                                Severity: Minor
                                                                Found in src/Phan/BlockAnalysisVisitor.php - About 35 mins to fix

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

                                                                      private function preAnalyzeIfElemCondition(Node $if_elem_node, Context $fallthrough_context): array
                                                                      {
                                                                          $condition_node = $if_elem_node->children['cond'];
                                                                          if ($condition_node instanceof Node) {
                                                                              if ($condition_node->kind === ast\AST_BINARY_OP) {
                                                                  Severity: Minor
                                                                  Found in src/Phan/BlockAnalysisVisitor.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 visitTry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                      public function visitTry(Node $node): Context
                                                                      {
                                                                          $context = $this->context->withLineNumberStart(
                                                                              $node->lineno
                                                                          );
                                                                  Severity: Minor
                                                                  Found in src/Phan/BlockAnalysisVisitor.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 handleScalarStmt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                      private function handleScalarStmt(Node $node, Context $context, $child_node): void
                                                                      {
                                                                          if (\is_string($child_node)) {
                                                                              $consumed = false;
                                                                              if (\strpos($child_node, '@phan-') !== false) {
                                                                  Severity: Minor
                                                                  Found in src/Phan/BlockAnalysisVisitor.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 $type->isNull();
                                                                  Severity: Major
                                                                  Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                    return [
                                                                                        $switch_case_node,
                                                                                        /**
                                                                                         * @param Node|string|int|float $cond_node
                                                                                         */
                                                                    Severity: Major
                                                                    Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                              return self::NOOP_SWITCH_COND_ANALYZER;
                                                                      Severity: Major
                                                                      Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                        return [
                                                                                            $match_case_node,
                                                                                            /**
                                                                                             * @param Node|string|int|float $cond_node
                                                                                             */
                                                                        Severity: Major
                                                                        Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                                  return [
                                                                                                      $switch_variable_node,
                                                                                                      /**
                                                                                                       * @param Node|string|int|float $cond_node
                                                                                                       */
                                                                          Severity: Major
                                                                          Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

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

                                                                              Avoid too many return statements within this method.
                                                                              Open

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

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                                            return self::NOOP_SWITCH_COND_ANALYZER;
                                                                                Severity: Major
                                                                                Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

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

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

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

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                      return ParseVisitor::isConstExpr($node);
                                                                                      Severity: Major
                                                                                      Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                                    return self::NOOP_SWITCH_COND_ANALYZER;
                                                                                        Severity: Major
                                                                                        Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                  return self::NOOP_SWITCH_COND_ANALYZER;
                                                                                          Severity: Major
                                                                                          Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

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

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                                      return [
                                                                                                                          $match_variable_node,
                                                                                                                          /**
                                                                                                                           * @param Node|string|int|float $cond_node
                                                                                                                           */
                                                                                              Severity: Major
                                                                                              Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                                return self::canNodeKindBeNull($node->children['right']);
                                                                                                Severity: Major
                                                                                                Found in src/Phan/BlockAnalysisVisitor.php - About 30 mins to fix

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

                                                                                                      private static function createVarForInlineComment(CodeBase $code_base, Context $context, string $variable_name, UnionType $type, bool $create_variable): void
                                                                                                      {
                                                                                                          if (!$context->getScope()->hasVariableWithName($variable_name)) {
                                                                                                              if (Variable::isHardcodedVariableInScopeWithName($variable_name, $context->isInGlobalScope())) {
                                                                                                                  return;
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.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 warnAboutNonTraversableType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      private function warnAboutNonTraversableType(Node $node, Type $type): void
                                                                                                      {
                                                                                                          $fqsen = FullyQualifiedClassName::fromType($type);
                                                                                                          if (!$this->code_base->hasClassWithFQSEN($fqsen)) {
                                                                                                              return;
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.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 recordLoopContextForBreakOrContinue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      private function recordLoopContextForBreakOrContinue(Context $child_context): void
                                                                                                      {
                                                                                                          for ($i = \count($this->parent_node_list) - 1; $i >= 0; $i--) {
                                                                                                              $node = $this->parent_node_list[$i];
                                                                                                              switch ($node->kind) {
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.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 visitStmtList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      public function visitStmtList(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context;
                                                                                                          $plugin_set = ConfigPluginSet::instance();
                                                                                                          $plugin_set->preAnalyzeNode(
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.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 visitDoWhile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      public function visitDoWhile(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context;
                                                                                                          $context->setLineNumberStart($node->lineno);
                                                                                                          $context = $context->withEnterLoop($node);
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.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 visitWhile() has 105 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                                                  Open

                                                                                                      public function visitWhile(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          )->withEnterLoop($node);
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  The method analyzeSubstituteVarAssert() has an NPath complexity of 225. The configured NPath complexity threshold is 200.
                                                                                                  Open

                                                                                                      private function analyzeSubstituteVarAssert(CodeBase $code_base, Context $context, string $text): void
                                                                                                      {
                                                                                                          $has_known_annotations = false;
                                                                                                          if (\preg_match_all(self::PHAN_VAR_REGEX, $text, $matches, \PREG_SET_ORDER) > 0) {
                                                                                                              $has_known_annotations = true;
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  NPathComplexity

                                                                                                  Since: 0.1

                                                                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                                                  Example

                                                                                                  class Foo {
                                                                                                      function bar() {
                                                                                                          // lots of complicated code
                                                                                                      }
                                                                                                  }

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

                                                                                                  The method visitForeach() has an NPath complexity of 4032. The configured NPath complexity threshold is 200.
                                                                                                  Open

                                                                                                      public function visitForeach(Node $node): Context
                                                                                                      {
                                                                                                          $code_base = $this->code_base;
                                                                                                          $context = $this->context;
                                                                                                          $context->setLineNumberStart($node->lineno);
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  NPathComplexity

                                                                                                  Since: 0.1

                                                                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                                                  Example

                                                                                                  class Foo {
                                                                                                      function bar() {
                                                                                                          // lots of complicated code
                                                                                                      }
                                                                                                  }

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

                                                                                                  The method visitMatchArmList() has an NPath complexity of 6750. The configured NPath complexity threshold is 200.
                                                                                                  Open

                                                                                                      public function visitMatchArmList(Node $node): Context
                                                                                                      {
                                                                                                          // Make a copy of the internal context so that we don't
                                                                                                          // leak any changes within the closed context to the
                                                                                                          // outer scope
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  NPathComplexity

                                                                                                  Since: 0.1

                                                                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                                                  Example

                                                                                                  class Foo {
                                                                                                      function bar() {
                                                                                                          // lots of complicated code
                                                                                                      }
                                                                                                  }

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

                                                                                                  The method visitSwitchList() has an NPath complexity of 337740. The configured NPath complexity threshold is 200.
                                                                                                  Open

                                                                                                      public function visitSwitchList(Node $node): Context
                                                                                                      {
                                                                                                          // Make a copy of the internal context so that we don't
                                                                                                          // leak any changes within the closed context to the
                                                                                                          // outer scope
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  NPathComplexity

                                                                                                  Since: 0.1

                                                                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                                                  Example

                                                                                                  class Foo {
                                                                                                      function bar() {
                                                                                                          // lots of complicated code
                                                                                                      }
                                                                                                  }

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

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

                                                                                                      public function visitMatchArmList(Node $node): Context
                                                                                                      {
                                                                                                          // Make a copy of the internal context so that we don't
                                                                                                          // leak any changes within the closed context to the
                                                                                                          // outer scope
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

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

                                                                                                      public function visitFor(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          );
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

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

                                                                                                      public function visitWhile(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          )->withEnterLoop($node);
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  NPathComplexity

                                                                                                  Since: 0.1

                                                                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                                                  Example

                                                                                                  class Foo {
                                                                                                      function bar() {
                                                                                                          // lots of complicated code
                                                                                                      }
                                                                                                  }

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

                                                                                                  The method checkCanIterate() has an NPath complexity of 504. The configured NPath complexity threshold is 200.
                                                                                                  Open

                                                                                                      private function checkCanIterate(UnionType $union_type, Node $node): void
                                                                                                      {
                                                                                                          if ($union_type->isEmpty()) {
                                                                                                              return;
                                                                                                          }
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  NPathComplexity

                                                                                                  Since: 0.1

                                                                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                                                  Example

                                                                                                  class Foo {
                                                                                                      function bar() {
                                                                                                          // lots of complicated code
                                                                                                      }
                                                                                                  }

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

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

                                                                                                      public function visitSwitchList(Node $node): Context
                                                                                                      {
                                                                                                          // Make a copy of the internal context so that we don't
                                                                                                          // leak any changes within the closed context to the
                                                                                                          // outer scope
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

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

                                                                                                  class BlockAnalysisVisitor extends AnalysisVisitor
                                                                                                  {
                                                                                                  
                                                                                                      /**
                                                                                                       * @var Node[]
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  The method visitFor() has an NPath complexity of 8160. The configured NPath complexity threshold is 200.
                                                                                                  Open

                                                                                                      public function visitFor(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          );
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  NPathComplexity

                                                                                                  Since: 0.1

                                                                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                                                  Example

                                                                                                  class Foo {
                                                                                                      function bar() {
                                                                                                          // lots of complicated code
                                                                                                      }
                                                                                                  }

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

                                                                                                  The method visitIf() has an NPath complexity of 972. The configured NPath complexity threshold is 200.
                                                                                                  Open

                                                                                                      public function visitIf(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          );
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  NPathComplexity

                                                                                                  Since: 0.1

                                                                                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                                                  Example

                                                                                                  class Foo {
                                                                                                      function bar() {
                                                                                                          // lots of complicated code
                                                                                                      }
                                                                                                  }

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

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

                                                                                                      public function visitTry(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          );
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

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

                                                                                                      public function visitIf(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          );
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

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

                                                                                                      public function visitForeach(Node $node): Context
                                                                                                      {
                                                                                                          $code_base = $this->code_base;
                                                                                                          $context = $this->context;
                                                                                                          $context->setLineNumberStart($node->lineno);
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

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

                                                                                                      private function createSwitchConditionAnalyzer($switch_case_node): array
                                                                                                      {
                                                                                                          $switch_kind = ($switch_case_node->kind ?? null);
                                                                                                          try {
                                                                                                              if ($switch_kind === ast\AST_VAR) {
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 analyzeBinaryCoalesceForRedundantCondition() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      private function analyzeBinaryCoalesceForRedundantCondition(Context $context, Node $node): void
                                                                                                      {
                                                                                                          $left_node = $node->children['left'];
                                                                                                          $right_node = $node->children['right'];
                                                                                                          // @phan-suppress-next-line PhanPartialTypeMismatchArgumentInternal, PhanPossiblyUndeclaredProperty
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 canNodeKindBeNull() has a Cyclomatic Complexity of 30. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      private static function canNodeKindBeNull($node): bool
                                                                                                      {
                                                                                                          if (!$node instanceof Node) {
                                                                                                              return false;
                                                                                                          }
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 analyzeSubstituteVarAssert() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      private function analyzeSubstituteVarAssert(CodeBase $code_base, Context $context, string $text): void
                                                                                                      {
                                                                                                          $has_known_annotations = false;
                                                                                                          if (\preg_match_all(self::PHAN_VAR_REGEX, $text, $matches, \PREG_SET_ORDER) > 0) {
                                                                                                              $has_known_annotations = true;
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 visitWhile() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      public function visitWhile(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          )->withEnterLoop($node);
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 visitIf() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      public function visitIf(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          );
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 recordLoopContextForBreakOrContinue() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      private function recordLoopContextForBreakOrContinue(Context $child_context): void
                                                                                                      {
                                                                                                          for ($i = \count($this->parent_node_list) - 1; $i >= 0; $i--) {
                                                                                                              $node = $this->parent_node_list[$i];
                                                                                                              switch ($node->kind) {
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 isAlwaysDefined() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      private static function isAlwaysDefined(Context $context, Node $node): bool
                                                                                                      {
                                                                                                          switch ($node->kind) {
                                                                                                              case ast\AST_VAR:
                                                                                                                  $var_name = $node->children['name'];
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 handleScalarStmt() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      private function handleScalarStmt(Node $node, Context $context, $child_node): void
                                                                                                      {
                                                                                                          if (\is_string($child_node)) {
                                                                                                              $consumed = false;
                                                                                                              if (\strpos($child_node, '@phan-') !== false) {
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 createMatchConditionAnalyzer() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      private function createMatchConditionAnalyzer($match_case_node): array
                                                                                                      {
                                                                                                          $match_kind = ($match_case_node->kind ?? null);
                                                                                                          try {
                                                                                                              if ($match_kind === ast\AST_VAR) {
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 visitForeach() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      public function visitForeach(Node $node): Context
                                                                                                      {
                                                                                                          $code_base = $this->code_base;
                                                                                                          $context = $this->context;
                                                                                                          $context->setLineNumberStart($node->lineno);
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 visitSwitchList() has a Cyclomatic Complexity of 31. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      public function visitSwitchList(Node $node): Context
                                                                                                      {
                                                                                                          // Make a copy of the internal context so that we don't
                                                                                                          // leak any changes within the closed context to the
                                                                                                          // outer scope
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 checkCanIterate() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      private function checkCanIterate(UnionType $union_type, Node $node): void
                                                                                                      {
                                                                                                          if ($union_type->isEmpty()) {
                                                                                                              return;
                                                                                                          }
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 visitMatchArmList() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      public function visitMatchArmList(Node $node): Context
                                                                                                      {
                                                                                                          // Make a copy of the internal context so that we don't
                                                                                                          // leak any changes within the closed context to the
                                                                                                          // outer scope
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 visitFor() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                                                                                                  Open

                                                                                                      public function visitFor(Node $node): Context
                                                                                                      {
                                                                                                          $context = $this->context->withLineNumberStart(
                                                                                                              $node->lineno
                                                                                                          );
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 BlockAnalysisVisitor has a coupling between objects value of 42. Consider to reduce the number of dependencies under 13.
                                                                                                  Open

                                                                                                  class BlockAnalysisVisitor extends AnalysisVisitor
                                                                                                  {
                                                                                                  
                                                                                                      /**
                                                                                                       * @var Node[]
                                                                                                  Severity: Minor
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php by phpmd

                                                                                                  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 checkCanIterate.
                                                                                                  Open

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

                                                                                                  EmptyCatchBlock

                                                                                                  Since: 2.7.0

                                                                                                  Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.

                                                                                                  Example

                                                                                                  class Foo {
                                                                                                  
                                                                                                    public function bar()
                                                                                                    {
                                                                                                        try {
                                                                                                            // ...
                                                                                                        } catch (Exception $e) {} // empty catch block
                                                                                                    }
                                                                                                  }

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

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

                                                                                                              if ($match_kind === ast\AST_VAR) {
                                                                                                                  $match_variable = (new ConditionVisitor($this->code_base, $this->context))->getVariableFromScope($match_case_node, $this->context);
                                                                                                                  if (!$match_variable) {
                                                                                                                      return self::NOOP_SWITCH_COND_ANALYZER;
                                                                                                                  }
                                                                                                  Severity: Major
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php and 1 other location - About 2 days to fix
                                                                                                  src/Phan/BlockAnalysisVisitor.php on lines 1698..1752

                                                                                                  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 433.

                                                                                                  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 ($switch_kind === ast\AST_VAR) {
                                                                                                                  $switch_variable = (new ConditionVisitor($this->code_base, $this->context))->getVariableFromScope($switch_case_node, $this->context);
                                                                                                                  if (!$switch_variable) {
                                                                                                                      return self::NOOP_SWITCH_COND_ANALYZER;
                                                                                                                  }
                                                                                                  Severity: Major
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php and 1 other location - About 2 days to fix
                                                                                                  src/Phan/BlockAnalysisVisitor.php on lines 2292..2346

                                                                                                  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 433.

                                                                                                  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 ($condition_node instanceof Node) {
                                                                                                              // Analyze the cond expression for its side effects and the code it contains,
                                                                                                              // not the effect of the condition.
                                                                                                              // e.g. `while ($x = foo())`
                                                                                                              $context = $this->analyzeAndGetUpdatedContext(
                                                                                                  Severity: Major
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php and 1 other location - About 2 hrs to fix
                                                                                                  src/Phan/BlockAnalysisVisitor.php on lines 676..693

                                                                                                  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 132.

                                                                                                  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 ($condition_subnode instanceof Node) {
                                                                                                                  // Analyze the cond expression for its side effects and the code it contains,
                                                                                                                  // not the effect of the condition.
                                                                                                                  // e.g. `while ($x = foo())`
                                                                                                                  $context = $this->analyzeAndGetUpdatedContext(
                                                                                                  Severity: Major
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php and 1 other location - About 2 hrs to fix
                                                                                                  src/Phan/BlockAnalysisVisitor.php on lines 836..853

                                                                                                  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 132.

                                                                                                  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

                                                                                                                      function (Context $child_context, $cond_node) use ($switch_case_node): Context {
                                                                                                                          // Handle match(cond) { $x = constexpr => ... }. The assignment was already analyzed.
                                                                                                                          while ($cond_node instanceof Node && \in_array($cond_node->kind, [ast\AST_ASSIGN, ast\AST_ASSIGN_REF, ast\AST_ASSIGN_OP], true)) {
                                                                                                                              $cond_node = $cond_node->children['var'];
                                                                                                                          }
                                                                                                  Severity: Major
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php and 1 other location - About 1 hr to fix
                                                                                                  src/Phan/BlockAnalysisVisitor.php on lines 1772..1779

                                                                                                  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 118.

                                                                                                  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

                                                                                                                      function (Context $child_context, $cond_node) use ($switch_case_node): Context {
                                                                                                                          // Handle match(cond) { $x = constexpr => ... }. The assignment was already analyzed.
                                                                                                                          while ($cond_node instanceof Node && \in_array($cond_node->kind, [ast\AST_ASSIGN, ast\AST_ASSIGN_REF, ast\AST_ASSIGN_OP], true)) {
                                                                                                                              $cond_node = $cond_node->children['var'];
                                                                                                                          }
                                                                                                  Severity: Major
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php and 1 other location - About 1 hr to fix
                                                                                                  src/Phan/BlockAnalysisVisitor.php on lines 1761..1768

                                                                                                  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 118.

                                                                                                  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 ($right_node instanceof Node) {
                                                                                                              $right_context = $this->analyzeAndGetUpdatedContext($context_with_left_condition, $node, $right_node);
                                                                                                              if ($right_node->kind === ast\AST_THROW) {
                                                                                                                  return $this->postOrderAnalyze($context_with_false_left_condition, $node);
                                                                                                              }
                                                                                                  Severity: Major
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php and 1 other location - About 1 hr to fix
                                                                                                  src/Phan/BlockAnalysisVisitor.php on lines 2719..2734

                                                                                                  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 105.

                                                                                                  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 ($right_node instanceof Node) {
                                                                                                              $right_context = $this->analyzeAndGetUpdatedContext($context_with_false_left_condition, $node, $right_node);
                                                                                                              if ($right_node->kind === ast\AST_THROW) {
                                                                                                                  return $this->postOrderAnalyze($context_with_true_left_condition, $node);
                                                                                                              }
                                                                                                  Severity: Major
                                                                                                  Found in src/Phan/BlockAnalysisVisitor.php and 1 other location - About 1 hr to fix
                                                                                                  src/Phan/BlockAnalysisVisitor.php on lines 2650..2664

                                                                                                  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 105.

                                                                                                  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 (self::isEmptyIterable($union_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/BlockAnalysisVisitor.php and 1 other location - About 45 mins to fix
                                                                                                  src/Phan/Analysis/PostOrderAnalysisVisitor.php on lines 1887..1896

                                                                                                  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