src/Phan/AST/UnionTypeVisitor.php

Summary

Maintainability
F
1 mo
Test Coverage

File UnionTypeVisitor.php has 2798 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

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

    UnionTypeVisitor has 90 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class UnionTypeVisitor extends AnalysisVisitor
    {
        /**
         * If an dynamic unpacked array has more elements than this, then give up on building up the union type
         */
    Severity: Major
    Found in src/Phan/AST/UnionTypeVisitor.php - About 1 day to fix

      Function visitDim has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
      Open

          public function visitDim(Node $node, bool $treat_undef_as_nullable = false): UnionType
          {
              $union_type = self::unionTypeFromNode(
                  $this->code_base,
                  $this->context,
      Severity: Minor
      Found in src/Phan/AST/UnionTypeVisitor.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

      Function visitVar has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
      Open

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

      Function resolveArrayShapeElementTypesForOffset has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function resolveArrayShapeElementTypesForOffset(UnionType $union_type, $dim_value, bool $is_computing_real_type_set = false)
          {
              /**
               * @var bool $has_non_array_shape_type this will be true if there are types that support array access
               *           but have unknown array shapes in $union_type
      Severity: Minor
      Found in src/Phan/AST/UnionTypeVisitor.php - About 7 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 visitDim has 173 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function visitDim(Node $node, bool $treat_undef_as_nullable = false): UnionType
          {
              $union_type = self::unionTypeFromNode(
                  $this->code_base,
                  $this->context,
      Severity: Major
      Found in src/Phan/AST/UnionTypeVisitor.php - About 6 hrs to fix

        Function visitArray has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

            public function visitArray(Node $node): UnionType
            {
                $children = $node->children;
                if (\count($children) > 0) {
                    $key_set = $this->getEquivalentArraySet($node);
        Severity: Minor
        Found in src/Phan/AST/UnionTypeVisitor.php - About 6 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 resolveArrayShapeElementTypes has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

            private function resolveArrayShapeElementTypes(Node $node, UnionType $union_type): ?UnionType
            {
                $dim_node = $node->children['dim'];
                $dim_value = $dim_node instanceof Node ? (new ContextNode($this->code_base, $this->context, $dim_node))->getEquivalentPHPScalarValue() : $dim_node;
                // TODO: detect and warn about null
        Severity: Minor
        Found in src/Phan/AST/UnionTypeVisitor.php - About 5 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 classTypesForNonName has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            private function classTypesForNonName(Node $node): UnionType
            {
                $node_type = UnionTypeVisitor::unionTypeFromNode(
                    $this->code_base,
                    $this->context,
        Severity: Minor
        Found in src/Phan/AST/UnionTypeVisitor.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 visitMethodCall has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            public function visitMethodCall(Node $node): UnionType
            {
                $method_name = $node->children['method'] ?? '';
        
                // Give up on any complicated nonsense where the
        Severity: Minor
        Found in src/Phan/AST/UnionTypeVisitor.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 methodFQSENListFromParts has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            private function methodFQSENListFromParts($class_or_expr, $method_name): array
            {
                $code_base = $this->code_base;
                $context = $this->context;
        
        
        Severity: Minor
        Found in src/Phan/AST/UnionTypeVisitor.php - 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 visitConditional has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            public function visitConditional(Node $node): UnionType
            {
                $cond_node = $node->children['cond'];
                $cond_truthiness = self::checkCondUnconditionalTruthiness($cond_node);
                // For the shorthand $a ?: $b, the cond node will be the truthy value.
        Severity: Minor
        Found in src/Phan/AST/UnionTypeVisitor.php - 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 visitVar has 106 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method analyzeProp has 98 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function analyzeProp(Node $node, bool $is_static): UnionType
              {
                  // Either expr(instance) or class(static) is set
                  $expr_node = $node->children['expr'] ?? null;
                  try {
          Severity: Major
          Found in src/Phan/AST/UnionTypeVisitor.php - About 3 hrs to fix

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

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

              Method unionTypeFromClassNode has 95 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function unionTypeFromClassNode(
                      CodeBase $code_base,
                      Context $context,
                      $node
                  ): UnionType {
              Severity: Major
              Found in src/Phan/AST/UnionTypeVisitor.php - About 3 hrs to fix

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

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

                    public function visitMethodCall(Node $node): UnionType
                    {
                        $method_name = $node->children['method'] ?? '';
                
                        // Give up on any complicated nonsense where the
                Severity: Major
                Found in src/Phan/AST/UnionTypeVisitor.php - About 3 hrs to fix

                  Method methodFQSENListFromParts has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function methodFQSENListFromParts($class_or_expr, $method_name): array
                      {
                          $code_base = $this->code_base;
                          $context = $this->context;
                  
                  
                  Severity: Major
                  Found in src/Phan/AST/UnionTypeVisitor.php - About 3 hrs to fix

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

                    class UnionTypeVisitor extends AnalysisVisitor
                    {
                        /**
                         * If an dynamic unpacked array has more elements than this, then give up on building up the union type
                         */
                    Severity: Minor
                    Found in src/Phan/AST/UnionTypeVisitor.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 UnionTypeVisitor has an overall complexity of 625 which is very high. The configured complexity threshold is 50.
                    Open

                    class UnionTypeVisitor extends AnalysisVisitor
                    {
                        /**
                         * If an dynamic unpacked array has more elements than this, then give up on building up the union type
                         */
                    Severity: Minor
                    Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                    The class UnionTypeVisitor has 62 public methods. Consider refactoring UnionTypeVisitor to keep number of public methods under 10.
                    Open

                    class UnionTypeVisitor extends AnalysisVisitor
                    {
                        /**
                         * If an dynamic unpacked array has more elements than this, then give up on building up the union type
                         */
                    Severity: Minor
                    Found in src/Phan/AST/UnionTypeVisitor.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

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

                        public static function unionTypeFromClassNode(
                            CodeBase $code_base,
                            Context $context,
                            $node
                        ): UnionType {
                    Severity: Minor
                    Found in src/Phan/AST/UnionTypeVisitor.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 methodFQSENListFromObjectAndMethodName has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function methodFQSENListFromObjectAndMethodName($class_or_expr, string $method_name): array
                        {
                            $code_base = $this->code_base;
                            $context = $this->context;
                    
                    
                    Severity: Minor
                    Found in src/Phan/AST/UnionTypeVisitor.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 visitArray has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function visitArray(Node $node): UnionType
                        {
                            $children = $node->children;
                            if (\count($children) > 0) {
                                $key_set = $this->getEquivalentArraySet($node);
                    Severity: Major
                    Found in src/Phan/AST/UnionTypeVisitor.php - About 3 hrs to fix

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

                          public function visitMagicConst(Node $node): UnionType
                          {
                              $flags = $node->flags;
                              switch ($flags) {
                                  case ast\flags\MAGIC_CLASS:
                      Severity: Minor
                      Found in src/Phan/AST/UnionTypeVisitor.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 visitTypeUnion has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function visitTypeUnion(Node $node): UnionType
                          {
                              // TODO: Validate that there aren't any duplicates
                              if (\count($node->children) === 1) {
                                  // Might be possible due to the polyfill in the future.
                      Severity: Minor
                      Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      Function createArrayShapeType has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function createArrayShapeType(array $key_set): ArrayShapeType
                          {
                              $field_types = [];
                      
                              foreach ($key_set as $key => $child) {
                      Severity: Minor
                      Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      Function getEquivalentArraySet has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function getEquivalentArraySet(Node $node): ?array
                          {
                              $elements = [];
                              $context_node = null;
                              foreach ($node->children as $child_node) {
                      Severity: Minor
                      Found in src/Phan/AST/UnionTypeVisitor.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 visitMagicConst has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function visitMagicConst(Node $node): UnionType
                          {
                              $flags = $node->flags;
                              switch ($flags) {
                                  case ast\flags\MAGIC_CLASS:
                      Severity: Major
                      Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

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

                            private function functionLikeFQSENListFromNode($node): array
                            {
                                $orig_node = $node;
                                if ($node instanceof Node) {
                                    $node = (new ContextNode($this->code_base, $this->context, $node))->getEquivalentPHPValue();
                        Severity: Minor
                        Found in src/Phan/AST/UnionTypeVisitor.php - 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 resolveArrayShapeElementTypes has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function resolveArrayShapeElementTypes(Node $node, UnionType $union_type): ?UnionType
                            {
                                $dim_node = $node->children['dim'];
                                $dim_value = $dim_node instanceof Node ? (new ContextNode($this->code_base, $this->context, $dim_node))->getEquivalentPHPScalarValue() : $dim_node;
                                // TODO: detect and warn about null
                        Severity: Major
                        Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

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

                              public static function resolveArrayShapeElementTypesForOffset(UnionType $union_type, $dim_value, bool $is_computing_real_type_set = false)
                              {
                                  /**
                                   * @var bool $has_non_array_shape_type this will be true if there are types that support array access
                                   *           but have unknown array shapes in $union_type
                          Severity: Major
                          Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

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

                                private function methodFQSENListFromObjectAndMethodName($class_or_expr, string $method_name): array
                                {
                                    $code_base = $this->code_base;
                                    $context = $this->context;
                            
                            
                            Severity: Major
                            Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

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

                                  private function arrayTypeFromRealTypeBuilder(?UnionTypeBuilder $builder, Node $node, bool $has_key): array
                                  {
                                      // Here, we only check for the real type being an integer.
                                      // Unknown strings such as '0' will cast to integers when used as array keys,
                                      // and if we knew all of the array keys were literals we would have generated an array shape instead.
                              Severity: Minor
                              Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

                              Cognitive Complexity

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

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

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

                              Further reading

                              Function checkIsValidStringOffset has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function checkIsValidStringOffset(UnionType $union_type, Node $node, UnionType $dim_type): void
                                  {
                                      $max_len = -1;
                                      foreach ($union_type->getRealTypeSet() as $type) {
                                          if ($type instanceof StringType) {
                              Severity: Minor
                              Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

                              Cognitive Complexity

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

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

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

                              Further reading

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

                                  public static function functionLikeListFromNodeAndContext(CodeBase $code_base, Context $context, $node, bool $log_error): array
                                  {
                                      try {
                                          $function_fqsens = (new UnionTypeVisitor($code_base, $context, true))->functionLikeFQSENListFromNode($node);
                                      } catch (FQSENException $e) {
                              Severity: Minor
                              Found in src/Phan/AST/UnionTypeVisitor.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 visitClassNameNode has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function visitClassNameNode(Node $node): UnionType
                                  {
                                      $kind = $node->kind;
                                      // Anonymous class of form `new class { ... }`
                                      if ($kind === \ast\AST_CLASS
                              Severity: Major
                              Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

                                Method classTypesForNonName has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function classTypesForNonName(Node $node): UnionType
                                    {
                                        $node_type = UnionTypeVisitor::unionTypeFromNode(
                                            $this->code_base,
                                            $this->context,
                                Severity: Major
                                Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

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

                                      private function functionLikeFQSENListFromNode($node): array
                                      {
                                          $orig_node = $node;
                                          if ($node instanceof Node) {
                                              $node = (new ContextNode($this->code_base, $this->context, $node))->getEquivalentPHPValue();
                                  Severity: Major
                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

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

                                        public function visitNew(Node $node): UnionType
                                        {
                                            static $object_type;
                                            if ($object_type === null) {
                                                $object_type = ObjectType::instance(false);
                                    Severity: Minor
                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                          private function checkInvalidUnpackKeyType(Node $node, UnionType $union_type, bool $is_array_spread): void
                                          {
                                              $is_invalid_because_associative = false;
                                              if (!$is_array_spread) {
                                                  foreach ($union_type->getTypeSet() as $type) {
                                      Severity: Minor
                                      Found in src/Phan/AST/UnionTypeVisitor.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 visitClassName has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function visitClassName(Node $node): UnionType
                                          {
                                              $class_node = $node->children['class'];
                                              try {
                                                  $class_list = (new ContextNode(
                                      Severity: Minor
                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                            private function checkIsValidStringOffset(UnionType $union_type, Node $node, UnionType $dim_type): void
                                            {
                                                $max_len = -1;
                                                foreach ($union_type->getRealTypeSet() as $type) {
                                                    if ($type instanceof StringType) {
                                        Severity: Minor
                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                              public function visitUnaryOp(Node $node): UnionType
                                              {
                                                  $result = self::unionTypeFromNode(
                                                      $this->code_base,
                                                      $this->context,
                                          Severity: Minor
                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                private function lookupClassOfCallableByName(string $class_name): ?FullyQualifiedClassName
                                                {
                                                    switch (\strtolower($class_name)) {
                                                        case 'self':
                                                        case 'static':
                                            Severity: Minor
                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                  public function fromTypeInSignature(Node $node): UnionType
                                                  {
                                                      $is_nullable = $node->kind === ast\AST_NULLABLE_TYPE;
                                                      if ($is_nullable) {
                                                          $node = $node->children['type'];
                                              Severity: Minor
                                              Found in src/Phan/AST/UnionTypeVisitor.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 getPackedArrayFieldTypes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private function getPackedArrayFieldTypes($expr): ?array
                                                  {
                                                      if (!$expr instanceof Node) {
                                                          // TODO: Warn if non-array
                                                          return null;
                                              Severity: Minor
                                              Found in src/Phan/AST/UnionTypeVisitor.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 functionLikeListFromNodeAndContext has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  public static function functionLikeListFromNodeAndContext(CodeBase $code_base, Context $context, $node, bool $log_error): array
                                                  {
                                                      try {
                                                          $function_fqsens = (new UnionTypeVisitor($code_base, $context, true))->functionLikeFQSENListFromNode($node);
                                                      } catch (FQSENException $e) {
                                              Severity: Minor
                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                    public static function classListFromClassNameNode(CodeBase $code_base, Context $context, $node): array
                                                    {
                                                        $results = [];
                                                        $strings = UnionTypeVisitor::unionTypeFromNode($code_base, $context, $node)->asStringScalarValues();
                                                        foreach ($strings as $string) {
                                                Severity: Minor
                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                      public static function unionTypeFromNode(
                                                          CodeBase $code_base,
                                                          Context $context,
                                                          $node,
                                                          bool $should_catch_issue_exception = true
                                                  Severity: Minor
                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                        private static function couldRealTypesHaveKey(array $real_type_set, $dim_value): bool
                                                        {
                                                            foreach ($real_type_set as $type) {
                                                                if ($type instanceof ArrayShapeType) {
                                                                    if (\array_key_exists($dim_value, $type->getFieldTypes())) {
                                                    Severity: Minor
                                                    Found in src/Phan/AST/UnionTypeVisitor.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 createArrayShapeType has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        private function createArrayShapeType(array $key_set): ArrayShapeType
                                                        {
                                                            $field_types = [];
                                                    
                                                            foreach ($key_set as $key => $child) {
                                                    Severity: Minor
                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

                                                      Method visitTypeUnion has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          public function visitTypeUnion(Node $node): UnionType
                                                          {
                                                              // TODO: Validate that there aren't any duplicates
                                                              if (\count($node->children) === 1) {
                                                                  // Might be possible due to the polyfill in the future.
                                                      Severity: Minor
                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                            private function arrayTypeFromRealTypeBuilder(?UnionTypeBuilder $builder, Node $node, bool $has_key): array
                                                            {
                                                                // Here, we only check for the real type being an integer.
                                                                // Unknown strings such as '0' will cast to integers when used as array keys,
                                                                // and if we knew all of the array keys were literals we would have generated an array shape instead.
                                                        Severity: Minor
                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                              public function visitType(Node $node): UnionType
                                                              {
                                                                  switch ($node->flags) {
                                                                      case \ast\flags\TYPE_ARRAY:
                                                                          return ArrayType::instance(false)->asRealUnionType();
                                                          Severity: Minor
                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                                private function getEquivalentArraySet(Node $node): ?array
                                                                {
                                                                    $elements = [];
                                                                    $context_node = null;
                                                                    foreach ($node->children as $child_node) {
                                                            Severity: Minor
                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                                  public function visitClassName(Node $node): UnionType
                                                                  {
                                                                      $class_node = $node->children['class'];
                                                                      try {
                                                                          $class_list = (new ContextNode(
                                                              Severity: Minor
                                                              Found in src/Phan/AST/UnionTypeVisitor.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 analyzeUnpack has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                  private function analyzeUnpack(Node $node, bool $is_array_spread): UnionType
                                                                  {
                                                                      $union_type = self::unionTypeFromNode(
                                                                          $this->code_base,
                                                                          $this->context,
                                                              Severity: Minor
                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                                    public function visitName(Node $node): UnionType
                                                                    {
                                                                        $name = $node->children['name'];
                                                                        try {
                                                                            if ($node->flags & \ast\flags\NAME_NOT_FQ) {
                                                                Severity: Minor
                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                                      public function visitCast(Node $node): UnionType
                                                                      {
                                                                          // This calls unionTypeFromNode to trigger any warnings
                                                                          // TODO: Check if the cast would throw an error at runtime, based on the type (e.g. casting object to string/int)
                                                                  
                                                                  
                                                                  Severity: Minor
                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                                    class UnionTypeVisitor extends AnalysisVisitor
                                                                    {
                                                                        /**
                                                                         * If an dynamic unpacked array has more elements than this, then give up on building up the union type
                                                                         */
                                                                    Severity: Minor
                                                                    Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                    ExcessivePublicCount

                                                                    Since: 0.1

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

                                                                    Example

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

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

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

                                                                        public function fromTypeInSignature(Node $node): UnionType
                                                                        {
                                                                            $is_nullable = $node->kind === ast\AST_NULLABLE_TYPE;
                                                                            if ($is_nullable) {
                                                                                $node = $node->children['type'];
                                                                    Severity: Minor
                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                                          private function classListFromNode(Node $node): \Generator
                                                                          {
                                                                              // Get the types associated with the node
                                                                              $union_type = self::unionTypeFromNode(
                                                                                  $this->code_base,
                                                                      Severity: Minor
                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                                            public static function classListFromClassNameNode(CodeBase $code_base, Context $context, $node): array
                                                                            {
                                                                                $results = [];
                                                                                $strings = UnionTypeVisitor::unionTypeFromNode($code_base, $context, $node)->asStringScalarValues();
                                                                                foreach ($strings as $string) {
                                                                        Severity: Minor
                                                                        Found in src/Phan/AST/UnionTypeVisitor.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 typeAfterCastToObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                                        Open

                                                                            private static function typeAfterCastToObject(UnionType $expr_type): UnionType
                                                                            {
                                                                                static $stdclass;
                                                                                if ($stdclass === null) {
                                                                                    $stdclass = Type::fromFullyQualifiedString('\stdClass');
                                                                        Severity: Minor
                                                                        Found in src/Phan/AST/UnionTypeVisitor.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 typeAfterCastToObject has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                        Open

                                                                            private static function typeAfterCastToObject(UnionType $expr_type): UnionType
                                                                            {
                                                                                static $stdclass;
                                                                                if ($stdclass === null) {
                                                                                    $stdclass = Type::fromFullyQualifiedString('\stdClass');
                                                                        Severity: Minor
                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                                              private function checkInvalidUnpackKeyType(Node $node, UnionType $union_type, bool $is_array_spread): void
                                                                              {
                                                                                  $is_invalid_because_associative = false;
                                                                                  if (!$is_array_spread) {
                                                                                      foreach ($union_type->getTypeSet() as $type) {
                                                                          Severity: Minor
                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

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

                                                                                public static function unionTypeFromLiteralOrConstant(CodeBase $code_base, Context $context, $node): ?UnionType
                                                                                {
                                                                                    if ($node instanceof Node) {
                                                                                        // TODO: There are a lot more types of expressions that have known union types that this doesn't handle.
                                                                                        // Maybe callers should call something else if this fails (e.g. it's useful for them to know if an expression becomes a string)
                                                                            Severity: Minor
                                                                            Found in src/Phan/AST/UnionTypeVisitor.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 visitClassNameNode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                private function visitClassNameNode(Node $node): UnionType
                                                                                {
                                                                                    $kind = $node->kind;
                                                                                    // Anonymous class of form `new class { ... }`
                                                                                    if ($kind === \ast\AST_CLASS
                                                                            Severity: Minor
                                                                            Found in src/Phan/AST/UnionTypeVisitor.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

                                                                            Avoid deeply nested control flow statements.
                                                                            Open

                                                                                                    if ($this->should_catch_issue_exception) {
                                                                                                        $this->emitIssue(
                                                                                                            $issue_type,
                                                                                                            $node->lineno,
                                                                                                            (string)$union_type,
                                                                            Severity: Major
                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 45 mins to fix

                                                                              Avoid deeply nested control flow statements.
                                                                              Open

                                                                                                      if ($dim_type->containsNullable() && $dim_type->nonNullableClone()->canCastToUnionType($expected_key_type)) {
                                                                                                          $issue_type = Issue::TypeMismatchDimFetchNullable;
                                                                                                      }
                                                                              Severity: Major
                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 45 mins to fix

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

                                                                                        Node $node,
                                                                                        Closure $is_valid_type,
                                                                                        UnionType $type,
                                                                                        string $operator,
                                                                                        string $issue_type
                                                                                Severity: Minor
                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 35 mins to fix

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

                                                                                      public static function unionTypeFromNode(
                                                                                          CodeBase $code_base,
                                                                                          Context $context,
                                                                                          $node,
                                                                                          bool $should_catch_issue_exception = true
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/AST/UnionTypeVisitor.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 visitCall has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                  Open

                                                                                      public function visitCall(Node $node): UnionType
                                                                                      {
                                                                                          $expression = $node->children['expr'];
                                                                                          $function_list_generator = (new ContextNode(
                                                                                              $this->code_base,
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/AST/UnionTypeVisitor.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 visitClassConst has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                  Open

                                                                                      public function visitClassConst(Node $node): UnionType
                                                                                      {
                                                                                          try {
                                                                                              $constant = (new ContextNode(
                                                                                                  $this->code_base,
                                                                                  Severity: Minor
                                                                                  Found in src/Phan/AST/UnionTypeVisitor.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 null;
                                                                                  Severity: Major
                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                            return $resulting_element_type;
                                                                                    Severity: Major
                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                      return NullType::instance(false)->asRealUnionType();
                                                                                      Severity: Major
                                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                        return FalseType::instance(false)->asRealUnionType();
                                                                                        Severity: Major
                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                      return $this->methodFQSENListFromParts($node[0], $node[1]);
                                                                                          Severity: Major
                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                            return UnionTypeVisitor::unionTypeFromNode(
                                                                                                                $this->code_base,
                                                                                                                $this->context,
                                                                                                                $arg_node
                                                                                                            );
                                                                                            Severity: Major
                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                      return $this->context->getClassFQSEN()->asType()->asRealUnionType();
                                                                                              Severity: Major
                                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                                return $int_or_string_type;
                                                                                                Severity: Major
                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

                                                                                                                  return self::literalStringUnionType(\ltrim($this->context->getClassFQSEN()->__toString(), '\\'));
                                                                                                  Severity: Major
                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                    Avoid too many return statements within this method.
                                                                                                    Open

                                                                                                                    return $this->typeAfterCastToObject($expr_type);
                                                                                                    Severity: Major
                                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                      Avoid too many return statements within this method.
                                                                                                      Open

                                                                                                                  return Variable::getUnionTypeOfHardcodedGlobalVariableWithName($variable_name);
                                                                                                      Severity: Major
                                                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                        Avoid too many return statements within this method.
                                                                                                        Open

                                                                                                                        return NullType::instance(false)->asRealUnionType()->withIsDefinitelyUndefined();
                                                                                                        Severity: Major
                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                          Avoid too many return statements within this method.
                                                                                                          Open

                                                                                                                  return UnionType::empty();
                                                                                                          Severity: Major
                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                            Avoid too many return statements within this method.
                                                                                                            Open

                                                                                                                        return [];
                                                                                                            Severity: Major
                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                              Avoid too many return statements within this method.
                                                                                                              Open

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

                                                                                                                Avoid too many return statements within this method.
                                                                                                                Open

                                                                                                                            return UnionType::empty();
                                                                                                                Severity: Major
                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this method.
                                                                                                                  Open

                                                                                                                              return [];
                                                                                                                  Severity: Major
                                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this method.
                                                                                                                    Open

                                                                                                                            return (bool)$cond;
                                                                                                                    Severity: Major
                                                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this method.
                                                                                                                      Open

                                                                                                                                  return $result;
                                                                                                                      Severity: Major
                                                                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

                                                                                                                                    return $field_types;
                                                                                                                        Severity: Major
                                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this method.
                                                                                                                          Open

                                                                                                                                  return UnionType::empty();
                                                                                                                          Severity: Major
                                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this method.
                                                                                                                            Open

                                                                                                                                                    return [];
                                                                                                                            Severity: Major
                                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this method.
                                                                                                                              Open

                                                                                                                                              return ArrayType::instance(false)->asRealUnionType();
                                                                                                                              Severity: Major
                                                                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                Open

                                                                                                                                                return VoidType::instance(false)->asRealUnionType();
                                                                                                                                Severity: Major
                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                  Open

                                                                                                                                                  return MixedType::instance(false)->asRealUnionType();
                                                                                                                                  Severity: Major
                                                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                    Open

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

                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                      Open

                                                                                                                                                      return StringType::instance(false)->asRealUnionType();
                                                                                                                                      Severity: Major
                                                                                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                        Open

                                                                                                                                                    return $generic_types;
                                                                                                                                        Severity: Major
                                                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                          Open

                                                                                                                                                          return ObjectType::instance(false)->asRealUnionType();
                                                                                                                                          Severity: Major
                                                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                            Open

                                                                                                                                                    return UnionType::empty();
                                                                                                                                            Severity: Major
                                                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                              Open

                                                                                                                                                              return $class->getParentClassFQSEN();  // may or may not exist.
                                                                                                                                              Severity: Major
                                                                                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                Open

                                                                                                                                                            return [];
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                  Open

                                                                                                                                                              return $false_type;
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                    Open

                                                                                                                                                                return $expr_type->withRealType(ObjectType::instance(false));
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                      Open

                                                                                                                                                              return $element_types;
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                        Open

                                                                                                                                                                    return NullType::instance(false)->asRealUnionType();
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                          Open

                                                                                                                                                                      return $result->applyUnaryPlusOperator();
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                            Open

                                                                                                                                                                                return ($type->isValidNumericOperand() && $type->isValidBitwiseOperand()) || $type instanceof StringType;
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                              Open

                                                                                                                                                                              return UnionType::empty();
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                Open

                                                                                                                                                                        return $union_type;
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                  Open

                                                                                                                                                                          return $result;
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                    Open

                                                                                                                                                                                    return $element_types;
                                                                                                                                                                    Severity: Major
                                                                                                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                      Open

                                                                                                                                                                              return UnionType::of($types, $types);
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                        Open

                                                                                                                                                                                return self::literalStringUnionType('');
                                                                                                                                                                        Severity: Major
                                                                                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                          Open

                                                                                                                                                                                          return ObjectType::instance(false)->asRealUnionType();
                                                                                                                                                                          Severity: Major
                                                                                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                            Open

                                                                                                                                                                                            return StaticType::instance(false)->asRealUnionType();
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                              Open

                                                                                                                                                                                          return $true_type;
                                                                                                                                                                              Severity: Major
                                                                                                                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                Open

                                                                                                                                                                                        return ArrayShapeType::empty(false)->asRealUnionType();
                                                                                                                                                                                Severity: Major
                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                  Open

                                                                                                                                                                                              return $object_type->asRealUnionType();
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                    Open

                                                                                                                                                                                                            return $element_types;
                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                      Open

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

                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                        Open

                                                                                                                                                                                                return $resulting_element_type;
                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                          Open

                                                                                                                                                                                                          return FullyQualifiedClassName::fromFullyQualifiedString($class_name);
                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                            Open

                                                                                                                                                                                                    return [$method->getFQSEN()];
                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                              Open

                                                                                                                                                                                                      return $closure_types;
                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                Open

                                                                                                                                                                                                                return StringType::instance(false)->asPHPDocUnionType();
                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                  Open

                                                                                                                                                                                                                  return IntType::instance(false)->asRealUnionType();
                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                    Open

                                                                                                                                                                                                            return UnionType::of($type_set, $real_type_set);
                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                                      Open

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

                                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                                        Open

                                                                                                                                                                                                                    return $resulting_element_type->withRealTypeSet(
                                                                                                                                                                                                                        \is_object($resulting_real_element_type) ? $resulting_real_element_type->getRealTypeSet() : []
                                                                                                                                                                                                                    );
                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                                          Open

                                                                                                                                                                                                                              return ObjectType::instance(false)->asRealUnionType();
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                                            Open

                                                                                                                                                                                                                        return ObjectType::instance(false)->asRealUnionType();
                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                                              Open

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

                                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                                Open

                                                                                                                                                                                                                            return [];
                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                              return Type::fromType($type, $template_type_list);
                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                return NullType::instance(false)->asRealUnionType();
                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                                  return NullType::instance(false)->asPHPDocUnionType();
                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                    return $class->getMethodByName($this->code_base, '__get')->getUnionType();
                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                                                          Open

                                                                                                                                                                                                                                      return $result->applyUnaryBitwiseNotOperator();
                                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                                                            Open

                                                                                                                                                                                                                                        return $parent_type_option->get()->asRealUnionType();
                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                          return UnionType::empty();
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                        return $union_type;
                                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                                              return $generic_types;
                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                    return NullType::instance(false)->asRealUnionType();
                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                                                              return $type->withIsNullable(true);
                                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                                        return $override_union_type;
                                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                                                                          Open

                                                                                                                                                                                                                                                  return $result;
                                                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                                                                            Open

                                                                                                                                                                                                                                                            return UnionType::empty();
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                                              return self::literalStringUnionType(Config::projectPath($this->context->getFile()));
                                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                return NullType::instance(false)->asRealUnionType();
                                                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                                          return Type::fromObject($node)->asRealUnionType();
                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                  Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                            return $expr_type;
                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                    Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                                                                  return NullType::instance(false)->asPHPDocUnionType();
                                                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                                                      Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                                                        return self::literalIntUnionType($node->lineno);
                                                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                                                        Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                                                                                          Open

                                                                                                                                                                                                                                                                          return self::literalStringUnionType(\ltrim($this->context->getNamespace(), '\\'));
                                                                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                                                                          Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                                                                                            Open

                                                                                                                                                                                                                                                                            return IterableType::instance(false)->asRealUnionType();
                                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                                            Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

                                                                                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                                                              return StringType::instance(false)->asRealUnionType();
                                                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                                                              Found in src/Phan/AST/UnionTypeVisitor.php - About 30 mins to fix

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

                                                                                                                                                                                                                                                                    private function analyzeUnpack(Node $node, bool $is_array_spread): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $union_type = self::unionTypeFromNode(
                                                                                                                                                                                                                                                                            $this->code_base,
                                                                                                                                                                                                                                                                            $this->context,
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 arrayKeyUnionTypeOfUnionType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public static function arrayKeyUnionTypeOfUnionType(UnionType $union_type): ?UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        if ($union_type->isEmpty()) {
                                                                                                                                                                                                                                                                            return null;
                                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 visitNew has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function visitNew(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        static $object_type;
                                                                                                                                                                                                                                                                        if ($object_type === null) {
                                                                                                                                                                                                                                                                            $object_type = ObjectType::instance(false);
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 visitInstanceOf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function visitInstanceOf(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $code_base = $this->code_base;
                                                                                                                                                                                                                                                                        $context = $this->context;
                                                                                                                                                                                                                                                                        // Check to make sure the left side is valid
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 unionTypeFromClassNode() has an NPath complexity of 1020. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public static function unionTypeFromClassNode(
                                                                                                                                                                                                                                                                        CodeBase $code_base,
                                                                                                                                                                                                                                                                        Context $context,
                                                                                                                                                                                                                                                                        $node
                                                                                                                                                                                                                                                                    ): UnionType {
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

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

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

                                                                                                                                                                                                                                                                The method visitArray() has an NPath complexity of 1345. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function visitArray(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $children = $node->children;
                                                                                                                                                                                                                                                                        if (\count($children) > 0) {
                                                                                                                                                                                                                                                                            $key_set = $this->getEquivalentArraySet($node);
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

                                                                                                                                                                                                                                                                    public function visitDim(Node $node, bool $treat_undef_as_nullable = false): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $union_type = self::unionTypeFromNode(
                                                                                                                                                                                                                                                                            $this->code_base,
                                                                                                                                                                                                                                                                            $this->context,
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

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

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

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

                                                                                                                                                                                                                                                                The method visitVar() has an NPath complexity of 139536. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                Open

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

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

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

                                                                                                                                                                                                                                                                The method visitDim() has an NPath complexity of 19976880. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function visitDim(Node $node, bool $treat_undef_as_nullable = false): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $union_type = self::unionTypeFromNode(
                                                                                                                                                                                                                                                                            $this->code_base,
                                                                                                                                                                                                                                                                            $this->context,
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

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

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

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

                                                                                                                                                                                                                                                                The method visitMethodCall() has an NPath complexity of 4374. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function visitMethodCall(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $method_name = $node->children['method'] ?? '';
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                        // Give up on any complicated nonsense where the
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

                                                                                                                                                                                                                                                                    public function visitMethodCall(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $method_name = $node->children['method'] ?? '';
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                        // Give up on any complicated nonsense where the
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                The method methodFQSENListFromObjectAndMethodName() has an NPath complexity of 666. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    private function methodFQSENListFromObjectAndMethodName($class_or_expr, string $method_name): array
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $code_base = $this->code_base;
                                                                                                                                                                                                                                                                        $context = $this->context;
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

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

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

                                                                                                                                                                                                                                                                    private function methodFQSENListFromParts($class_or_expr, $method_name): array
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $code_base = $this->code_base;
                                                                                                                                                                                                                                                                        $context = $this->context;
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

                                                                                                                                                                                                                                                                class UnionTypeVisitor extends AnalysisVisitor
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    /**
                                                                                                                                                                                                                                                                     * If an dynamic unpacked array has more elements than this, then give up on building up the union type
                                                                                                                                                                                                                                                                     */
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                The method visitNew() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function visitNew(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        static $object_type;
                                                                                                                                                                                                                                                                        if ($object_type === null) {
                                                                                                                                                                                                                                                                            $object_type = ObjectType::instance(false);
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

                                                                                                                                                                                                                                                                    public static function unionTypeFromClassNode(
                                                                                                                                                                                                                                                                        CodeBase $code_base,
                                                                                                                                                                                                                                                                        Context $context,
                                                                                                                                                                                                                                                                        $node
                                                                                                                                                                                                                                                                    ): UnionType {
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                The method functionLikeFQSENListFromNode() has an NPath complexity of 420. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    private function functionLikeFQSENListFromNode($node): array
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $orig_node = $node;
                                                                                                                                                                                                                                                                        if ($node instanceof Node) {
                                                                                                                                                                                                                                                                            $node = (new ContextNode($this->code_base, $this->context, $node))->getEquivalentPHPValue();
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

                                                                                                                                                                                                                                                                The method resolveArrayShapeElementTypesForOffset() has an NPath complexity of 14112. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public static function resolveArrayShapeElementTypesForOffset(UnionType $union_type, $dim_value, bool $is_computing_real_type_set = false)
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        /**
                                                                                                                                                                                                                                                                         * @var bool $has_non_array_shape_type this will be true if there are types that support array access
                                                                                                                                                                                                                                                                         *           but have unknown array shapes in $union_type
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                NPathComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

                                                                                                                                                                                                                                                                    private function arrayTypeFromRealTypeBuilder(?UnionTypeBuilder $builder, Node $node, bool $has_key): array
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        // Here, we only check for the real type being an integer.
                                                                                                                                                                                                                                                                        // Unknown strings such as '0' will cast to integers when used as array keys,
                                                                                                                                                                                                                                                                        // and if we knew all of the array keys were literals we would have generated an array shape instead.
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 analyzeProp() has a Cyclomatic Complexity of 26. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

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

                                                                                                                                                                                                                                                                CyclomaticComplexity

                                                                                                                                                                                                                                                                Since: 0.1

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

                                                                                                                                                                                                                                                                Example

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

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

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

                                                                                                                                                                                                                                                                    public function visitMethodCall(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $method_name = $node->children['method'] ?? '';
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                        // Give up on any complicated nonsense where the
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 getPackedArrayFieldTypes() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    private function getPackedArrayFieldTypes($expr): ?array
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        if (!$expr instanceof Node) {
                                                                                                                                                                                                                                                                            // TODO: Warn if non-array
                                                                                                                                                                                                                                                                            return null;
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 visitArray() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function visitArray(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $children = $node->children;
                                                                                                                                                                                                                                                                        if (\count($children) > 0) {
                                                                                                                                                                                                                                                                            $key_set = $this->getEquivalentArraySet($node);
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

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

                                                                                                                                                                                                                                                                    public function visitClassName(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $class_node = $node->children['class'];
                                                                                                                                                                                                                                                                        try {
                                                                                                                                                                                                                                                                            $class_list = (new ContextNode(
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 visitTypeUnion() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function visitTypeUnion(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        // TODO: Validate that there aren't any duplicates
                                                                                                                                                                                                                                                                        if (\count($node->children) === 1) {
                                                                                                                                                                                                                                                                            // Might be possible due to the polyfill in the future.
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 visitType() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function visitType(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        switch ($node->flags) {
                                                                                                                                                                                                                                                                            case \ast\flags\TYPE_ARRAY:
                                                                                                                                                                                                                                                                                return ArrayType::instance(false)->asRealUnionType();
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 visitConditional() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

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

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

                                                                                                                                                                                                                                                                    public function visitDim(Node $node, bool $treat_undef_as_nullable = false): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $union_type = self::unionTypeFromNode(
                                                                                                                                                                                                                                                                            $this->code_base,
                                                                                                                                                                                                                                                                            $this->context,
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 unionTypeFromClassNode() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public static function unionTypeFromClassNode(
                                                                                                                                                                                                                                                                        CodeBase $code_base,
                                                                                                                                                                                                                                                                        Context $context,
                                                                                                                                                                                                                                                                        $node
                                                                                                                                                                                                                                                                    ): UnionType {
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 methodFQSENListFromObjectAndMethodName() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    private function methodFQSENListFromObjectAndMethodName($class_or_expr, string $method_name): array
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $code_base = $this->code_base;
                                                                                                                                                                                                                                                                        $context = $this->context;
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 functionLikeFQSENListFromNode() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    private function functionLikeFQSENListFromNode($node): array
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $orig_node = $node;
                                                                                                                                                                                                                                                                        if ($node instanceof Node) {
                                                                                                                                                                                                                                                                            $node = (new ContextNode($this->code_base, $this->context, $node))->getEquivalentPHPValue();
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

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

                                                                                                                                                                                                                                                                    public function visitMagicConst(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $flags = $node->flags;
                                                                                                                                                                                                                                                                        switch ($flags) {
                                                                                                                                                                                                                                                                            case ast\flags\MAGIC_CLASS:
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 fromTypeInSignature() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    public function fromTypeInSignature(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $is_nullable = $node->kind === ast\AST_NULLABLE_TYPE;
                                                                                                                                                                                                                                                                        if ($is_nullable) {
                                                                                                                                                                                                                                                                            $node = $node->children['type'];
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 methodFQSENListFromParts() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    private function methodFQSENListFromParts($class_or_expr, $method_name): array
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $code_base = $this->code_base;
                                                                                                                                                                                                                                                                        $context = $this->context;
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

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

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

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

                                                                                                                                                                                                                                                                    public static function resolveArrayShapeElementTypesForOffset(UnionType $union_type, $dim_value, bool $is_computing_real_type_set = false)
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        /**
                                                                                                                                                                                                                                                                         * @var bool $has_non_array_shape_type this will be true if there are types that support array access
                                                                                                                                                                                                                                                                         *           but have unknown array shapes in $union_type
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 checkInvalidUnpackKeyType() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    private function checkInvalidUnpackKeyType(Node $node, UnionType $union_type, bool $is_array_spread): void
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $is_invalid_because_associative = false;
                                                                                                                                                                                                                                                                        if (!$is_array_spread) {
                                                                                                                                                                                                                                                                            foreach ($union_type->getTypeSet() as $type) {
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 visitVar() has a Cyclomatic Complexity of 27. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

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

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

                                                                                                                                                                                                                                                                    private function classTypesForNonName(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $node_type = UnionTypeVisitor::unionTypeFromNode(
                                                                                                                                                                                                                                                                            $this->code_base,
                                                                                                                                                                                                                                                                            $this->context,
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 checkIsValidStringOffset() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                    private function checkIsValidStringOffset(UnionType $union_type, Node $node, UnionType $dim_type): void
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        $max_len = -1;
                                                                                                                                                                                                                                                                        foreach ($union_type->getRealTypeSet() as $type) {
                                                                                                                                                                                                                                                                            if ($type instanceof StringType) {
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 UnionTypeVisitor has a coupling between objects value of 68. Consider to reduce the number of dependencies under 13.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                class UnionTypeVisitor extends AnalysisVisitor
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    /**
                                                                                                                                                                                                                                                                     * If an dynamic unpacked array has more elements than this, then give up on building up the union type
                                                                                                                                                                                                                                                                     */
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.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 visitMethodCall.
                                                                                                                                                                                                                                                                Open

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

                                                                                                                                                                                                                                                                EmptyCatchBlock

                                                                                                                                                                                                                                                                Since: 2.7.0

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

                                                                                                                                                                                                                                                                Example

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

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

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

                                                                                                                                                                                                                                                                    public function visitClosure(Node $node): UnionType
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        // The type of a closure is the fqsen pointing
                                                                                                                                                                                                                                                                        // at its definition
                                                                                                                                                                                                                                                                        $closure_fqsen =
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php and 1 other location - About 30 mins to fix
                                                                                                                                                                                                                                                                src/Phan/AST/FallbackUnionTypeVisitor.php on lines 481..501

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

                                                                                                                                                                                                                                                                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

                                                                                                                                                                                                                                                                Avoid variables with short names like $i. Configured minimum length is 3.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                            $i = 0;
                                                                                                                                                                                                                                                                Severity: Minor
                                                                                                                                                                                                                                                                Found in src/Phan/AST/UnionTypeVisitor.php by phpmd

                                                                                                                                                                                                                                                                ShortVariable

                                                                                                                                                                                                                                                                Since: 0.2

                                                                                                                                                                                                                                                                Detects when a field, local, or parameter has a very short name.

                                                                                                                                                                                                                                                                Example

                                                                                                                                                                                                                                                                class Something {
                                                                                                                                                                                                                                                                    private $q = 15; // VIOLATION - Field
                                                                                                                                                                                                                                                                    public static function main( array $as ) { // VIOLATION - Formal
                                                                                                                                                                                                                                                                        $r = 20 + $this->q; // VIOLATION - Local
                                                                                                                                                                                                                                                                        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                                                                                                                                                                                                            $r += $this->q;
                                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                }

                                                                                                                                                                                                                                                                Source https://phpmd.org/rules/naming.html#shortvariable

                                                                                                                                                                                                                                                                There are no issues that match your filters.

                                                                                                                                                                                                                                                                Category
                                                                                                                                                                                                                                                                Status