src/Phan/Parse/ParseVisitor.php

Summary

Maintainability
F
1 wk
Test Coverage

The method ParseVisitor::visitPropGroup() calls the typical debug function print_r() which is mostly only used during development.
Open

                    . \print_r($property_name, true)
Severity: Minor
Found in src/Phan/Parse/ParseVisitor.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

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

File ParseVisitor.php has 1166 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Phan\Parse;
Severity: Major
Found in src/Phan/Parse/ParseVisitor.php - About 3 days to fix

    Function addProperty has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
    Open

        private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
        {
            $variable_has_literals = $variable && $variable->getUnionType()->hasLiterals();
    
            // If something goes wrong will getting the type of
    Severity: Minor
    Found in src/Phan/Parse/ParseVisitor.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

    Method addProperty has 165 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
        {
            $variable_has_literals = $variable && $variable->getUnionType()->hasLiterals();
    
            // If something goes wrong will getting the type of
    Severity: Major
    Found in src/Phan/Parse/ParseVisitor.php - About 6 hrs to fix

      ParseVisitor has 44 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ParseVisitor extends ScopeVisitor
      {
      
          /**
           * @param Context $context
      Severity: Minor
      Found in src/Phan/Parse/ParseVisitor.php - About 6 hrs to fix

        Method visitClass has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function visitClass(Node $node): Context
            {
                if ($node->flags & \ast\flags\CLASS_ANONYMOUS) {
                    $class_name = (new ContextNode(
                        $this->code_base,
        Severity: Major
        Found in src/Phan/Parse/ParseVisitor.php - About 3 hrs to fix

          Method visitClassConstDecl has 91 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function visitClassConstDecl(Node $node): Context
              {
                  $class = $this->getContextClass();
          
                  foreach ($node->children as $child_node) {
          Severity: Major
          Found in src/Phan/Parse/ParseVisitor.php - About 3 hrs to fix

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

            class ParseVisitor extends ScopeVisitor
            {
            
                /**
                 * @param Context $context
            Severity: Minor
            Found in src/Phan/Parse/ParseVisitor.php by phpmd

            The class ParseVisitor has 32 public methods. Consider refactoring ParseVisitor to keep number of public methods under 10.
            Open

            class ParseVisitor extends ScopeVisitor
            {
            
                /**
                 * @param Context $context
            Severity: Minor
            Found in src/Phan/Parse/ParseVisitor.php by phpmd

            TooManyPublicMethods

            Since: 0.1

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

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

            Example

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

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

            class ParseVisitor extends ScopeVisitor
            {
            
                /**
                 * @param Context $context
            Severity: Minor
            Found in src/Phan/Parse/ParseVisitor.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

            Method addConstant has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function addConstant(
                    CodeBase $code_base,
                    Context $context,
                    int $lineno,
                    string $name,
            Severity: Major
            Found in src/Phan/Parse/ParseVisitor.php - About 3 hrs to fix

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

                  public function visitClassConstDecl(Node $node): Context
                  {
                      $class = $this->getContextClass();
              
                      foreach ($node->children as $child_node) {
              Severity: Minor
              Found in src/Phan/Parse/ParseVisitor.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 visitDim has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function visitDim(Node $node): Context
                  {
                      if (!Config::get_backward_compatibility_checks()) {
                          return $this->context;
                      }
              Severity: Minor
              Found in src/Phan/Parse/ParseVisitor.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 visitCall has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function visitCall(Node $node): Context
                  {
                      // If this is a call to a method that indicates that we
                      // are treating the method in scope as a varargs method,
                      // then set its optional args to something very high so
              Severity: Minor
              Found in src/Phan/Parse/ParseVisitor.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 visitMethod has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function visitMethod(Node $node): Context
                  {
                      // Bomb out if we're not in a class context
                      $class = $this->getContextClass();
                      $context = $this->context;
              Severity: Minor
              Found in src/Phan/Parse/ParseVisitor.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 visitPropGroup has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function visitPropGroup(Node $node): Context
                  {
                      // Bomb out if we're not in a class context
                      ['props' => $props_node, 'type' => $type_node] = $node->children;
                      if (!$props_node instanceof Node) {
              Severity: Major
              Found in src/Phan/Parse/ParseVisitor.php - About 2 hrs to fix

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

                    public function visitDim(Node $node): Context
                    {
                        if (!Config::get_backward_compatibility_checks()) {
                            return $this->context;
                        }
                Severity: Major
                Found in src/Phan/Parse/ParseVisitor.php - About 2 hrs to fix

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

                      public function visitPropGroup(Node $node): Context
                      {
                          // Bomb out if we're not in a class context
                          ['props' => $props_node, 'type' => $type_node] = $node->children;
                          if (!$props_node instanceof Node) {
                  Severity: Minor
                  Found in src/Phan/Parse/ParseVisitor.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 visitMethod has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function visitMethod(Node $node): Context
                      {
                          // Bomb out if we're not in a class context
                          $class = $this->getContextClass();
                          $context = $this->context;
                  Severity: Minor
                  Found in src/Phan/Parse/ParseVisitor.php - About 1 hr to fix

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

                        public static function addConstant(
                            CodeBase $code_base,
                            Context $context,
                            int $lineno,
                            string $name,
                    Severity: Minor
                    Found in src/Phan/Parse/ParseVisitor.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 addPromotedConstructorPropertyFromParam has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function addPromotedConstructorPropertyFromParam(
                            Clazz $class,
                            Method $method,
                            Parameter $parameter,
                            Node $parameter_node
                    Severity: Minor
                    Found in src/Phan/Parse/ParseVisitor.php - About 1 hr to fix

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

                          public function visitClass(Node $node): Context
                          {
                              if ($node->flags & \ast\flags\CLASS_ANONYMOUS) {
                                  $class_name = (new ContextNode(
                                      $this->code_base,
                      Severity: Minor
                      Found in src/Phan/Parse/ParseVisitor.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 visitStaticCall has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function visitStaticCall(Node $node): Context
                          {
                              $call = $node->children['class'];
                      
                              if ($call instanceof Node && $call->kind === \ast\AST_NAME) {
                      Severity: Minor
                      Found in src/Phan/Parse/ParseVisitor.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 visitFuncDecl has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function visitFuncDecl(Node $node): Context
                          {
                              $function_name = (string)$node->children['name'];
                              $context = $this->context;
                              $code_base = $this->code_base;
                      Severity: Minor
                      Found in src/Phan/Parse/ParseVisitor.php - About 1 hr to fix

                        Method addConstant has 9 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                CodeBase $code_base,
                                Context $context,
                                int $lineno,
                                string $name,
                                $value,
                        Severity: Major
                        Found in src/Phan/Parse/ParseVisitor.php - About 1 hr to fix

                          Method addProperty has 9 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
                          Severity: Major
                          Found in src/Phan/Parse/ParseVisitor.php - About 1 hr to fix

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

                                public function visitCall(Node $node): Context
                                {
                                    // If this is a call to a method that indicates that we
                                    // are treating the method in scope as a varargs method,
                                    // then set its optional args to something very high so
                            Severity: Minor
                            Found in src/Phan/Parse/ParseVisitor.php - About 1 hr to fix

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

                                  private function analyzeDefine(Node $node): void
                                  {
                                      $args = $node->children['args'];
                                      if (\count($args->children) < 2) {
                                          return;
                              Severity: Minor
                              Found in src/Phan/Parse/ParseVisitor.php - About 1 hr to fix

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

                                    public function visitConstDecl(Node $node): Context
                                    {
                                        foreach ($node->children as $child_node) {
                                            if (!$child_node instanceof Node) {
                                                throw new AssertionError("Expected global constant element to be a Node");
                                Severity: Minor
                                Found in src/Phan/Parse/ParseVisitor.php - About 1 hr to fix

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

                                      public function visitFuncDecl(Node $node): Context
                                      {
                                          $function_name = (string)$node->children['name'];
                                          $context = $this->context;
                                          $code_base = $this->code_base;
                                  Severity: Minor
                                  Found in src/Phan/Parse/ParseVisitor.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 $this->context;
                                  Severity: Major
                                  Found in src/Phan/Parse/ParseVisitor.php - About 30 mins to fix

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

                                        private function addPromotedConstructorPropertyFromParam(
                                            Clazz $class,
                                            Method $method,
                                            Parameter $parameter,
                                            Node $parameter_node
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 visitConstDecl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        public function visitConstDecl(Node $node): Context
                                        {
                                            foreach ($node->children as $child_node) {
                                                if (!$child_node instanceof Node) {
                                                    throw new AssertionError("Expected global constant element to be a Node");
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 class ParseVisitor has 1705 lines of code. Current threshold is 1000. Avoid really long classes.
                                    Open

                                    class ParseVisitor extends ScopeVisitor
                                    {
                                    
                                        /**
                                         * @param Context $context
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.php by phpmd

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

                                        public function visitClass(Node $node): Context
                                        {
                                            if ($node->flags & \ast\flags\CLASS_ANONYMOUS) {
                                                $class_name = (new ContextNode(
                                                    $this->code_base,
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.php by phpmd

                                    The method visitClass() has an NPath complexity of 400. The configured NPath complexity threshold is 200.
                                    Open

                                        public function visitClass(Node $node): Context
                                        {
                                            if ($node->flags & \ast\flags\CLASS_ANONYMOUS) {
                                                $class_name = (new ContextNode(
                                                    $this->code_base,
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 addProperty() has an NPath complexity of 1709696. The configured NPath complexity threshold is 200.
                                    Open

                                        private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
                                        {
                                            $variable_has_literals = $variable && $variable->getUnionType()->hasLiterals();
                                    
                                            // If something goes wrong will getting the type of
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 visitClassConstDecl() has 108 lines of code. Current threshold is set to 100. Avoid really long methods.
                                    Open

                                        public function visitClassConstDecl(Node $node): Context
                                        {
                                            $class = $this->getContextClass();
                                    
                                            foreach ($node->children as $child_node) {
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.php by phpmd

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

                                        private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
                                        {
                                            $variable_has_literals = $variable && $variable->getUnionType()->hasLiterals();
                                    
                                            // If something goes wrong will getting the type of
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.php by phpmd

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

                                        public static function addConstant(
                                            CodeBase $code_base,
                                            Context $context,
                                            int $lineno,
                                            string $name,
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.php by phpmd

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

                                        public function visitClassConstDecl(Node $node): Context
                                        {
                                            $class = $this->getContextClass();
                                    
                                            foreach ($node->children as $child_node) {
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 visitPropGroup() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                    Open

                                        public function visitPropGroup(Node $node): Context
                                        {
                                            // Bomb out if we're not in a class context
                                            ['props' => $props_node, 'type' => $type_node] = $node->children;
                                            if (!$props_node instanceof Node) {
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 16. The configured cyclomatic complexity threshold is 10.
                                    Open

                                        public function visitDim(Node $node): Context
                                        {
                                            if (!Config::get_backward_compatibility_checks()) {
                                                return $this->context;
                                            }
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 visitMethod() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                    Open

                                        public function visitMethod(Node $node): Context
                                        {
                                            // Bomb out if we're not in a class context
                                            $class = $this->getContextClass();
                                            $context = $this->context;
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 visitCall() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                    Open

                                        public function visitCall(Node $node): Context
                                        {
                                            // If this is a call to a method that indicates that we
                                            // are treating the method in scope as a varargs method,
                                            // then set its optional args to something very high so
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 addProperty() has a Cyclomatic Complexity of 35. The configured cyclomatic complexity threshold is 10.
                                    Open

                                        private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
                                        {
                                            $variable_has_literals = $variable && $variable->getUnionType()->hasLiterals();
                                    
                                            // If something goes wrong will getting the type of
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 visitClass() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                    Open

                                        public function visitClass(Node $node): Context
                                        {
                                            if ($node->flags & \ast\flags\CLASS_ANONYMOUS) {
                                                $class_name = (new ContextNode(
                                                    $this->code_base,
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 ParseVisitor has a coupling between objects value of 43. Consider to reduce the number of dependencies under 13.
                                    Open

                                    class ParseVisitor extends ScopeVisitor
                                    {
                                    
                                        /**
                                         * @param Context $context
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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 variables with short names like $i. Configured minimum length is 3.
                                    Open

                                            $i = \strrpos($name, '\\');
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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

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

                                        public static function checkIsAllowedInConstExpr($n): void
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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

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

                                        public static function isNonVariableExpr($n): bool
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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

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

                                        private static function checkIsNonVariableExpression($n): void
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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

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

                                        public static function isConstExpr($n): bool
                                    Severity: Minor
                                    Found in src/Phan/Parse/ParseVisitor.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