src/Phan/CodeBase.php

Summary

Maintainability
F
1 wk
Test Coverage

File CodeBase.php has 1377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

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

    CodeBase has 110 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CodeBase
    {
        /**
         * @var Map<FullyQualifiedClassName,Clazz>
         * A map from FQSEN to an internal or user defined class
    Severity: Major
    Found in src/Phan/CodeBase.php - About 2 days to fix

      Function hasInternalFunctionWithFQSEN has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          private function hasInternalFunctionWithFQSEN(
              FullyQualifiedFunctionName $fqsen
          ): bool {
              $canonical_fqsen = $fqsen->withAlternateId(0);
              $found = isset($this->internal_function_fqsen_set[$canonical_fqsen]);
      Severity: Minor
      Found in src/Phan/CodeBase.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

      The class CodeBase has 37 public methods. Consider refactoring CodeBase to keep number of public methods under 10.
      Open

      class CodeBase
      {
          /**
           * @var Map<FullyQualifiedClassName,Clazz>
           * A map from FQSEN to an internal or user defined class
      Severity: Minor
      Found in src/Phan/CodeBase.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 CodeBase has an overall complexity of 276 which is very high. The configured complexity threshold is 50.
      Open

      class CodeBase
      {
          /**
           * @var Map<FullyQualifiedClassName,Clazz>
           * A map from FQSEN to an internal or user defined class
      Severity: Minor
      Found in src/Phan/CodeBase.php by phpmd

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

      class CodeBase
      {
          /**
           * @var Map<FullyQualifiedClassName,Clazz>
           * A map from FQSEN to an internal or user defined class
      Severity: Minor
      Found in src/Phan/CodeBase.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

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

          private function addGlobalConstantsByNames(array $const_name_list): void
          {
              $included_extension_subset = self::getIncludedExtensionSubset();
              if (is_array($included_extension_subset)) {
                  $excluded_constant_set = [];
      Severity: Minor
      Found in src/Phan/CodeBase.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 hasInternalFunctionWithFQSEN has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function hasInternalFunctionWithFQSEN(
              FullyQualifiedFunctionName $fqsen
          ): bool {
              $canonical_fqsen = $fqsen->withAlternateId(0);
              $found = isset($this->internal_function_fqsen_set[$canonical_fqsen]);
      Severity: Major
      Found in src/Phan/CodeBase.php - About 2 hrs to fix

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

            public function createRestorePoint(): array
            {
                // Create a deep copy of this CodeBase
                $clone = clone($this);
                // make a deep copy of the NamespaceMapEntry objects within parsed_namespace_maps
        Severity: Minor
        Found in src/Phan/CodeBase.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 addInternalFunctionsByNames has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            private function addInternalFunctionsByNames(array $internal_function_name_list): void
            {
                $included_extension_subset = self::getIncludedExtensionSubset();
                if (is_array($included_extension_subset)) {
                    $forbidden_function_set = [];
        Severity: Minor
        Found in src/Phan/CodeBase.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 exportFunctionAndMethodSet has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function exportFunctionAndMethodSet(): array
            {
                $result = [];
                foreach ($this->getFunctionAndMethodSet() as $function_or_method) {
                    if ($function_or_method->isPHPInternal()) {
        Severity: Minor
        Found in src/Phan/CodeBase.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 resolveClassAliasesForAliasSet has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function resolveClassAliasesForAliasSet(FullyQualifiedClassName $original_fqsen, Set $alias_set): void
            {
                if (!$this->hasClassWithFQSEN($original_fqsen)) {
                    // The original class does not exist.
                    // Emit issues at the point of every single class_alias call with that original class.
        Severity: Minor
        Found in src/Phan/CodeBase.php - About 1 hr to fix

          The class CodeBase has 27 fields. Consider redesigning CodeBase to keep the number of fields under 15.
          Open

          class CodeBase
          {
              /**
               * @var Map<FullyQualifiedClassName,Clazz>
               * A map from FQSEN to an internal or user defined class
          Severity: Minor
          Found in src/Phan/CodeBase.php by phpmd

          TooManyFields

          Since: 0.1

          Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

          Example

          class Person {
             protected $one;
             private $two;
             private $three;
             [... many more fields ...]
          }

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

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

              public function suggestSimilarGlobalFunctionInNewerVersion(
                  string $namespace,
                  string $function_name,
                  Context $context,
                  bool $suggest_in_global_namespace
          Severity: Minor
          Found in src/Phan/CodeBase.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 resolveClassAliasesForAliasSet has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              private function resolveClassAliasesForAliasSet(FullyQualifiedClassName $original_fqsen, Set $alias_set): void
              {
                  if (!$this->hasClassWithFQSEN($original_fqsen)) {
                      // The original class does not exist.
                      // Emit issues at the point of every single class_alias call with that original class.
          Severity: Minor
          Found in src/Phan/CodeBase.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 suggestSimilarClassInSameNamespace has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function suggestSimilarClassInSameNamespace(
                  FullyQualifiedClassName $missing_class,
                  Context $context,
                  int $class_suggest_type = IssueFixSuggester::CLASS_SUGGEST_ONLY_CLASSES
              ): array {
          Severity: Minor
          Found in src/Phan/CodeBase.php - About 1 hr to fix

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

                public function createRestorePoint(): array
                {
                    // Create a deep copy of this CodeBase
                    $clone = clone($this);
                    // make a deep copy of the NamespaceMapEntry objects within parsed_namespace_maps
            Severity: Minor
            Found in src/Phan/CodeBase.php - About 1 hr to fix

              Method __clone has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __clone()
                  {
                      $this->fqsen_class_map =
                          $this->fqsen_class_map->deepCopyValues();
              
              
              Severity: Minor
              Found in src/Phan/CodeBase.php - About 1 hr to fix

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

                class CodeBase
                {
                    /**
                     * @var Map<FullyQualifiedClassName,Clazz>
                     * A map from FQSEN to an internal or user defined class
                Severity: Minor
                Found in src/Phan/CodeBase.php by phpmd

                ExcessivePublicCount

                Since: 0.1

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

                Example

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

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

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

                    private function addGlobalConstantsByNames(array $const_name_list): void
                    {
                        $included_extension_subset = self::getIncludedExtensionSubset();
                        if (is_array($included_extension_subset)) {
                            $excluded_constant_set = [];
                Severity: Minor
                Found in src/Phan/CodeBase.php - About 1 hr to fix

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

                      public function suggestSimilarGlobalFunctionInNewerVersion(
                          string $namespace,
                          string $function_name,
                          Context $context,
                          bool $suggest_in_global_namespace
                  Severity: Minor
                  Found in src/Phan/CodeBase.php - About 1 hr to fix

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

                        public function getMethodsMapGroupedByDefiningFQSEN(): Map
                        {
                            $methods_by_defining_fqsen = new Map();
                            '@phan-var Map<FullyQualifiedMethodName,ArrayObject<Method>> $methods_by_defining_fqsen';
                            foreach ($this->method_set as $method) {
                    Severity: Minor
                    Found in src/Phan/CodeBase.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 exportFunctionAndMethodSet has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function exportFunctionAndMethodSet(): array
                        {
                            $result = [];
                            foreach ($this->getFunctionAndMethodSet() as $function_or_method) {
                                if ($function_or_method->isPHPInternal()) {
                    Severity: Minor
                    Found in src/Phan/CodeBase.php - About 1 hr to fix

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

                          private function addClassesByNames(array $class_name_list): void
                          {
                              $included_extension_subset = self::getIncludedExtensionSubset();
                              foreach ($class_name_list as $class_name) {
                                  $reflection_class = new \ReflectionClass($class_name);
                      Severity: Minor
                      Found in src/Phan/CodeBase.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

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

                              array $internal_class_name_list,
                              array $internal_interface_name_list,
                              array $internal_trait_name_list,
                              array $internal_constant_name_list,
                              array $internal_function_name_list
                      Severity: Minor
                      Found in src/Phan/CodeBase.php - About 35 mins to fix

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

                            public function forceLoadingInternalFunctions(): void
                            {
                                $internal_function_fqsen_set = $this->internal_function_fqsen_set;
                                try {
                                    foreach ($internal_function_fqsen_set as $function_fqsen) {
                        Severity: Minor
                        Found in src/Phan/CodeBase.php - About 35 mins to fix

                        Cognitive Complexity

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

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

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

                        Further reading

                        Avoid too many return statements within this method.
                        Open

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

                          Avoid too many return statements within this method.
                          Open

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

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

                                public function suggestSimilarNewInAnyNamespace(
                                    string $namespace,
                                    string $name,
                                    Context $context,
                                    bool $suggest_in_global_namespace
                            Severity: Minor
                            Found in src/Phan/CodeBase.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 suggestSimilarClassInSameNamespace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function suggestSimilarClassInSameNamespace(
                                    FullyQualifiedClassName $missing_class,
                                    Context $context,
                                    int $class_suggest_type = IssueFixSuggester::CLASS_SUGGEST_ONLY_CLASSES
                                ): array {
                            Severity: Minor
                            Found in src/Phan/CodeBase.php - About 25 mins to fix

                            Cognitive Complexity

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

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

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

                            Further reading

                            The method hasInternalFunctionWithFQSEN() has an NPath complexity of 610. The configured NPath complexity threshold is 200.
                            Open

                                private function hasInternalFunctionWithFQSEN(
                                    FullyQualifiedFunctionName $fqsen
                                ): bool {
                                    $canonical_fqsen = $fqsen->withAlternateId(0);
                                    $found = isset($this->internal_function_fqsen_set[$canonical_fqsen]);
                            Severity: Minor
                            Found in src/Phan/CodeBase.php by phpmd

                            NPathComplexity

                            Since: 0.1

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

                            Example

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

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

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

                            class CodeBase
                            {
                                /**
                                 * @var Map<FullyQualifiedClassName,Clazz>
                                 * A map from FQSEN to an internal or user defined class
                            Severity: Minor
                            Found in src/Phan/CodeBase.php by phpmd

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

                                public function createRestorePoint(): array
                                {
                                    // Create a deep copy of this CodeBase
                                    $clone = clone($this);
                                    // make a deep copy of the NamespaceMapEntry objects within parsed_namespace_maps
                            Severity: Minor
                            Found in src/Phan/CodeBase.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 addGlobalConstantsByNames() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                            Open

                                private function addGlobalConstantsByNames(array $const_name_list): void
                                {
                                    $included_extension_subset = self::getIncludedExtensionSubset();
                                    if (is_array($included_extension_subset)) {
                                        $excluded_constant_set = [];
                            Severity: Minor
                            Found in src/Phan/CodeBase.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 hasInternalFunctionWithFQSEN() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                            Open

                                private function hasInternalFunctionWithFQSEN(
                                    FullyQualifiedFunctionName $fqsen
                                ): bool {
                                    $canonical_fqsen = $fqsen->withAlternateId(0);
                                    $found = isset($this->internal_function_fqsen_set[$canonical_fqsen]);
                            Severity: Minor
                            Found in src/Phan/CodeBase.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 createRestorePoint() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function createRestorePoint(): array
                                {
                                    // Create a deep copy of this CodeBase
                                    $clone = clone($this);
                                    // make a deep copy of the NamespaceMapEntry objects within parsed_namespace_maps
                            Severity: Minor
                            Found in src/Phan/CodeBase.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 CodeBase has a coupling between objects value of 37. Consider to reduce the number of dependencies under 13.
                            Open

                            class CodeBase
                            {
                                /**
                                 * @var Map<FullyQualifiedClassName,Clazz>
                                 * A map from FQSEN to an internal or user defined class
                            Severity: Minor
                            Found in src/Phan/CodeBase.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 $id. Configured minimum length is 3.
                            Open

                                public function addParsedNamespaceMap(string $file, string $namespace, int $id, array $namespace_map): void
                            Severity: Minor
                            Found in src/Phan/CodeBase.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 $e. Configured minimum length is 3.
                            Open

                                private static function handleGlobalConstantException(string $const_name, Exception $e): void
                            Severity: Minor
                            Found in src/Phan/CodeBase.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 $id. Configured minimum length is 3.
                            Open

                                public function getNamespaceMapFromParsePhase(string $file, string $namespace, int $id): array
                            Severity: Minor
                            Found in src/Phan/CodeBase.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