Showing 3,272 of 4,939 total issues

Method updateDimExpressionWithConditionalFilter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    final protected function updateDimExpressionWithConditionalFilter(
        Node $node,
        Context $context,
        Closure $should_filter_cb,
        Closure $filter_union_type_cb,
Severity: Minor
Found in src/Phan/Analysis/ConditionVisitorUtil.php - About 1 hr to fix

    Method visitYieldFrom has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function visitYieldFrom(Node $node): Context
        {
            $context = $this->context;
            // Make sure we're actually returning from a method.
            if (!$context->isInFunctionLikeScope()) {
    Severity: Minor
    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

      Method visitBinaryOp has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function visitBinaryOp(Node $node): UnionType
          {
              switch ($node->flags) {
                  case flags\BINARY_ADD:
                      return UnionType::fromFullyQualifiedRealString('int|float|array');
      Severity: Minor
      Found in src/Phan/AST/FallbackUnionTypeVisitor.php - About 1 hr to fix

        Method unionTypeFromNode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function unionTypeFromNode(
                CodeBase $code_base,
                Context $context,
                $node,
                bool $should_catch_issue_exception = true
        Severity: Minor
        Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

          Method getVariableStrict has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getVariableStrict(): Variable
              {
                  $node = $this->node;
                  if (!($node instanceof Node)) {
                      throw new AssertionError('$this->node must be a node');
          Severity: Minor
          Found in src/Phan/AST/ContextNode.php - About 1 hr to fix

            Method getFunctionLikeFromDynamicExpression has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function getFunctionLikeFromDynamicExpression(): \Generator
                {
                    $code_base = $this->code_base;
                    $context = $this->context;
                    $expression = $this->node;
            Severity: Minor
            Found in src/Phan/AST/ContextNode.php - About 1 hr to fix

              Method getClassForVariable has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function getClassForVariable(Node $expr): Clazz
                  {
                      if ($expr->kind !== ast\AST_VAR) {
                          // TODO: Support static properties, (new X()), other expressions with inferable types
                          throw new NodeException($expr, 'expected simple variable');
              Severity: Minor
              Found in src/Phan/AST/InferPureSnippetVisitor.php - About 1 hr to fix

                Method visitClass has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function visitClass(Node $node): array
                    {
                        [$property_descriptions, $method_descriptions] = parent::visitClass($node);
                        foreach (self::findGroups($property_descriptions) as $entries) {
                            $first_entry = array_shift($entries);
                Severity: Minor
                Found in .phan/plugins/HasPHPDocPlugin.php - About 1 hr to fix

                  Method visitArray has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function visitArray(Node $node): void
                      {
                          $children = $node->children;
                          if (count($children) <= 1) {
                              // This plugin will never emit errors if there are 0 or 1 elements.
                  Severity: Minor
                  Found in .phan/plugins/DuplicateArrayKeyPlugin.php - About 1 hr to fix

                    Method generateStaticElementSuggestionsForClass has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function generateStaticElementSuggestionsForClass(string $class, string $instance_element_prefix): array
                        {
                            // TODO support ::class
                            if (!class_exists($class)) {
                                return [];
                    Severity: Minor
                    Found in tool/phan_repl_helpers.php - About 1 hr to fix

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

                          private static function adjustFileMappingContentsForCompletionRequest(
                              array $file_mapping_contents,
                              CompletionRequest $completion_request
                          ): array {
                              $file = FileRef::getProjectRelativePathForPath($completion_request->getPath());
                      Severity: Minor
                      Found in src/Phan/Daemon/Request.php - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                          private static function applyTemporaryFileMappingForParsePhase(CodeBase $code_base, array $temporary_file_mapping_contents): void
                          {
                              if (count($temporary_file_mapping_contents) === 0) {
                                  return;
                              }
                      Severity: Minor
                      Found in src/Phan/Daemon/Request.php - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                          public static function reloadFilePathListForDaemon(CodeBase $code_base, Closure $file_path_lister, array $file_mapping_contents, array $file_names = null): void
                          {
                              $old_count = $code_base->getParsedFilePathCount();
                      
                              $file_list = $file_path_lister(true);
                      Severity: Minor
                      Found in src/Phan/Daemon/Request.php - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

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

                      Cognitive Complexity

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

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

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

                      Further reading

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

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

                      Cognitive Complexity

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

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

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

                      Further reading

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

                          public static function findLineNumberOfCommentForElement(AddressableElementInterface $element, array $lines, int $i): int
                          {
                              $context = $element->getContext();
                      
                              $entry = FileCache::getOrReadEntry(Config::projectPath($context->getFile()));
                      Severity: Minor
                      Found in src/Phan/Language/Element/Comment/Builder.php - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                          public function inheritRealParameterDefaults(): void
                          {
                              foreach ($this->real_parameter_list as $i => $real_parameter) {
                                  $parameter = $this->parameter_list[$i] ?? null;
                                  if (!$parameter || $parameter->isVariadic() || $real_parameter->isVariadic()) {
                      Severity: Minor
                      Found in src/Phan/Language/Element/FunctionTrait.php - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                          public function getCommentParamAssertionClosure(CodeBase $code_base): ?Closure
                          {
                              if (!\is_object($this->comment)) {
                                  return null;
                              }
                      Severity: Minor
                      Found in src/Phan/Language/Element/FunctionTrait.php - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                          private static function computeNewTypeForComment(CodeBase $code_base, Context $context, UnionType $signature_union_type, UnionType $comment_return_union_type): UnionType
                          {
                              $new_type = $comment_return_union_type;
                              foreach ($comment_return_union_type->getTypeSet() as $type) {
                                  if (!$type->asPHPDocUnionType()->canAnyTypeStrictCastToUnionType($code_base, $signature_union_type)) {
                      Severity: Minor
                      Found in src/Phan/Language/Element/Method.php - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                          public function getThisPropertyIfOverridden(string $name): ?UnionType
                          {
                              if (!$this->scope->hasVariableWithName(self::VAR_NAME_THIS_PROPERTIES)) {
                                  return null;
                              }
                      Severity: Minor
                      Found in src/Phan/Language/Context.php - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      Severity
                      Category
                      Status
                      Source
                      Language