src/Phan/Language/Type.php

Summary

Maintainability
F
1 mo
Test Coverage

The method Type::__wakeup() calls the typical debug function debug_print_backtrace() which is mostly only used during development.
Open

        \debug_print_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
Severity: Minor
Found in src/Phan/Language/Type.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

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

Example

class SuspectCode {

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

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

            // …
        }
    }
}

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

File Type.php has 2507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

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

    Type has 155 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Type
    {
        use \Phan\Memoize;
    
        /**
    Severity: Major
    Found in src/Phan/Language/Type.php - About 3 days to fix

      Function fromStringInContext has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function fromStringInContext(
              string $string,
              Context $context,
              int $source,
              CodeBase $code_base = null
      Severity: Minor
      Found in src/Phan/Language/Type.php - About 1 day to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method fromStringInContext has 218 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function fromStringInContext(
              string $string,
              Context $context,
              int $source,
              CodeBase $code_base = null
      Severity: Major
      Found in src/Phan/Language/Type.php - About 1 day to fix

        Method make has 120 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected static function make(
                string $namespace,
                string $type_name,
                array $template_parameter_type_list,
                bool $is_nullable,
        Severity: Major
        Found in src/Phan/Language/Type.php - About 4 hrs to fix

          Function make has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function make(
                  string $namespace,
                  string $type_name,
                  array $template_parameter_type_list,
                  bool $is_nullable,
          Severity: Minor
          Found in src/Phan/Language/Type.php - About 4 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              public function iterableValueUnionType(CodeBase $code_base): ?UnionType
              {
                  if ($this->namespace === '\\') {
                      $name = strtolower($this->name);
                      if ($name === 'traversable' || $name === 'iterator') {
          Severity: Minor
          Found in src/Phan/Language/Type.php - About 4 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              public function iterableKeyUnionType(CodeBase $code_base): ?UnionType
              {
                  if ($this->namespace === '\\') {
                      $name = strtolower($this->name);
                      if ($name === 'traversable' || $name === 'iterator') {
          Severity: Minor
          Found in src/Phan/Language/Type.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 fromFullyQualifiedStringInner has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected static function fromFullyQualifiedStringInner(
                  string $fully_qualified_string
              ): Type {
                  if ($fully_qualified_string === '') {
                      throw new InvalidArgumentException("Type cannot be empty");
          Severity: Major
          Found in src/Phan/Language/Type.php - About 3 hrs to fix

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

            class Type
            {
                use \Phan\Memoize;
            
                /**
            Severity: Minor
            Found in src/Phan/Language/Type.php by phpmd

            TooManyMethods

            Since: 0.1

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

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

            The default was changed from 10 to 25 in PHPMD 2.3.

            Example

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

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

            class Type
            {
                use \Phan\Memoize;
            
                /**
            Severity: Minor
            Found in src/Phan/Language/Type.php by phpmd

            The class Type has 55 public methods. Consider refactoring Type to keep number of public methods under 10.
            Open

            class Type
            {
                use \Phan\Memoize;
            
                /**
            Severity: Minor
            Found in src/Phan/Language/Type.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

            Method fromInternalTypeName has 83 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function fromInternalTypeName(
                    string $type_name,
                    bool $is_nullable,
                    int $source,
                    array $template_parameter_type_list = []
            Severity: Major
            Found in src/Phan/Language/Type.php - About 3 hrs to fix

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

                  protected static function fromFullyQualifiedStringInner(
                      string $fully_qualified_string
                  ): Type {
                      if ($fully_qualified_string === '') {
                          throw new InvalidArgumentException("Type cannot be empty");
              Severity: Minor
              Found in src/Phan/Language/Type.php - About 3 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  private function canCastTraversableToIterable(GenericIterableType $type): bool
                  {
                      $template_types = $this->template_parameter_type_list;
                      $count = count($template_types);
                      $name = $this->name;
              Severity: Minor
              Found in src/Phan/Language/Type.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 extractNameList has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function extractNameList(string $list_string): array
                  {
                      $results = [];
                      $prev_parts = [];
                      $delta = 0;
              Severity: Minor
              Found in src/Phan/Language/Type.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 iterableValueUnionType has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function iterableValueUnionType(CodeBase $code_base): ?UnionType
                  {
                      if ($this->namespace === '\\') {
                          $name = strtolower($this->name);
                          if ($name === 'traversable' || $name === 'iterator') {
              Severity: Major
              Found in src/Phan/Language/Type.php - About 2 hrs to fix

                Method iterableKeyUnionType has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function iterableKeyUnionType(CodeBase $code_base): ?UnionType
                    {
                        if ($this->namespace === '\\') {
                            $name = strtolower($this->name);
                            if ($name === 'traversable' || $name === 'iterator') {
                Severity: Major
                Found in src/Phan/Language/Type.php - About 2 hrs to fix

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

                      private static function parseGenericArrayTypeFromTemplateParameterList(
                          array $template_parameter_type_list,
                          bool $is_nullable,
                          bool $always_has_elements,
                          bool $is_associative
                  Severity: Minor
                  Found in src/Phan/Language/Type.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 computeExpandedTypesPreservingTemplate has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function computeExpandedTypesPreservingTemplate(CodeBase $code_base, int $recursion_depth): UnionType
                      {
                          $union_type = $this->asPHPDocUnionType();
                  
                          $class_fqsen = $this->asFQSEN();
                  Severity: Major
                  Found in src/Phan/Language/Type.php - About 2 hrs to fix

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

                        private static function typeStringComponentsInner(
                            string $type_string
                        ): Tuple5 {
                            // Check to see if we have template parameter types
                            $template_parameter_type_name_list = [];
                    Severity: Major
                    Found in src/Phan/Language/Type.php - About 2 hrs to fix

                      Method parseGenericArrayTypeFromTemplateParameterList has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private static function parseGenericArrayTypeFromTemplateParameterList(
                              array $template_parameter_type_list,
                              bool $is_nullable,
                              bool $always_has_elements,
                              bool $is_associative
                      Severity: Minor
                      Found in src/Phan/Language/Type.php - About 1 hr to fix

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

                            protected function canCastToNonNullableType(Type $type): bool
                            {
                                // can't cast native types (includes iterable or array) to object. ObjectType overrides this function.
                                if ($type instanceof ObjectType
                                    && !$this->isNativeType()
                        Severity: Minor
                        Found in src/Phan/Language/Type.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 canCastToNonNullableTypeWithoutConfig has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
                            {
                                // can't cast native types (includes iterable or array) to object. ObjectType overrides this function.
                                if ($type instanceof ObjectType
                                    && !$this->isNativeType()
                        Severity: Minor
                        Found in src/Phan/Language/Type.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 typeStringComponentsInner has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static function typeStringComponentsInner(
                                string $type_string
                            ): Tuple5 {
                                // Check to see if we have template parameter types
                                $template_parameter_type_name_list = [];
                        Severity: Minor
                        Found in src/Phan/Language/Type.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 canCastToType has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function canCastToType(Type $type): bool
                            {
                                // Check to see if we have an exact object match
                                if ($this === $type) {
                                    return true;
                        Severity: Minor
                        Found in src/Phan/Language/Type.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 computeExpandedTypes has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function computeExpandedTypes(CodeBase $code_base, int $recursion_depth): UnionType
                            {
                                $union_type = $this->asPHPDocUnionType();
                        
                                $class_fqsen = $this->asFQSEN();
                        Severity: Minor
                        Found in src/Phan/Language/Type.php - About 1 hr to fix

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

                              private static function parseListTypeFromTemplateParameterList(
                                  array $template_parameter_type_list,
                                  bool $is_nullable,
                                  bool $always_has_elements
                              ): ArrayType {
                          Severity: Minor
                          Found in src/Phan/Language/Type.php - About 1 hr to fix

                            Function closureParamComponentStringsToParams has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private static function closureParamComponentStringsToParams(array $param_components, Context $context, int $source): array
                                {
                                    $result = [];
                                    foreach ($param_components as $param_string) {
                                        if ($param_string === '') {
                            Severity: Minor
                            Found in src/Phan/Language/Type.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 computeExpandedTypesPreservingTemplate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private function computeExpandedTypesPreservingTemplate(CodeBase $code_base, int $recursion_depth): UnionType
                                {
                                    $union_type = $this->asPHPDocUnionType();
                            
                                    $class_fqsen = $this->asFQSEN();
                            Severity: Minor
                            Found in src/Phan/Language/Type.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 extractShapeComponents has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private static function extractShapeComponents(string $shape_component_string): array
                                {
                                    $result = [];
                                    foreach (self::extractNameList($shape_component_string) as $shape_component) {
                                        // Because these can be nested, there may be more than one ':'. Only consider the first.
                            Severity: Minor
                            Found in src/Phan/Language/Type.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 extractNameList has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private static function extractNameList(string $list_string): array
                                {
                                    $results = [];
                                    $prev_parts = [];
                                    $delta = 0;
                            Severity: Minor
                            Found in src/Phan/Language/Type.php - About 1 hr to fix

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

                                  public function canPossiblyCastToClass(CodeBase $code_base, Type $other): bool
                                  {
                                      if (!$this->isPossiblyObject()) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in src/Phan/Language/Type.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 shapeComponentStringsToTypes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private static function shapeComponentStringsToTypes(array $shape_components, Context $context, int $source, CodeBase $code_base = null): array
                                  {
                                      $result = [];
                                      foreach ($shape_components as $key => $component_string) {
                                          if (\is_string($key) && \strpos($key, '\\') !== false) {
                              Severity: Minor
                              Found in src/Phan/Language/Type.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 canCastToTypeHandlingTemplates has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function canCastToTypeHandlingTemplates(Type $type, CodeBase $code_base): bool
                                  {
                                      // Check to see if we have an exact object match
                                      if ($this === $type) {
                                          return true;
                              Severity: Minor
                              Found in src/Phan/Language/Type.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 joinQuotedStrings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private static function joinQuotedStrings(array $results): array
                                  {
                                      // Preserve the original count: This will change if results are combined.
                                      $N = count($results);
                                      // Iterate by offset (manually) to avoid unexpected behavior of unset of subsequent elements in foreach
                              Severity: Minor
                              Found in src/Phan/Language/Type.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 getTemplateTypeExtractorClosure has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function getTemplateTypeExtractorClosure(CodeBase $code_base, TemplateType $template_type): ?Closure
                                  {
                                      if (!$this->template_parameter_type_list) {
                                          return null;
                                      }
                              Severity: Minor
                              Found in src/Phan/Language/Type.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 canCastTraversableToIterable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function canCastTraversableToIterable(GenericIterableType $type): bool
                                  {
                                      $template_types = $this->template_parameter_type_list;
                                      $count = count($template_types);
                                      $name = $this->name;
                              Severity: Minor
                              Found in src/Phan/Language/Type.php - About 1 hr to fix

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

                                    public function canPossiblyCastToClass(CodeBase $code_base, Type $other): bool
                                    {
                                        if (!$this->isPossiblyObject()) {
                                            return false;
                                        }
                                Severity: Minor
                                Found in src/Phan/Language/Type.php - About 1 hr to fix

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

                                  class Type
                                  {
                                      use \Phan\Memoize;
                                  
                                      /**
                                  Severity: Minor
                                  Found in src/Phan/Language/Type.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 canCastToType has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function canCastToType(Type $type): bool
                                      {
                                          // Check to see if we have an exact object match
                                          if ($this === $type) {
                                              return true;
                                  Severity: Minor
                                  Found in src/Phan/Language/Type.php - About 1 hr to fix

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

                                        public function getTemplateTypeExtractorClosure(CodeBase $code_base, TemplateType $template_type): ?Closure
                                        {
                                            if (!$this->template_parameter_type_list) {
                                                return null;
                                            }
                                    Severity: Minor
                                    Found in src/Phan/Language/Type.php - About 1 hr to fix

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

                                          private static function closureParamComponentStringsToParams(array $param_components, Context $context, int $source): array
                                          {
                                              $result = [];
                                              foreach ($param_components as $param_string) {
                                                  if ($param_string === '') {
                                      Severity: Minor
                                      Found in src/Phan/Language/Type.php - About 1 hr to fix

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

                                            private function computeExpandedTypes(CodeBase $code_base, int $recursion_depth): UnionType
                                            {
                                                $union_type = $this->asPHPDocUnionType();
                                        
                                                $class_fqsen = $this->asFQSEN();
                                        Severity: Minor
                                        Found in src/Phan/Language/Type.php - About 55 mins to fix

                                        Cognitive Complexity

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

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

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

                                        Further reading

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

                                            public function canCastToTypeWithoutConfig(Type $type): bool
                                            {
                                                // Check to see if we have an exact object match
                                                if ($this === $type) {
                                                    return true;
                                        Severity: Minor
                                        Found in src/Phan/Language/Type.php - About 55 mins to fix

                                        Cognitive Complexity

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

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

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

                                        Further reading

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

                                            public static function stringFromReflectionType(
                                                ?\ReflectionType $reflection_type
                                            ): string {
                                                if (!$reflection_type) {
                                                    return '';
                                        Severity: Minor
                                        Found in src/Phan/Language/Type.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

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

                                            private static function parseListTypeFromTemplateParameterList(
                                                array $template_parameter_type_list,
                                                bool $is_nullable,
                                                bool $always_has_elements
                                            ): ArrayType {
                                        Severity: Minor
                                        Found in src/Phan/Language/Type.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

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

                                            public function isSubtypeOf(Type $type): bool
                                            {
                                                // Check to see if we have an exact object match
                                                if ($this === $type) {
                                                    return true;
                                        Severity: Minor
                                        Found in src/Phan/Language/Type.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 make has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                                string $namespace,
                                                string $type_name,
                                                array $template_parameter_type_list,
                                                bool $is_nullable,
                                                int $source
                                        Severity: Minor
                                        Found in src/Phan/Language/Type.php - About 35 mins to fix

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

                                                  bool $is_closure_type,
                                                  array $shape_components,
                                                  Context $context,
                                                  int $source,
                                                  bool $is_nullable
                                          Severity: Minor
                                          Found in src/Phan/Language/Type.php - About 35 mins to fix

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

                                                public function isExclusivelyNarrowedFormOrEquivalentTo(
                                                    UnionType $union_type,
                                                    Context $context,
                                                    CodeBase $code_base
                                                ): bool {
                                            Severity: Minor
                                            Found in src/Phan/Language/Type.php - About 35 mins to fix

                                            Cognitive Complexity

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

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

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

                                            Further reading

                                            Avoid too many return statements within this method.
                                            Open

                                                            return Type::fromFullyQualifiedString('\\' . \get_class($object));
                                            Severity: Major
                                            Found in src/Phan/Language/Type.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                      return (string)$reflection_type;
                                              Severity: Major
                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                            return new GenericMultiArrayType(
                                                                $types,
                                                                $is_nullable,
                                                                GenericArrayType::KEY_INT,
                                                                $always_has_elements,
                                                Severity: Major
                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                  return UnionType::fromStringInContext($type_name, $context, $source, $code_base);
                                                  Severity: Major
                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                    return SelfType::instance($is_nullable);
                                                    Severity: Major
                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

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

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                        return ListType::fromElementType(MixedType::instance(false), $is_nullable);
                                                        Severity: Major
                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                          return NonEmptyGenericArrayType::fromElementType(MixedType::instance(false), $is_nullable, GenericArrayType::KEY_MIXED);
                                                          Severity: Major
                                                          Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                                    return self::parseListTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable, $type_name === 'non-empty-list');
                                                            Severity: Major
                                                            Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                      return self::make(
                                                                          $namespace,
                                                                          $type_name,
                                                                          $template_parameter_type_list,
                                                                          $is_nullable,
                                                              Severity: Major
                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                        return ArrayType::instance($is_nullable);
                                                                Severity: Major
                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

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

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                    return CallableArrayType::instance($is_nullable);
                                                                    Severity: Major
                                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                      return IntType::instance($is_nullable);
                                                                      Severity: Major
                                                                      Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                        return StaticType::instanceWithTemplateTypeList($is_nullable, $template_parameter_type_list);
                                                                        Severity: Major
                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                          return $make(MixedType::instance(false), GenericArrayType::KEY_MIXED);
                                                                          Severity: Major
                                                                          Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                                    return self::parseGenericArrayTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable, $type_name === 'non-empty-array', true);
                                                                            Severity: Major
                                                                            Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                          return GenericArrayType::fromElementType(
                                                                                              $element_type,
                                                                                              $is_nullable,
                                                                                              GenericArrayType::KEY_MIXED
                                                                                          );
                                                                              Severity: Major
                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

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

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                      return StaticType::instance($is_nullable);
                                                                                  Severity: Major
                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                    return $this->canCastTraversableToIterable($type);
                                                                                    Severity: Major
                                                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

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

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                        return ResourceType::instance($is_nullable);
                                                                                        Severity: Major
                                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                          return VoidType::instance(false);
                                                                                          Severity: Major
                                                                                          Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                        return self::fromInternalTypeName(
                                                                                                            $fully_qualified_string,
                                                                                                            $is_nullable,
                                                                                                            Type::FROM_NODE,
                                                                                                            $template_parameter_type_list
                                                                                            Severity: Major
                                                                                            Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                              return self::fromFunctionLikeInContext($type_name === 'Closure', $shape_components, $context, $source, $is_nullable);
                                                                                              Severity: Major
                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                            return self::fromInternalTypeName($type_name, $is_nullable, $source, $template_parameter_type_list);
                                                                                                Severity: Major
                                                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

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

                                                                                                    Avoid too many return statements within this method.
                                                                                                    Open

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

                                                                                                      Avoid too many return statements within this method.
                                                                                                      Open

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

                                                                                                        Avoid too many return statements within this method.
                                                                                                        Open

                                                                                                                        return CallableStringType::instance($is_nullable);
                                                                                                        Severity: Major
                                                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                          Avoid too many return statements within this method.
                                                                                                          Open

                                                                                                                          return NonEmptyMixedType::instance($is_nullable);
                                                                                                          Severity: Major
                                                                                                          Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                            Avoid too many return statements within this method.
                                                                                                            Open

                                                                                                                            return ObjectType::instance($is_nullable);
                                                                                                            Severity: Major
                                                                                                            Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                              Avoid too many return statements within this method.
                                                                                                              Open

                                                                                                                          return self::fromEscapedLiteralScalar($type_name);
                                                                                                              Severity: Major
                                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                Avoid too many return statements within this method.
                                                                                                                Open

                                                                                                                            return Type::make(
                                                                                                                                $fqsen->getNamespace(),
                                                                                                                                $fqsen->getName(),
                                                                                                                                $template_parameter_type_list,
                                                                                                                                $is_nullable,
                                                                                                                Severity: Major
                                                                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this method.
                                                                                                                  Open

                                                                                                                                          return self::parseGenericIterableTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable);
                                                                                                                  Severity: Major
                                                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this method.
                                                                                                                    Open

                                                                                                                            return $this->canCastToNonNullableTypeWithoutConfig($type);
                                                                                                                    Severity: Major
                                                                                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this method.
                                                                                                                      Open

                                                                                                                                      return ResourceType::instance(false);  // For inferring the type of constants STDIN, etc.
                                                                                                                      Severity: Major
                                                                                                                      Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

                                                                                                                                        return CallableObjectType::instance($is_nullable);
                                                                                                                        Severity: Major
                                                                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this method.
                                                                                                                          Open

                                                                                                                                          return ClosureType::instance($is_nullable);
                                                                                                                          Severity: Major
                                                                                                                          Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this method.
                                                                                                                            Open

                                                                                                                                        return self::fromInternalTypeName(\substr($type_name, 1), true, $source, $template_parameter_type_list);
                                                                                                                            Severity: Major
                                                                                                                            Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this method.
                                                                                                                              Open

                                                                                                                                          return $make(MixedType::instance(false), $key_type);
                                                                                                                              Severity: Major
                                                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                Open

                                                                                                                                                        return self::parseGenericArrayTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable, true, true);
                                                                                                                                Severity: Major
                                                                                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                  Open

                                                                                                                                                          return self::parseListTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable, false);
                                                                                                                                  Severity: Major
                                                                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                    Open

                                                                                                                                                            return self::parseListTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable, true);
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                      Open

                                                                                                                                                      return self::maybeFindParentType($is_nullable, $context, $code_base);
                                                                                                                                      Severity: Major
                                                                                                                                      Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                        Open

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

                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                          Open

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

                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                            Open

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

                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                              Open

                                                                                                                                                              return NonEmptyListType::fromElementType(MixedType::instance(false), $is_nullable);
                                                                                                                                              Severity: Major
                                                                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                Open

                                                                                                                                                            return self::make(
                                                                                                                                                                $namespace,
                                                                                                                                                                $type_name,
                                                                                                                                                                $template_parameter_type_list,
                                                                                                                                                                $is_nullable,
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                  Open

                                                                                                                                                          return $this->isSubtypeOfNonNullableType($type);
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                    Open

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

                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                      Open

                                                                                                                                                                      return FalseType::instance($is_nullable);
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                        Open

                                                                                                                                                                        return NonZeroIntType::instance($is_nullable);
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                          Open

                                                                                                                                                                          return NullType::instance($is_nullable);
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                            Open

                                                                                                                                                                            return GenericArrayTemplateKeyType::fromTemplateAndElementType(
                                                                                                                                                                                // @phan-suppress-next-line PhanPossiblyFalseTypeArgument
                                                                                                                                                                                \reset($types),
                                                                                                                                                                                $is_nullable,
                                                                                                                                                                                $template_parameter_type_list[0]
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                              Open

                                                                                                                                                                          return GenericArrayType::fromElementType(
                                                                                                                                                                              Type::fromStringInContext($non_generic_partially_qualified_array_type_name, $context, $source),
                                                                                                                                                                              $is_nullable,
                                                                                                                                                                              GenericArrayType::KEY_MIXED
                                                                                                                                                                          );
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                Open

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

                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                  Open

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

                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                    Open

                                                                                                                                                                            return $this->canCastToNonNullableType($type);
                                                                                                                                                                    Severity: Major
                                                                                                                                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                      Open

                                                                                                                                                                                  return $this->namespace === '\\' && $this->name === 'Closure';
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                        Open

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

                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                          Open

                                                                                                                                                                                  return new Tuple5(
                                                                                                                                                                                      $namespace,
                                                                                                                                                                                      $class_name,
                                                                                                                                                                                      $template_parameter_type_name_list,
                                                                                                                                                                                      $is_nullable,
                                                                                                                                                                          Severity: Major
                                                                                                                                                                          Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                            Open

                                                                                                                                                                                            return ArrayType::instance(false);
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                              Open

                                                                                                                                                                                              return NonEmptyStringType::instance($is_nullable);
                                                                                                                                                                              Severity: Major
                                                                                                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                Open

                                                                                                                                                                                                return ScalarRawType::instance($is_nullable);
                                                                                                                                                                                Severity: Major
                                                                                                                                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                  Open

                                                                                                                                                                                          return ListType::fromElementType(
                                                                                                                                                                                              MixedType::instance(false),
                                                                                                                                                                                              $is_nullable
                                                                                                                                                                                          );
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                    Open

                                                                                                                                                                                                            return self::parseGenericArrayTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable, false, false);
                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                      Open

                                                                                                                                                                                                              return self::parseGenericArrayTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable, false, true);
                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                      Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                        Open

                                                                                                                                                                                                    return self::make(
                                                                                                                                                                                                        $fqsen->getNamespace(),
                                                                                                                                                                                                        $fqsen->getName(),
                                                                                                                                                                                                        $template_parameter_type_list,
                                                                                                                                                                                                        $is_nullable,
                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                          Open

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

                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                            Open

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

                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                              Open

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

                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                Open

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

                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                  Open

                                                                                                                                                                                                                  return $object ? TrueType::instance(false) : FalseType::instance(false);
                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                    Open

                                                                                                                                                                                                                    return NonNullMixedType::instance($is_nullable);
                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                                      Open

                                                                                                                                                                                                                  return ArrayType::instance($is_nullable);
                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                      Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                                        Open

                                                                                                                                                                                                                        return SelfType::instanceWithTemplateTypeList($is_nullable, $template_parameter_type_list);
                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                                          Open

                                                                                                                                                                                                                  return $this->canCastToNonNullableTypeHandlingTemplates($type, $code_base);
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                                              Open

                                                                                                                                                                                                                              return NonEmptyAssociativeArrayType::fromElementType(MixedType::instance(false), $is_nullable, GenericArrayType::KEY_MIXED);
                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                return IterableType::instance($is_nullable);
                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                              return new GenericMultiArrayType(
                                                                                                                                                                                                                                  $types,
                                                                                                                                                                                                                                  $is_nullable,
                                                                                                                                                                                                                                  $key_type,
                                                                                                                                                                                                                                  $always_has_elements,
                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                    return TrueType::instance($is_nullable);
                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                                                      Open

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

                                                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                                return self::parseGenericArrayTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable, true, false);
                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                              return $this->canCastTraversableToIterable($type);
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                return FloatType::instance($is_nullable);
                                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                                  return MixedType::instance($is_nullable);
                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                    return StringType::instance($is_nullable);
                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                                                              return self::parseGenericIterableTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable);
                                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                                      Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                                    return NonEmptyListType::fromElementType(
                                                                                                                                                                                                                                                        MixedType::instance(false),
                                                                                                                                                                                                                                                        $is_nullable
                                                                                                                                                                                                                                                    );
                                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                                              return GenericArrayType::fromElementType(
                                                                                                                                                                                                                                                                  Type::make(
                                                                                                                                                                                                                                                                      $fqsen->getNamespace(),
                                                                                                                                                                                                                                                                      $fqsen->getName(),
                                                                                                                                                                                                                                                                      $template_parameter_type_list,
                                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                        return self::parseClassStringTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable);
                                                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                                          return self::make(
                                                                                                                                                                                                                                                              $namespace,
                                                                                                                                                                                                                                                              $type_name,
                                                                                                                                                                                                                                                              $template_parameter_type_list,
                                                                                                                                                                                                                                                              $is_nullable,
                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                                                                                                    Open

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

                                                                                                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                                                                                                      Open

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

                                                                                                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                                                        return CallableType::instance($is_nullable);
                                                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                                                        Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                                                                                                          Open

                                                                                                                                                                                                                                                                          return ClassStringType::instance($is_nullable);
                                                                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                                                                          Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                                                                                                            Open

                                                                                                                                                                                                                                                                                    return self::parseGenericArrayTypeFromTemplateParameterList($template_parameter_type_list, $is_nullable, $type_name === 'non-empty-array', false);
                                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                                            Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                                                          return $make(\reset($types), $key_type);
                                                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                                                              Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                                return ArrayShapeType::fromFieldTypes(
                                                                                                                                                                                                                                                                                    self::shapeComponentStringsToTypes($shape_components, $context, $source, $code_base),
                                                                                                                                                                                                                                                                                    $is_nullable
                                                                                                                                                                                                                                                                                );
                                                                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                                                                Found in src/Phan/Language/Type.php - About 30 mins to fix

                                                                                                                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                                                              return $this->namespace === '\\' && $this->name === 'Closure';
                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                  Found in src/Phan/Language/Type.php - About 30 mins to fix

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

                                                                                                                                                                                                                                                                        private function canTemplateTypesCast(array $other_template_parameter_type_list, CodeBase $code_base): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            foreach ($this->template_parameter_type_list as $i => $param) {
                                                                                                                                                                                                                                                                                $other_param = $other_template_parameter_type_list[$i] ?? null;
                                                                                                                                                                                                                                                                                if ($other_param !== null) {
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php - About 25 mins to fix

                                                                                                                                                                                                                                                                    Cognitive Complexity

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

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

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

                                                                                                                                                                                                                                                                    Further reading

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

                                                                                                                                                                                                                                                                    class Type
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        use \Phan\Memoize;
                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                        /**
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

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

                                                                                                                                                                                                                                                                        public function iterableKeyUnionType(CodeBase $code_base): ?UnionType
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            if ($this->namespace === '\\') {
                                                                                                                                                                                                                                                                                $name = strtolower($this->name);
                                                                                                                                                                                                                                                                                if ($name === 'traversable' || $name === 'iterator') {
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 make() has an NPath complexity of 38016. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        protected static function make(
                                                                                                                                                                                                                                                                            string $namespace,
                                                                                                                                                                                                                                                                            string $type_name,
                                                                                                                                                                                                                                                                            array $template_parameter_type_list,
                                                                                                                                                                                                                                                                            bool $is_nullable,
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 computeExpandedTypesPreservingTemplate() has an NPath complexity of 384. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        private function computeExpandedTypesPreservingTemplate(CodeBase $code_base, int $recursion_depth): UnionType
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            $union_type = $this->asPHPDocUnionType();
                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                            $class_fqsen = $this->asFQSEN();
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 make() has 146 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        protected static function make(
                                                                                                                                                                                                                                                                            string $namespace,
                                                                                                                                                                                                                                                                            string $type_name,
                                                                                                                                                                                                                                                                            array $template_parameter_type_list,
                                                                                                                                                                                                                                                                            bool $is_nullable,
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

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

                                                                                                                                                                                                                                                                        protected static function fromFullyQualifiedStringInner(
                                                                                                                                                                                                                                                                            string $fully_qualified_string
                                                                                                                                                                                                                                                                        ): Type {
                                                                                                                                                                                                                                                                            if ($fully_qualified_string === '') {
                                                                                                                                                                                                                                                                                throw new InvalidArgumentException("Type cannot be empty");
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 fromStringInContext() has an NPath complexity of 3849120000. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public static function fromStringInContext(
                                                                                                                                                                                                                                                                            string $string,
                                                                                                                                                                                                                                                                            Context $context,
                                                                                                                                                                                                                                                                            int $source,
                                                                                                                                                                                                                                                                            CodeBase $code_base = null
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 parseGenericArrayTypeFromTemplateParameterList() has an NPath complexity of 864. The configured NPath complexity threshold is 200.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        private static function parseGenericArrayTypeFromTemplateParameterList(
                                                                                                                                                                                                                                                                            array $template_parameter_type_list,
                                                                                                                                                                                                                                                                            bool $is_nullable,
                                                                                                                                                                                                                                                                            bool $always_has_elements,
                                                                                                                                                                                                                                                                            bool $is_associative
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 fromStringInContext() has 281 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public static function fromStringInContext(
                                                                                                                                                                                                                                                                            string $string,
                                                                                                                                                                                                                                                                            Context $context,
                                                                                                                                                                                                                                                                            int $source,
                                                                                                                                                                                                                                                                            CodeBase $code_base = null
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

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

                                                                                                                                                                                                                                                                        public function iterableValueUnionType(CodeBase $code_base): ?UnionType
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            if ($this->namespace === '\\') {
                                                                                                                                                                                                                                                                                $name = strtolower($this->name);
                                                                                                                                                                                                                                                                                if ($name === 'traversable' || $name === 'iterator') {
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 fromInternalTypeName() has 102 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public static function fromInternalTypeName(
                                                                                                                                                                                                                                                                            string $type_name,
                                                                                                                                                                                                                                                                            bool $is_nullable,
                                                                                                                                                                                                                                                                            int $source,
                                                                                                                                                                                                                                                                            array $template_parameter_type_list = []
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

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

                                                                                                                                                                                                                                                                        public function canPossiblyCastToClass(CodeBase $code_base, Type $other): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            if (!$this->isPossiblyObject()) {
                                                                                                                                                                                                                                                                                return false;
                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 canCastToTypeHandlingTemplates() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public function canCastToTypeHandlingTemplates(Type $type, CodeBase $code_base): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            // Check to see if we have an exact object match
                                                                                                                                                                                                                                                                            if ($this === $type) {
                                                                                                                                                                                                                                                                                return true;
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 canCastToNonNullableType() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        protected function canCastToNonNullableType(Type $type): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            // can't cast native types (includes iterable or array) to object. ObjectType overrides this function.
                                                                                                                                                                                                                                                                            if ($type instanceof ObjectType
                                                                                                                                                                                                                                                                                && !$this->isNativeType()
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 make() has a Cyclomatic Complexity of 30. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        protected static function make(
                                                                                                                                                                                                                                                                            string $namespace,
                                                                                                                                                                                                                                                                            string $type_name,
                                                                                                                                                                                                                                                                            array $template_parameter_type_list,
                                                                                                                                                                                                                                                                            bool $is_nullable,
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 canCastToNonNullableTypeWithoutConfig() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            // can't cast native types (includes iterable or array) to object. ObjectType overrides this function.
                                                                                                                                                                                                                                                                            if ($type instanceof ObjectType
                                                                                                                                                                                                                                                                                && !$this->isNativeType()
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 typeStringComponentsInner() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        private static function typeStringComponentsInner(
                                                                                                                                                                                                                                                                            string $type_string
                                                                                                                                                                                                                                                                        ): Tuple5 {
                                                                                                                                                                                                                                                                            // Check to see if we have template parameter types
                                                                                                                                                                                                                                                                            $template_parameter_type_name_list = [];
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 parseGenericArrayTypeFromTemplateParameterList() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        private static function parseGenericArrayTypeFromTemplateParameterList(
                                                                                                                                                                                                                                                                            array $template_parameter_type_list,
                                                                                                                                                                                                                                                                            bool $is_nullable,
                                                                                                                                                                                                                                                                            bool $always_has_elements,
                                                                                                                                                                                                                                                                            bool $is_associative
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 iterableValueUnionType() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public function iterableValueUnionType(CodeBase $code_base): ?UnionType
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            if ($this->namespace === '\\') {
                                                                                                                                                                                                                                                                                $name = strtolower($this->name);
                                                                                                                                                                                                                                                                                if ($name === 'traversable' || $name === 'iterator') {
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 fromInternalTypeName() has a Cyclomatic Complexity of 36. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public static function fromInternalTypeName(
                                                                                                                                                                                                                                                                            string $type_name,
                                                                                                                                                                                                                                                                            bool $is_nullable,
                                                                                                                                                                                                                                                                            int $source,
                                                                                                                                                                                                                                                                            array $template_parameter_type_list = []
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 fromStringInContext() has a Cyclomatic Complexity of 52. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public static function fromStringInContext(
                                                                                                                                                                                                                                                                            string $string,
                                                                                                                                                                                                                                                                            Context $context,
                                                                                                                                                                                                                                                                            int $source,
                                                                                                                                                                                                                                                                            CodeBase $code_base = null
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 canCastTraversableToIterable() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        private function canCastTraversableToIterable(GenericIterableType $type): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            $template_types = $this->template_parameter_type_list;
                                                                                                                                                                                                                                                                            $count = count($template_types);
                                                                                                                                                                                                                                                                            $name = $this->name;
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 fromFullyQualifiedStringInner() has a Cyclomatic Complexity of 23. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        protected static function fromFullyQualifiedStringInner(
                                                                                                                                                                                                                                                                            string $fully_qualified_string
                                                                                                                                                                                                                                                                        ): Type {
                                                                                                                                                                                                                                                                            if ($fully_qualified_string === '') {
                                                                                                                                                                                                                                                                                throw new InvalidArgumentException("Type cannot be empty");
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 canPossiblyCastToClass() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public function canPossiblyCastToClass(CodeBase $code_base, Type $other): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            if (!$this->isPossiblyObject()) {
                                                                                                                                                                                                                                                                                return false;
                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 iterableKeyUnionType() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public function iterableKeyUnionType(CodeBase $code_base): ?UnionType
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            if ($this->namespace === '\\') {
                                                                                                                                                                                                                                                                                $name = strtolower($this->name);
                                                                                                                                                                                                                                                                                if ($name === 'traversable' || $name === 'iterator') {
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 fromObject() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public static function fromObject($object): Type
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            switch (\gettype($object)) {
                                                                                                                                                                                                                                                                                case 'integer':
                                                                                                                                                                                                                                                                                    return LiteralIntType::instanceForValue($object, false);
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 computeExpandedTypesPreservingTemplate() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        private function computeExpandedTypesPreservingTemplate(CodeBase $code_base, int $recursion_depth): UnionType
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            $union_type = $this->asPHPDocUnionType();
                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                            $class_fqsen = $this->asFQSEN();
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 canCastToType() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public function canCastToType(Type $type): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            // Check to see if we have an exact object match
                                                                                                                                                                                                                                                                            if ($this === $type) {
                                                                                                                                                                                                                                                                                return true;
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 Type has a coupling between objects value of 73. Consider to reduce the number of dependencies under 13.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                    class Type
                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                        use \Phan\Memoize;
                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                        /**
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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

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

                                                                                                                                                                                                                                                                        protected function canCastToNonNullableType(Type $type): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            // can't cast native types (includes iterable or array) to object. ObjectType overrides this function.
                                                                                                                                                                                                                                                                            if ($type instanceof ObjectType
                                                                                                                                                                                                                                                                                && !$this->isNativeType()
                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php and 1 other location - About 7 hrs to fix
                                                                                                                                                                                                                                                                    src/Phan/Language/Type.php on lines 3055..3085

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

                                                                                                                                                                                                                                                                    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

                                                                                                                                                                                                                                                                        protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            // can't cast native types (includes iterable or array) to object. ObjectType overrides this function.
                                                                                                                                                                                                                                                                            if ($type instanceof ObjectType
                                                                                                                                                                                                                                                                                && !$this->isNativeType()
                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php and 1 other location - About 7 hrs to fix
                                                                                                                                                                                                                                                                    src/Phan/Language/Type.php on lines 3014..3044

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

                                                                                                                                                                                                                                                                    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

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

                                                                                                                                                                                                                                                                            if ($expanded_types->hasTypeWithFQSEN($iterator_aggregate_fqsen)) {
                                                                                                                                                                                                                                                                                $class = $code_base->getClassByFQSEN($fqsen);
                                                                                                                                                                                                                                                                                if (!$class->hasMethodWithName($code_base, 'getIterator', true)) {
                                                                                                                                                                                                                                                                                    // Should be impossible
                                                                                                                                                                                                                                                                                    return null;
                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php and 1 other location - About 4 hrs to fix
                                                                                                                                                                                                                                                                    src/Phan/Language/Type.php on lines 2360..2384

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

                                                                                                                                                                                                                                                                    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

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

                                                                                                                                                                                                                                                                            if ($expanded_types->hasTypeWithFQSEN($iterator_aggregate_fqsen)) {
                                                                                                                                                                                                                                                                                $class = $code_base->getClassByFQSEN($fqsen);
                                                                                                                                                                                                                                                                                if (!$class->hasMethodWithName($code_base, 'getIterator', true)) {
                                                                                                                                                                                                                                                                                    // Should be impossible
                                                                                                                                                                                                                                                                                    return null;
                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php and 1 other location - About 4 hrs to fix
                                                                                                                                                                                                                                                                    src/Phan/Language/Type.php on lines 2437..2461

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

                                                                                                                                                                                                                                                                    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 asExpandedTypes(
                                                                                                                                                                                                                                                                            CodeBase $code_base,
                                                                                                                                                                                                                                                                            int $recursion_depth = 0
                                                                                                                                                                                                                                                                        ): UnionType {
                                                                                                                                                                                                                                                                            if (($this->memoized_data['current_progress_state'] ?? null) === self::$current_progress_state) {
                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                    src/Phan/Language/Type.php on lines 2707..2727

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

                                                                                                                                                                                                                                                                    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 asExpandedTypesPreservingTemplate(
                                                                                                                                                                                                                                                                            CodeBase $code_base,
                                                                                                                                                                                                                                                                            int $recursion_depth = 0
                                                                                                                                                                                                                                                                        ): UnionType {
                                                                                                                                                                                                                                                                            if (($this->memoized_data['current_progress_state'] ?? null) === self::$current_progress_state) {
                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                    src/Phan/Language/Type.php on lines 2609..2629

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

                                                                                                                                                                                                                                                                    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 ($expanded_types->hasTypeWithFQSEN($iterator_fqsen)) {
                                                                                                                                                                                                                                                                                $class = $code_base->getClassByFQSEN($fqsen);
                                                                                                                                                                                                                                                                                if (!$class->hasMethodWithName($code_base, 'current', true)) {
                                                                                                                                                                                                                                                                                    // Should be impossible
                                                                                                                                                                                                                                                                                    return null;
                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                    src/Phan/Language/Type.php on lines 2386..2400

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

                                                                                                                                                                                                                                                                    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 ($expanded_types->hasTypeWithFQSEN($iterator_fqsen)) {
                                                                                                                                                                                                                                                                                $class = $code_base->getClassByFQSEN($fqsen);
                                                                                                                                                                                                                                                                                if (!$class->hasMethodWithName($code_base, 'key', true)) {
                                                                                                                                                                                                                                                                                    // Should be impossible
                                                                                                                                                                                                                                                                                    return null;
                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                    src/Phan/Language/Type.php on lines 2463..2477

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

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

                                                                                                                                                                                                                                                                        public function memoize(string $key, Closure $fn)
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 $i. Configured minimum length is 3.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                            $i = \strpos($type_string, $inner) + \strlen($inner);
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ShortVariable

                                                                                                                                                                                                                                                                    Since: 0.2

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

                                                                                                                                                                                                                                                                    Example

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

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

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

                                                                                                                                                                                                                                                                            $N = count($results);
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 $a. Configured minimum length is 3.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public static function performComparison($a, $b, int $flags): bool
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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 $b. Configured minimum length is 3.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public static function performComparison($a, $b, int $flags): bool
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.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

                                                                                                                                                                                                                                                                    Constant simple_type_regex should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const simple_type_regex =
                                                                                                                                                                                                                                                                            '(\??)(?:callable-(?:string|object|array)|associative-array|class-string|lowercase-string|non-(?:zero-int|null-mixed|empty-(?:associative-array|array|list|string|lowercase-string|mixed))|\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*)';
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant type_regex should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const type_regex =
                                                                                                                                                                                                                                                                            '('
                                                                                                                                                                                                                                                                            . '(?:\??\((?-1)(?:[|&](?-1))*\)|'  // Recursion: "?(T)" or "(T)" with brackets. Also allow parsing (a|b) within brackets.
                                                                                                                                                                                                                                                                            . '(?:'
                                                                                                                                                                                                                                                                              . '\??(?:\\\\?Closure|callable)(\((?:[^()]|(?-1))*\))'  // `Closure(...)` can have matching pairs of () inside `...`, recursively
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant _bit_true should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const _bit_true     = (1 << 1);
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant shape_key_regex should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const shape_key_regex =
                                                                                                                                                                                                                                                                            '(?:[-.\/^;$%*+_a-zA-Z0-9\x7f-\xff]|\\\\(?:[nrt\\\\]|x[0-9a-fA-F]{2}))+\??';
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant _soft_internal_type_set should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const _soft_internal_type_set = [
                                                                                                                                                                                                                                                                            'resource'  => true,
                                                                                                                                                                                                                                                                            'scalar'    => true,
                                                                                                                                                                                                                                                                            'true'      => true,
                                                                                                                                                                                                                                                                        ];
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant _bit_false should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const _bit_false    = (1 << 0);
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant simple_type_regex_or_this should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const simple_type_regex_or_this =
                                                                                                                                                                                                                                                                            '(\??)(callable-(?:string|object|array)|associative-array|class-string|lowercase-string|non-(?:zero-int|null-mixed|empty-(?:associative-array|array|list|string|lowercase-string|mixed))|\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*|\$this)';
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant type_regex_or_this should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const type_regex_or_this =
                                                                                                                                                                                                                                                                            '('
                                                                                                                                                                                                                                                                            . '('
                                                                                                                                                                                                                                                                              . '(?:'
                                                                                                                                                                                                                                                                                . '\??\((?-1)(?:[|&](?-1))*\)|'  // Recursion: "?(T)" or "(T)" with brackets. Also allow parsing (a|b) within brackets.
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant _bit_bool_combination should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const _bit_bool_combination = self::_bit_false | self::_bit_true;
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant simple_noncapturing_type_regex should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const simple_noncapturing_type_regex =
                                                                                                                                                                                                                                                                            '\\\\?(?:callable-(?:string|object|array)|associative-array|class-string|lowercase-string|non-(?:zero-int|null-mixed|empty-(?:associative-array|array|list|string|lowercase-string|mixed))|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*)';
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant noncapturing_literal_regex should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const noncapturing_literal_regex =
                                                                                                                                                                                                                                                                            '\??(?:-?(?:(?:0|[1-9][0-9]*)(?:\.[0-9]+)?)|\'(?:[- ,.\/?:;"!#$%^&*_+=a-zA-Z0-9_\x80-\xff]|\\\\(?:[\'\\\\]|x[0-9a-fA-F]{2}))*\')';
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant _internal_type_set should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const _internal_type_set = [
                                                                                                                                                                                                                                                                            'associative-array' => true,
                                                                                                                                                                                                                                                                            'array'           => true,
                                                                                                                                                                                                                                                                            'bool'            => true,
                                                                                                                                                                                                                                                                            'callable'        => true,
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant array_shape_entry_regex_noncapturing should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const array_shape_entry_regex_noncapturing =
                                                                                                                                                                                                                                                                            '(?:' . self::shape_key_regex . '\s*:)?\s*(?:' . self::simple_noncapturing_type_regex . '=?)';
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    Constant _bit_nullable should be defined in uppercase
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                        public const _bit_nullable = (1 << 2);
                                                                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                                                                    Found in src/Phan/Language/Type.php by phpmd

                                                                                                                                                                                                                                                                    ConstantNamingConventions

                                                                                                                                                                                                                                                                    Since: 0.2

                                                                                                                                                                                                                                                                    Class/Interface constant names should always be defined in uppercase.

                                                                                                                                                                                                                                                                    Example

                                                                                                                                                                                                                                                                    class Foo {
                                                                                                                                                                                                                                                                        const MY_NUM = 0; // ok
                                                                                                                                                                                                                                                                        const myTest = ""; // fail
                                                                                                                                                                                                                                                                    }

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

                                                                                                                                                                                                                                                                    There are no issues that match your filters.

                                                                                                                                                                                                                                                                    Category
                                                                                                                                                                                                                                                                    Status