src/Phan/Plugin/Internal/MiscParamPlugin.php

Summary

Maintainability
F
2 wks
Test Coverage

Method getAnalyzeFunctionCallClosuresStatic has 714 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function getAnalyzeFunctionCallClosuresStatic(): array
    {
        $stop_exception = new StopParamAnalysisException();

        /**
Severity: Major
Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 3 days to fix

    File MiscParamPlugin.php has 1061 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    declare(strict_types=1);
    
    namespace Phan\Plugin\Internal;
    Severity: Major
    Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 2 days to fix

      Function getAnalyzeFunctionCallClosuresStatic has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function getAnalyzeFunctionCallClosuresStatic(): array
          {
              $stop_exception = new StopParamAnalysisException();
      
              /**
      Severity: Minor
      Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 2 days 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 shouldWarnAboutImpossibleArrayKeyExists has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function shouldWarnAboutImpossibleArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?UnionType $key_type = null, ?UnionType $array_type = null): bool
          {
              $array_type = $array_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
              if (!$array_type->hasRealTypeSet()) {
                  return false;
      Severity: Minor
      Found in src/Phan/Plugin/Internal/MiscParamPlugin.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

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

      final class MiscParamPlugin extends PluginV3 implements
          AnalyzeFunctionCallCapability
      {
          /**
           * @param list<Node|string|int|float> $args

      Method shouldWarnAboutImpossibleArrayKeyExists has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function shouldWarnAboutImpossibleArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?UnionType $key_type = null, ?UnionType $array_type = null): bool
          {
              $array_type = $array_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
              if (!$array_type->hasRealTypeSet()) {
                  return false;
      Severity: Major
      Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 3 hrs to fix

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

            private static function shouldWarnAboutImpossibleInArray(CodeBase $code_base, Context $context, array $args, ?UnionType $needle_type = null, ?UnionType $haystack_type = null): bool
            {
                $haystack_type = $haystack_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
                if (!$haystack_type->hasRealTypeSet()) {
                    return false;
        Severity: Minor
        Found in src/Phan/Plugin/Internal/MiscParamPlugin.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 emitIssueForArrayKeyExists has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function emitIssueForArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?Node $node): void
            {
                [$key_node, $array_node] = $args;
                $key_type = UnionTypeVisitor::unionTypeFromNode($code_base, $context, $key_node);
                $array_type = UnionTypeVisitor::unionTypeFromNode($code_base, $context, $array_node);
        Severity: Minor
        Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 1 hr to fix

          Method emitIssueForInArray has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function emitIssueForInArray(CodeBase $code_base, Context $context, array $args, ?Node $node): void
              {
                  [$needle_node, $haystack_node] = $args;
                  $needle = UnionTypeVisitor::unionTypeFromNode($code_base, $context, $needle_node);
                  $haystack = UnionTypeVisitor::unionTypeFromNode($code_base, $context, $haystack_node);
          Severity: Minor
          Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 1 hr to fix

            Method shouldWarnAboutImpossibleInArray has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function shouldWarnAboutImpossibleInArray(CodeBase $code_base, Context $context, array $args, ?UnionType $needle_type = null, ?UnionType $haystack_type = null): bool
                {
                    $haystack_type = $haystack_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
                    if (!$haystack_type->hasRealTypeSet()) {
                        return false;
            Severity: Minor
            Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 1 hr to fix

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

                  private static function shouldWarnAboutImpossibleInArray(CodeBase $code_base, Context $context, array $args, ?UnionType $needle_type = null, ?UnionType $haystack_type = null): bool
              Severity: Minor
              Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 35 mins to fix

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

                    private static function shouldWarnAboutImpossibleArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?UnionType $key_type = null, ?UnionType $array_type = null): bool
                Severity: Minor
                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 35 mins to fix

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

                          $node,
                          Context $context,
                          CodeBase $code_base,
                          UnionType $cast_type,
                          Closure $issue_instance
                  Severity: Minor
                  Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 35 mins to fix

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

                              return $has_array_type;
                      Severity: Major
                      Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                                return [ListType::fromElementType($type->genericArrayElementType(), $type->isNullable(), $type->getKeyType())];
                        Severity: Major
                        Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                                      return [NonEmptyAssociativeArrayType::fromElementType($type->genericArrayElementType(), $type->isNullable(), $type->getKeyType())];
                          Severity: Major
                          Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return $has_iterable_type;
                            Severity: Major
                            Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

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

                                Avoid too many return statements within this method.
                                Open

                                                return;
                                Severity: Major
                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                          return;
                                  Severity: Major
                                  Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                    return;
                                    Severity: Major
                                    Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

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

                                        Avoid too many return statements within this method.
                                        Open

                                                        return;
                                        Severity: Major
                                        Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                          return;
                                          Severity: Major
                                          Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

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

                                              Avoid too many return statements within this method.
                                              Open

                                                              return;
                                              Severity: Major
                                              Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                return;
                                                Severity: Major
                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                          return [$type];
                                                  Severity: Major
                                                  Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                    return;
                                                    Severity: Major
                                                    Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

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

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                    return true;
                                                        Severity: Major
                                                        Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

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

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                                    return Issue::fromType(Issue::ParamSpecial2)(
                                                                                        $context->getFile(),
                                                                                        $context->getLineNumberStart(),
                                                                                        [
                                                                                            1,
                                                            Severity: Major
                                                            Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return;
                                                              Severity: Major
                                                              Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                return;
                                                                Severity: Major
                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                                  return;
                                                                  Severity: Major
                                                                  Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                            return [$type];
                                                                    Severity: Major
                                                                    Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                      return;
                                                                      Severity: Major
                                                                      Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

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

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                                  return Issue::fromType(Issue::ParamTypeMismatch)(
                                                                                                      $context->getFile(),
                                                                                                      $context->getLineNumberStart(),
                                                                                                      [
                                                                                                      ($i + 1),
                                                                          Severity: Major
                                                                          Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                            return (new ContextNode(
                                                                                                $code_base,
                                                                                                $context,
                                                                                                $node
                                                                                            ))->getVariableStrict();
                                                                            Severity: Major
                                                                            Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                                  return [$type];
                                                                              Severity: Major
                                                                              Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                                return;
                                                                                Severity: Major
                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

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

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                        return;
                                                                                    Severity: Major
                                                                                    Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                      return;
                                                                                      Severity: Major
                                                                                      Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                                return $result ?: [$class::fromElementType(MixedType::instance(false), $type->isNullable(), $type->getKeyType())];
                                                                                        Severity: Major
                                                                                        Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                          return;
                                                                                          Severity: Major
                                                                                          Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                                return;
                                                                                            Severity: Major
                                                                                            Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                              return;
                                                                                              Severity: Major
                                                                                              Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                                        return [AssociativeArrayType::fromElementType($type->genericArrayElementType(), $type->isNullable(), $type->getKeyType())];
                                                                                                Severity: Major
                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

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

                                                                                                    Avoid too many return statements within this method.
                                                                                                    Open

                                                                                                                        return Issue::fromType(Issue::ParamSpecial4)(
                                                                                                                            $context->getFile(),
                                                                                                                            $context->getLineNumberStart(),
                                                                                                                            [
                                                                                                                            $function->getRepresentationForIssue(),
                                                                                                    Severity: Major
                                                                                                    Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                      Avoid too many return statements within this method.
                                                                                                      Open

                                                                                                                              return Issue::fromType(Issue::ParamTypeMismatch)(
                                                                                                                                  $context->getFile(),
                                                                                                                                  $context->getLineNumberStart(),
                                                                                                                                  [
                                                                                                                                  ($i + 1),
                                                                                                      Severity: Major
                                                                                                      Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                        Avoid too many return statements within this method.
                                                                                                        Open

                                                                                                                        return;
                                                                                                        Severity: Major
                                                                                                        Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                          Avoid too many return statements within this method.
                                                                                                          Open

                                                                                                                          return;
                                                                                                          Severity: Major
                                                                                                          Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                            Avoid too many return statements within this method.
                                                                                                            Open

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

                                                                                                              Avoid too many return statements within this method.
                                                                                                              Open

                                                                                                                                      return $result ?: [AssociativeArrayType::fromElementType(MixedType::instance(false), $type->isNullable(), $type->getKeyType())];
                                                                                                              Severity: Major
                                                                                                              Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                Avoid too many return statements within this method.
                                                                                                                Open

                                                                                                                                    return Issue::fromType(Issue::ParamSpecial3)(
                                                                                                                                        $context->getFile(),
                                                                                                                                        $context->getLineNumberStart(),
                                                                                                                                        [
                                                                                                                                        $function->getRepresentationForIssue(),
                                                                                                                Severity: Major
                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this method.
                                                                                                                  Open

                                                                                                                                  return;
                                                                                                                  Severity: Major
                                                                                                                  Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this method.
                                                                                                                    Open

                                                                                                                                                return [NonEmptyListType::fromElementType($type->genericArrayElementType(), $type->isNullable(), $type->getKeyType())];
                                                                                                                    Severity: Major
                                                                                                                    Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this method.
                                                                                                                      Open

                                                                                                                              return [
                                                                                                                                  'array_udiff' => $array_udiff_callback,
                                                                                                                                  'array_diff_uassoc' => $array_udiff_callback,
                                                                                                                                  'array_uintersect_assoc' => $array_udiff_callback,
                                                                                                                                  'array_intersect_ukey' => $array_udiff_callback,
                                                                                                                      Severity: Major
                                                                                                                      Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

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

                                                                                                                          Avoid too many return statements within this method.
                                                                                                                          Open

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

                                                                                                                            Avoid too many return statements within this method.
                                                                                                                            Open

                                                                                                                                                return Issue::fromType(Issue::ParamSpecial3)(
                                                                                                                                                    $context->getFile(),
                                                                                                                                                    $context->getLineNumberStart(),
                                                                                                                                                    [
                                                                                                                                                    $function->getRepresentationForIssue(),
                                                                                                                            Severity: Major
                                                                                                                            Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this method.
                                                                                                                              Open

                                                                                                                                              return;
                                                                                                                              Severity: Major
                                                                                                                              Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                Open

                                                                                                                                                    return [$type];
                                                                                                                                Severity: Major
                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                  Open

                                                                                                                                                          return;
                                                                                                                                  Severity: Major
                                                                                                                                  Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                    Open

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

                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                      Open

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

                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                        Open

                                                                                                                                                        return;
                                                                                                                                        Severity: Major
                                                                                                                                        Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                          Open

                                                                                                                                                          return;
                                                                                                                                          Severity: Major
                                                                                                                                          Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                            Open

                                                                                                                                                                return;
                                                                                                                                            Severity: Major
                                                                                                                                            Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                              Open

                                                                                                                                                              return;
                                                                                                                                              Severity: Major
                                                                                                                                              Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 30 mins to fix

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

                                                                                                                                                    private static function getAnalyzeFunctionCallClosuresStatic(): array
                                                                                                                                                    {
                                                                                                                                                        $stop_exception = new StopParamAnalysisException();
                                                                                                                                                
                                                                                                                                                        /**

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

                                                                                                                                                    private static function shouldWarnAboutImpossibleArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?UnionType $key_type = null, ?UnionType $array_type = null): bool
                                                                                                                                                    {
                                                                                                                                                        $array_type = $array_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
                                                                                                                                                        if (!$array_type->hasRealTypeSet()) {
                                                                                                                                                            return false;

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

                                                                                                                                                    private static function getAnalyzeFunctionCallClosuresStatic(): array
                                                                                                                                                    {
                                                                                                                                                        $stop_exception = new StopParamAnalysisException();
                                                                                                                                                
                                                                                                                                                        /**

                                                                                                                                                NPathComplexity

                                                                                                                                                Since: 0.1

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

                                                                                                                                                Example

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

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

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

                                                                                                                                                final class MiscParamPlugin extends PluginV3 implements
                                                                                                                                                    AnalyzeFunctionCallCapability
                                                                                                                                                {
                                                                                                                                                    /**
                                                                                                                                                     * @param list<Node|string|int|float> $args

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

                                                                                                                                                    private static function shouldWarnAboutImpossibleInArray(CodeBase $code_base, Context $context, array $args, ?UnionType $needle_type = null, ?UnionType $haystack_type = null): bool
                                                                                                                                                    {
                                                                                                                                                        $haystack_type = $haystack_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
                                                                                                                                                        if (!$haystack_type->hasRealTypeSet()) {
                                                                                                                                                            return false;

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

                                                                                                                                                    private static function getAnalyzeFunctionCallClosuresStatic(): array
                                                                                                                                                    {
                                                                                                                                                        $stop_exception = new StopParamAnalysisException();
                                                                                                                                                
                                                                                                                                                        /**

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

                                                                                                                                                    private static function shouldWarnAboutImpossibleInArray(CodeBase $code_base, Context $context, array $args, ?UnionType $needle_type = null, ?UnionType $haystack_type = null): bool
                                                                                                                                                    {
                                                                                                                                                        $haystack_type = $haystack_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
                                                                                                                                                        if (!$haystack_type->hasRealTypeSet()) {
                                                                                                                                                            return false;

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

                                                                                                                                                    private static function shouldWarnAboutImpossibleArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?UnionType $key_type = null, ?UnionType $array_type = null): bool
                                                                                                                                                    {
                                                                                                                                                        $array_type = $array_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
                                                                                                                                                        if (!$array_type->hasRealTypeSet()) {
                                                                                                                                                            return false;

                                                                                                                                                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 MiscParamPlugin has a coupling between objects value of 38. Consider to reduce the number of dependencies under 13.
                                                                                                                                                Open

                                                                                                                                                final class MiscParamPlugin extends PluginV3 implements
                                                                                                                                                    AnalyzeFunctionCallCapability
                                                                                                                                                {
                                                                                                                                                    /**
                                                                                                                                                     * @param list<Node|string|int|float> $args

                                                                                                                                                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

                                                                                                                                                            for ($i = 0; $i < ($argcount - 1); $i++) {
                                                                                                                                                                self::analyzeNodeUnionTypeCast(
                                                                                                                                                                    $args[$i],
                                                                                                                                                                    $context,
                                                                                                                                                                    $code_base,
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php and 1 other location - About 2 hrs to fix
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 638..658

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

                                                                                                                                                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

                                                                                                                                                            for ($i = 0; $i < ($argcount - 2); $i++) {
                                                                                                                                                                self::analyzeNodeUnionTypeCast(
                                                                                                                                                                    $args[$i],
                                                                                                                                                                    $context,
                                                                                                                                                                    $code_base,
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php and 1 other location - About 2 hrs to fix
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 424..444

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

                                                                                                                                                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

                                                                                                                                                        $placeholder = new Node(ast\AST_ARRAY, 0, [
                                                                                                                                                            new Node(ast\AST_ARRAY_ELEM, 0, ['key' => null, 'value' => $args[0]], 0),
                                                                                                                                                            new Node(ast\AST_ARRAY_ELEM, 0, ['key' => null, 'value' => $args[1]], 0),
                                                                                                                                                        ], 0);
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php and 1 other location - About 1 hr to fix
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 228..231

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

                                                                                                                                                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

                                                                                                                                                        $placeholder = new Node(ast\AST_ARRAY, 0, [
                                                                                                                                                            new Node(ast\AST_ARRAY_ELEM, 0, ['key' => null, 'value' => $args[0]], 0),
                                                                                                                                                            new Node(ast\AST_ARRAY_ELEM, 0, ['key' => null, 'value' => $args[1]], 0),
                                                                                                                                                        ], 0);
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php and 1 other location - About 1 hr to fix
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 214..217

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

                                                                                                                                                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 3 locations. Consider refactoring.
                                                                                                                                                Open

                                                                                                                                                            self::analyzeNodeUnionTypeCast(
                                                                                                                                                                $args[$argcount - 1],
                                                                                                                                                                $context,
                                                                                                                                                                $code_base,
                                                                                                                                                                CallableType::instance(false)->asPHPDocUnionType(),
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php and 2 other locations - About 1 hr to fix
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 406..422
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 620..636

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

                                                                                                                                                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 3 locations. Consider refactoring.
                                                                                                                                                Open

                                                                                                                                                            self::analyzeNodeUnionTypeCast(
                                                                                                                                                                $args[$argcount - 2],
                                                                                                                                                                $context,
                                                                                                                                                                $code_base,
                                                                                                                                                                CallableType::instance(false)->asPHPDocUnionType(),
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php and 2 other locations - About 1 hr to fix
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 406..422
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 602..618

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

                                                                                                                                                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 3 locations. Consider refactoring.
                                                                                                                                                Open

                                                                                                                                                            self::analyzeNodeUnionTypeCast(
                                                                                                                                                                $args[$argcount - 1],
                                                                                                                                                                $context,
                                                                                                                                                                $code_base,
                                                                                                                                                                CallableType::instance(false)->asPHPDocUnionType(),
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php and 2 other locations - About 1 hr to fix
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 602..618
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 620..636

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

                                                                                                                                                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

                                                                                                                                                        $in_array_callback = static function (
                                                                                                                                                            CodeBase $code_base,
                                                                                                                                                            Context $context,
                                                                                                                                                            FunctionInterface $unused_function,
                                                                                                                                                            array $args,
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php and 1 other location - About 1 hr to fix
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 1152..1166

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

                                                                                                                                                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

                                                                                                                                                        $array_key_exists_callback = static function (
                                                                                                                                                            CodeBase $code_base,
                                                                                                                                                            Context $context,
                                                                                                                                                            FunctionInterface $unused_function,
                                                                                                                                                            array $args,
                                                                                                                                                Severity: Major
                                                                                                                                                Found in src/Phan/Plugin/Internal/MiscParamPlugin.php and 1 other location - About 1 hr to fix
                                                                                                                                                src/Phan/Plugin/Internal/MiscParamPlugin.php on lines 1134..1148

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

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

                                                                                                                                                            ?Node $_

                                                                                                                                                ShortVariable

                                                                                                                                                Since: 0.2

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

                                                                                                                                                Example

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

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

                                                                                                                                                There are no issues that match your filters.

                                                                                                                                                Category
                                                                                                                                                Status