Showing 3,272 of 4,939 total issues

Method analyzeForCallback has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function analyzeForCallback(
        FunctionInterface $method,
        array $arg_nodes,
        Context $context,
        CodeBase $code_base,
Severity: Major
Found in src/Phan/Analysis/ArgumentType.php - About 2 hrs to fix

    Method visitClassNameNode has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function visitClassNameNode(Node $node): UnionType
        {
            $kind = $node->kind;
            // Anonymous class of form `new class { ... }`
            if ($kind === \ast\AST_CLASS
    Severity: Major
    Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

      Method classTypesForNonName has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function classTypesForNonName(Node $node): UnionType
          {
              $node_type = UnionTypeVisitor::unionTypeFromNode(
                  $this->code_base,
                  $this->context,
      Severity: Major
      Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

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

            public static function createGoToDefinitionClosure(GoToDefinitionRequest $request, CodeBase $code_base): Closure
            {
                /**
                 * @param list<Node> $parent_node_list
                 */
        Severity: Major
        Found in src/Phan/LanguageServer/DefinitionResolver.php - About 2 hrs to fix

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

              private function addClosureForDependentTemplateType(CodeBase $code_base, Context $context, array $template_type_list): void
              {
                  if ($this->hasDependentReturnType()) {
                      // We already added this or this conflicts with a plugin.
                      return;
          Severity: Major
          Found in src/Phan/Language/Element/FunctionTrait.php - About 2 hrs to fix

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

                private static function getReturnTypeOverridesStatic(CodeBase $code_base): array
                {
                    $basic_return_type_overrides = (new DependentReturnTypeOverridePlugin())->getReturnTypeOverrides($code_base);
                    /**
                     * @param callable-string $function

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

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

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

                    public static function isExpressionReturningReference(CodeBase $code_base, Context $context, $node): bool
                    {
                        if (!($node instanceof Node)) {
                            return false;
                        }
                Severity: Major
                Found in src/Phan/Analysis/ArgumentType.php - About 2 hrs to fix

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

                      public function analyzeClassAssertion($object_node, $expr_node): ?Context
                      {
                          if (!($object_node instanceof Node)) {
                              return null;
                          }
                  Severity: Major
                  Found in src/Phan/Analysis/ConditionVisitorUtil.php - About 2 hrs to fix

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

                        public function visitNew(Node $node): Context
                        {
                            $class_list = [];
                            try {
                                $context_node = new ContextNode(
                    Severity: Major
                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

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

                          public static function parseCodePolyfill(CodeBase $code_base, Context $context, string $file_path, string $file_contents, bool $suppress_parse_errors, ?Request $request, array &$errors = []): Node
                          {
                              // @phan-suppress-next-line PhanRedundantCondition
                              if (!\in_array(Config::AST_VERSION, TolerantASTConverter::SUPPORTED_AST_VERSIONS, true)) {
                                  throw new \Error(\sprintf("Unexpected polyfill version: want %s, got %d", \implode(', ', TolerantASTConverter::SUPPORTED_AST_VERSIONS), Config::AST_VERSION));
                      Severity: Major
                      Found in src/Phan/AST/Parser.php - About 2 hrs to fix

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

                            private function functionLikeFQSENListFromNode($node): array
                            {
                                $orig_node = $node;
                                if ($node instanceof Node) {
                                    $node = (new ContextNode($this->code_base, $this->context, $node))->getEquivalentPHPValue();
                        Severity: Major
                        Found in src/Phan/AST/UnionTypeVisitor.php - About 2 hrs to fix

                          Function addInternalFunctionsByNames has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function addInternalFunctionsByNames(array $internal_function_name_list): void
                              {
                                  $included_extension_subset = self::getIncludedExtensionSubset();
                                  if (is_array($included_extension_subset)) {
                                      $forbidden_function_set = [];
                          Severity: Minor
                          Found in src/Phan/CodeBase.php - About 2 hrs to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Function directoryNameToFileList has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static function directoryNameToFileList(
                                  string $directory_name
                              ): array {
                                  $file_list = [];
                          
                          
                          Severity: Minor
                          Found in src/Phan/CLI.php - About 2 hrs to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Function generateDefaultNodeRepresentation has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function generateDefaultNodeRepresentation(bool $is_internal = true): string
                              {
                                  if (is_string($this->default_value_representation)) {
                                      return $this->default_value_representation;
                                  }
                          Severity: Minor
                          Found in src/Phan/Language/Element/Parameter.php - About 2 hrs to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Function importAncestorClass has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function importAncestorClass(
                                  CodeBase $code_base,
                                  Clazz $class,
                                  Option $type_option
                              ): void {
                          Severity: Minor
                          Found in src/Phan/Language/Element/Clazz.php - About 2 hrs to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Function toStubSignature has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function toStubSignature(CodeBase $code_base): string
                              {
                                  $string = '';
                          
                                  if ($this->isFinal()) {
                          Severity: Minor
                          Found in src/Phan/Language/Element/Clazz.php - About 2 hrs to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Function addParamsToScopeOfFunctionOrMethod has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function addParamsToScopeOfFunctionOrMethod(
                                  Context $context,
                                  CodeBase $code_base,
                                  FunctionInterface $function,
                                  Comment $comment
                          Severity: Minor
                          Found in src/Phan/Language/Element/FunctionTrait.php - About 2 hrs to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Function fromNode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function fromNode(
                                  Context $context,
                                  CodeBase $code_base,
                                  Node $node,
                                  FullyQualifiedMethodName $fqsen,
                          Severity: Minor
                          Found in src/Phan/Language/Element/Method.php - About 2 hrs to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Function asGeneratorTemplateType has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function asGeneratorTemplateType(): Type
                              {
                                  $fallback_values = UnionType::empty();
                                  $fallback_keys = UnionType::empty();
                          
                          
                          Severity: Minor
                          Found in src/Phan/Language/UnionType.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

                          Severity
                          Category
                          Status
                          Source
                          Language