src/Phan/Plugin/Internal/DependencyGraphPlugin.php

Summary

Maintainability
F
1 wk
Test Coverage

Function processGraph has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
Open

    public function processGraph(array $cached_graph = null): void
    {
        $cmd  = $_ENV['PDEP_CMD'];
        $mode = $_ENV['PDEP_MODE'];
        $this->depth = (int)$_ENV['PDEP_DEPTH'];
Severity: Minor
Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.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

File DependencyGraphPlugin.php has 570 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Phan\Plugin\Internal;
Severity: Major
Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 1 day to fix

    Function finalizeProcess has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        public function finalizeProcess(CodeBase $code_base): void
        {
            if (empty($this->elements)) {
                \fwrite(\STDERR, "Nothing to analyze - please run pdep from your top-level project directory" . \PHP_EOL);
                exit(\EXIT_FAILURE);
    Severity: Minor
    Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.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

    Method processGraph has 113 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function processGraph(array $cached_graph = null): void
        {
            $cmd  = $_ENV['PDEP_CMD'];
            $mode = $_ENV['PDEP_MODE'];
            $this->depth = (int)$_ENV['PDEP_DEPTH'];
    Severity: Major
    Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 4 hrs to fix

      Function dumpClassDot has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          private function dumpClassDot(string $title, array $graph = null): void
          {
              if (!$graph) {
                  $graph = $this->cgraph;
              }
      Severity: Minor
      Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.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 dumpGraphML has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function dumpGraphML(string $title, array $graph, bool $is_classgraph, bool $hide_labels): void
          {
              $node_id = 0;
              $edge_id = 0;
      
      
      Severity: Major
      Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 4 hrs to fix

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

        class DependencyGraphPlugin extends PluginV3 implements
            AnalyzeClassCapability,
            PostAnalyzeNodeCapability,
            FinalizeProcessCapability
        {

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

            private function dumpGraphML(string $title, array $graph, bool $is_classgraph, bool $hide_labels): void
            {
                $node_id = 0;
                $edge_id = 0;
        
        
        Severity: Minor
        Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.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 printGraph has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            private function printGraph(array $graph): void
            {
                foreach ($graph as $k => $v) {
                    echo "$k\n";
                    foreach ($v as $kk => $vv) {
        Severity: Minor
        Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.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 finalizeProcess has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function finalizeProcess(CodeBase $code_base): void
            {
                if (empty($this->elements)) {
                    \fwrite(\STDERR, "Nothing to analyze - please run pdep from your top-level project directory" . \PHP_EOL);
                    exit(\EXIT_FAILURE);
        Severity: Major
        Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 2 hrs to fix

          Method dumpClassDot has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function dumpClassDot(string $title, array $graph = null): void
              {
                  if (!$graph) {
                      $graph = $this->cgraph;
                  }
          Severity: Major
          Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 2 hrs to fix

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

                private function dumpFileDot(string $title, array $graph = null): void
                {
                    if (!$graph) {
                        $graph = $this->fgraph;
                    }
            Severity: Minor
            Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.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 printGraph has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function printGraph(array $graph): void
                {
                    foreach ($graph as $k => $v) {
                        echo "$k\n";
                        foreach ($v as $kk => $vv) {
            Severity: Minor
            Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 1 hr to fix

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

                  private function dumpFileDot(string $title, array $graph = null): void
                  {
                      if (!$graph) {
                          $graph = $this->fgraph;
                      }
              Severity: Minor
              Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 1 hr to fix

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

                    private function walkcGraph(array $newgraph, string $node, int $depth = 0): array
                    {
                        static $i = 0;
                        static $visited = [];
                
                
                Severity: Minor
                Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 45 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

                Avoid deeply nested control flow statements.
                Open

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

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

                      private function dumpGraphML(string $title, array $graph, bool $is_classgraph, bool $hide_labels): void
                      {
                          $node_id = 0;
                          $edge_id = 0;
                  
                  

                  The method dumpClassDot() has an NPath complexity of 310. The configured NPath complexity threshold is 200.
                  Open

                      private function dumpClassDot(string $title, array $graph = null): void
                      {
                          if (!$graph) {
                              $graph = $this->cgraph;
                          }

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

                      public function processGraph(array $cached_graph = null): void
                      {
                          $cmd  = $_ENV['PDEP_CMD'];
                          $mode = $_ENV['PDEP_MODE'];
                          $this->depth = (int)$_ENV['PDEP_DEPTH'];

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

                      public function processGraph(array $cached_graph = null): void
                      {
                          $cmd  = $_ENV['PDEP_CMD'];
                          $mode = $_ENV['PDEP_MODE'];
                          $this->depth = (int)$_ENV['PDEP_DEPTH'];

                  The method finalizeProcess() has an NPath complexity of 1924. The configured NPath complexity threshold is 200.
                  Open

                      public function finalizeProcess(CodeBase $code_base): void
                      {
                          if (empty($this->elements)) {
                              \fwrite(\STDERR, "Nothing to analyze - please run pdep from your top-level project directory" . \PHP_EOL);
                              exit(\EXIT_FAILURE);

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

                      private function dumpClassDot(string $title, array $graph = null): void
                      {
                          if (!$graph) {
                              $graph = $this->cgraph;
                          }

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

                      private function dumpGraphML(string $title, array $graph, bool $is_classgraph, bool $hide_labels): void
                      {
                          $node_id = 0;
                          $edge_id = 0;
                  
                  

                  CyclomaticComplexity

                  Since: 0.1

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

                  Example

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

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

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

                      public function finalizeProcess(CodeBase $code_base): void
                      {
                          if (empty($this->elements)) {
                              \fwrite(\STDERR, "Nothing to analyze - please run pdep from your top-level project directory" . \PHP_EOL);
                              exit(\EXIT_FAILURE);

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

                      private function printGraph(array $graph): void
                      {
                          foreach ($graph as $k => $v) {
                              echo "$k\n";
                              foreach ($v as $kk => $vv) {

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

                      public function processGraph(array $cached_graph = null): void
                      {
                          $cmd  = $_ENV['PDEP_CMD'];
                          $mode = $_ENV['PDEP_MODE'];
                          $this->depth = (int)$_ENV['PDEP_DEPTH'];

                  CyclomaticComplexity

                  Since: 0.1

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

                  Example

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

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

                  The method finalizeProcess() contains an exit expression.
                  Open

                              exit(\EXIT_FAILURE);

                  ExitExpression

                  Since: 0.2

                  An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                  Example

                  class Foo {
                      public function bar($param)  {
                          if ($param === 42) {
                              exit(23);
                          }
                      }
                  }

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

                  The method processGraph() contains an exit expression.
                  Open

                                          exit(\EXIT_FAILURE);

                  ExitExpression

                  Since: 0.2

                  An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                  Example

                  class Foo {
                      public function bar($param)  {
                          if ($param === 42) {
                              exit(23);
                          }
                      }
                  }

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

                  The method processGraph() contains an exit expression.
                  Open

                                          exit(\EXIT_FAILURE);

                  ExitExpression

                  Since: 0.2

                  An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                  Example

                  class Foo {
                      public function bar($param)  {
                          if ($param === 42) {
                              exit(23);
                          }
                      }
                  }

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

                  The method processGraph() contains an exit expression.
                  Open

                                          exit(\EXIT_FAILURE);

                  ExitExpression

                  Since: 0.2

                  An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                  Example

                  class Foo {
                      public function bar($param)  {
                          if ($param === 42) {
                              exit(23);
                          }
                      }
                  }

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

                  The method processGraph() contains an exit expression.
                  Open

                          exit(\EXIT_SUCCESS);

                  ExitExpression

                  Since: 0.2

                  An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                  Example

                  class Foo {
                      public function bar($param)  {
                          if ($param === 42) {
                              exit(23);
                          }
                      }
                  }

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

                  The method processGraph() contains an exit expression.
                  Open

                                              exit(\EXIT_FAILURE);

                  ExitExpression

                  Since: 0.2

                  An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                  Example

                  class Foo {
                      public function bar($param)  {
                          if ($param === 42) {
                              exit(23);
                          }
                      }
                  }

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

                  The method processGraph() contains an exit expression.
                  Open

                                              exit(\EXIT_FAILURE);

                  ExitExpression

                  Since: 0.2

                  An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                  Example

                  class Foo {
                      public function bar($param)  {
                          if ($param === 42) {
                              exit(23);
                          }
                      }
                  }

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

                  The method processGraph() contains an exit expression.
                  Open

                                              exit(\EXIT_FAILURE);

                  ExitExpression

                  Since: 0.2

                  An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                  Example

                  class Foo {
                      public function bar($param)  {
                          if ($param === 42) {
                              exit(23);
                          }
                      }
                  }

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

                  The method processGraph() utilizes a goto statement.
                  Open

                                                      goto cfound;

                  GotoStatement

                  Since: 1.1.0

                  Goto makes code harder to read and it is nearly impossible to understand the control flow of an application that uses this language construct. Therefore it should be avoided. Consider to replace Goto with regular control structures and separate methods/function, which are easier to read.

                  Example

                  class Foo {
                      public function bar($param)  {
                          A:
                          if ($param === 42) {
                              goto X;
                          }
                          Y:
                          if (time() % 42 === 23) {
                              goto Z;
                          }
                          X:
                          if (time() % 23 === 42) {
                              goto Y;
                          }
                          Z:
                          return 42;
                      }
                  }

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

                  The method processGraph() utilizes a goto statement.
                  Open

                                                  goto ffound;

                  GotoStatement

                  Since: 1.1.0

                  Goto makes code harder to read and it is nearly impossible to understand the control flow of an application that uses this language construct. Therefore it should be avoided. Consider to replace Goto with regular control structures and separate methods/function, which are easier to read.

                  Example

                  class Foo {
                      public function bar($param)  {
                          A:
                          if ($param === 42) {
                              goto X;
                          }
                          Y:
                          if (time() % 42 === 23) {
                              goto Z;
                          }
                          X:
                          if (time() % 23 === 42) {
                              goto Y;
                          }
                          Z:
                          return 42;
                      }
                  }

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

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

                      public function visitStaticCall(Node $node): void
                      {
                          $context = $this->context;
                          try {
                              $class_fqsen = $context->getClassFQSEN();
                  Severity: Major
                  Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php and 1 other location - About 5 hrs to fix
                  src/Phan/Plugin/Internal/DependencyGraphPlugin.php on lines 654..676

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                      public function visitClassConst(Node $node): void
                      {
                          $context = $this->context;
                          try {
                              $class_fqsen = $context->getClassFQSEN();
                  Severity: Major
                  Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php and 1 other location - About 5 hrs to fix
                  src/Phan/Plugin/Internal/DependencyGraphPlugin.php on lines 682..703

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                              if (empty($shape_defined[$node])) {
                                  $shape = "";
                                  switch ($this->ctype[$node]) {
                                      case 'C':
                                          $shape = "shape=box";
                  Severity: Major
                  Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php and 1 other location - About 1 hr to fix
                  src/Phan/Plugin/Internal/DependencyGraphPlugin.php on lines 491..510

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                                  if (empty($shape_defined[$dnode])) {
                                      $shape = "";
                                      switch ($this->ctype[$dnode]) {
                                          case 'C':
                                              $shape = "shape=box";
                  Severity: Major
                  Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php and 1 other location - About 1 hr to fix
                  src/Phan/Plugin/Internal/DependencyGraphPlugin.php on lines 461..480

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                                          if (!\array_key_exists($v, $this->file_to_class)) {
                                              // Probably no lineno specified, do a linear search
                                              foreach ($this->file_to_class as $fi => $cl) {
                                                  $file = self::getFileLineno((string)$fi)[0];
                                                  if ($file == $v) {
                  Severity: Minor
                  Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php and 1 other location - About 1 hr to fix
                  src/Phan/Plugin/Internal/DependencyGraphPlugin.php on lines 359..370

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                                      if (!\array_key_exists($v, $this->file_to_class)) {
                                          // Probably no lineno specified, do a linear search
                                          foreach ($this->file_to_class as $fi => $cl) {
                                              $file = self::getFileLineno((string)$fi)[0];
                                              if ($file == $v) {
                  Severity: Minor
                  Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php and 1 other location - About 1 hr to fix
                  src/Phan/Plugin/Internal/DependencyGraphPlugin.php on lines 316..327

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

                  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 $t. Configured minimum length is 3.
                  Open

                                  [$t,$lineno] = self::getFileLineno($vv);

                  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 $i. Configured minimum length is 3.
                  Open

                          static $i = 0;

                  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 $i. Configured minimum length is 3.
                  Open

                          static $i = 0;

                  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