Showing 3,272 of 4,939 total issues

Method warnAboutInvalidUnionType has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        Node $node,
        Closure $is_valid_type,
        UnionType $left,
        UnionType $right,
        string $left_issue_type,
Severity: Minor
Found in src/Phan/Analysis/BinaryOperatorFlagVisitor.php - About 45 mins to fix

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

        public function visit(Node $node): UnionType
        {
            $left = UnionTypeVisitor::unionTypeFromNode(
                $this->code_base,
                $this->context,
    Severity: Minor
    Found in src/Phan/Analysis/BinaryOperatorFlagVisitor.php - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        private static function analyzeParameterTypesDocblockSignaturesMatch(
            CodeBase $code_base,
            FunctionInterface $method
        ): void {
            $phpdoc_parameter_map = $method->getPHPDocParameterTypeMap();
    Severity: Minor
    Found in src/Phan/Analysis/ParameterTypesAnalyzer.php - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method analyzeReturnStrict has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            CodeBase $code_base,
            FunctionInterface $method,
            UnionType $expression_type,
            UnionType $method_return_type,
            int $lineno,
    Severity: Minor
    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 45 mins to fix

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

          private static function checkCommentParametersAreInOrder(CodeBase $code_base, FunctionInterface $method): void
          {
              $comment = $method->getComment();
              if ($comment === null) {
                  return;
      Severity: Minor
      Found in src/Phan/Analysis/ParameterTypesAnalyzer.php - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method warnAboutInvalidUnionType has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              Node $node,
              Closure $is_valid_type,
              UnionType $left,
              UnionType $right,
              string $left_issue_type,
      Severity: Minor
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 45 mins to fix

        Method analyzeWriteOnlyReference has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                CodeBase $code_base,
                Context $context,
                FunctionInterface $method,
                Closure $set_variable_type,
                array $argument_list,
        Severity: Minor
        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 45 mins to fix

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

              private static function guessErrorColumnUsingPolyfill(
                  CodeBase $code_base,
                  Context $context,
                  string $file_path,
                  FileCacheEntry $file_cache_entry,
          Severity: Minor
          Found in src/Phan/AST/Parser.php - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Method guessErrorColumnUsingPolyfill has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  CodeBase $code_base,
                  Context $context,
                  string $file_path,
                  FileCacheEntry $file_cache_entry,
                  Error $native_parse_error,
          Severity: Minor
          Found in src/Phan/AST/Parser.php - About 45 mins to fix

            Method updateVariableWithConditionalFilter has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    Node $var_node,
                    Context $context,
                    Closure $should_filter_cb,
                    Closure $filter_union_type_cb,
                    bool $suppress_issues,
            Severity: Minor
            Found in src/Phan/Analysis/ConditionVisitorUtil.php - About 45 mins to fix

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

                  public static function getVariableSet($node): array
                  {
                      if (!$node instanceof Node) {
                          return [];
                      }
              Severity: Minor
              Found in src/Phan/Analysis/RedundantCondition.php - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Method parseCode has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      CodeBase $code_base,
                      Context $context,
                      ?Request $request,
                      string $file_path,
                      string $file_contents,
              Severity: Minor
              Found in src/Phan/AST/Parser.php - About 45 mins to fix

                Method updateParameterTypeByArgument has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        FunctionInterface $method,
                        Parameter $parameter,
                        $argument,
                        array $argument_types,
                        array &$parameter_list,
                Severity: Minor
                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 45 mins to fix

                  Method emitSyntaxErrorForNativeParseError has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          CodeBase $code_base,
                          Context $context,
                          string $file_path,
                          FileCacheEntry $file_cache_entry,
                          Error $native_parse_error,
                  Severity: Minor
                  Found in src/Phan/AST/Parser.php - About 45 mins to fix

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

                        public function readQueuedIssues(): void
                        {
                            // Get the status of the queue
                            // @phan-suppress-next-line PhanTypeMismatchArgumentInternal different in php 8.0
                            $status = \msg_stat_queue($this->message_queue_resource);
                    Severity: Minor
                    Found in src/Phan/Output/Collector/ParallelParentCollector.php - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

                        private static function markNodeAsSelected($n, $ast_node): void
                        {
                            // fwrite(STDERR, "Marking corresponding node as flagged: " . json_encode($n) . "\n" . \Phan\Debug::nodeToString($ast_node) . "\n");
                            // fflush(STDERR);
                            if ($ast_node instanceof ast\Node) {

                    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 phpParserClosureUsesToAstClosureUses has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function phpParserClosureUsesToAstClosureUses(
                            ?\Microsoft\PhpParser\Node\DelimitedList\UseVariableNameList $uses,
                            int $line
                        ): ?\ast\Node {
                            $children = $uses->children ?? [];
                    Severity: Minor
                    Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

                        private static function astNodeBinaryop(int $flags, PhpParser\Node\Expression\BinaryExpression $n, int $start_line)
                        {
                            try {
                                $left_node = static::phpParserNodeToAstNode($n->leftOperand);
                            } catch (InvalidNodeException $_) {
                    Severity: Minor
                    Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

                        private static function phpParserPropelemToAstPropelem($n, ?string $doc_comment): ast\Node
                        {
                            if ($n instanceof PhpParser\Node\Expression\AssignmentExpression) {
                                $name_node = $n->leftOperand;
                                if (!($name_node instanceof PhpParser\Node\Expression\Variable)) {
                    Severity: Minor
                    Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

                        protected function checkCalledFunction(Node $node, FunctionInterface $method): void
                        {
                            if ($method->isPure()) {
                                return;
                            }
                    Severity: Minor
                    Found in src/Phan/AST/InferPureVisitor.php - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language