Showing 3,272 of 4,939 total issues

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

    public function visitDim(Node $node): Context
    {
        $expr_node = $node->children['expr'];
        if (!($expr_node instanceof Node)) {
            $this->emitIssue(
Severity: Minor
Found in src/Phan/Analysis/AssignmentVisitor.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    private static function analyzePassByReferenceArgument(
        CodeBase $code_base,
        Context $context,
        Node $argument,
        array $argument_list,
Severity: Minor
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function visitReturn(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 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    private static function phpParserStmtlistToAstNode($parser_nodes, ?int $lineno, bool $return_null_on_empty = false): ?\ast\Node
    {
        if ($parser_nodes instanceof PhpParser\Node\Statement\CompoundStatementNode) {
            $parser_nodes = $parser_nodes->statements;
        } elseif ($parser_nodes instanceof PhpParser\Node\StatementNode) {
Severity: Minor
Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function visitConditional(Node $node): UnionType
    {
        $cond_node = $node->children['cond'];
        $cond_truthiness = self::checkCondUnconditionalTruthiness($cond_node);
        // For the shorthand $a ?: $b, the cond node will be the truthy value.
Severity: Minor
Found in src/Phan/AST/UnionTypeVisitor.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    private static function normalizeIfStatement(Node $original_node): array
    {
        $nodes = [$original_node];
        // Repeatedly apply these rules
        do {
Severity: Minor
Found in src/Phan/AST/ASTSimplifier.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function getFunction(
        string $function_name,
        bool $is_function_declaration = false,
        bool $return_placeholder_for_undefined = false
    ): FunctionInterface {
Severity: Minor
Found in src/Phan/AST/ContextNode.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method visitVar has 106 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function visitVar(Node $node): UnionType
    {
        // $$var or ${...} (whose idea was that anyway?)
        $name_node = $node->children['name'];
        if (($name_node instanceof Node)) {
Severity: Major
Found in src/Phan/AST/UnionTypeVisitor.php - About 4 hrs to fix

    Method finishAnalyzingRemainingStatements has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function finishAnalyzingRemainingStatements(
            CodeBase $code_base,
            ?Request $request,
            array $analyze_file_path_list,
            array $temporary_file_mapping
    Severity: Major
    Found in src/Phan/Phan.php - About 4 hrs to fix

      Method analyzeParameterListForCallback has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method initTypeModifyingClosuresForVisitCall has 105 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function initTypeModifyingClosuresForVisitCall(): array
            {
                $make_direct_assertion_callback = static function (string $union_type_string): Closure {
                    $asserted_union_type = UnionType::fromFullyQualifiedRealString(
                        $union_type_string
        Severity: Major
        Found in src/Phan/Analysis/ConditionVisitor.php - About 4 hrs to fix

          Method computeIntOrFloatOperationResult has 105 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function computeIntOrFloatOperationResult(
                  Node $node,
                  UnionType $left,
                  UnionType $right
              ): UnionType {
          Severity: Major
          Found in src/Phan/Analysis/BinaryOperatorFlagVisitor.php - About 4 hrs to fix

            File Debug.php has 340 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            declare(strict_types=1);
            
            namespace Phan;
            Severity: Minor
            Found in src/Phan/Debug.php - About 4 hrs to fix

              Method analyzeBackwardCompatibility has 103 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function analyzeBackwardCompatibility(): void
                  {
                      if (!Config::get_backward_compatibility_checks()) {
                          return;
                      }
              Severity: Major
              Found in src/Phan/AST/ContextNode.php - About 4 hrs to fix

                File DeprecateAliasPlugin.php has 337 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                declare(strict_types=1);
                
                use Phan\CodeBase;
                Severity: Minor
                Found in .phan/plugins/DeprecateAliasPlugin.php - About 4 hrs to fix

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

                      public static function fromNode(
                          Context $context,
                          CodeBase $code_base,
                          Node $node
                      ): Parameter {
                  Severity: Minor
                  Found in src/Phan/Language/Element/Parameter.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function asFunctionInterfaceOrNull has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function asFunctionInterfaceOrNull(CodeBase $code_base, Context $context): ?FunctionInterface
                      {
                          if (\count($this->field_types) !== 2) {
                              Issue::maybeEmit(
                                  $code_base,
                  Severity: Minor
                  Found in src/Phan/Language/Type/ArrayShapeType.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function extractTypePartsForStringInContext has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static function extractTypePartsForStringInContext(string $type_string): array
                      {
                          static $cache = [];
                          $parts = $cache[$type_string] ?? null;
                          if (\is_array($parts)) {
                  Severity: Minor
                  Found in src/Phan/Language/UnionType.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function createSwitchConditionAnalyzer has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function createSwitchConditionAnalyzer($switch_case_node): array
                      {
                          $switch_kind = ($switch_case_node->kind ?? null);
                          try {
                              if ($switch_kind === ast\AST_VAR) {
                  Severity: Minor
                  Found in src/Phan/BlockAnalysisVisitor.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function dumpClassDot has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function dumpClassDot(string $title, array $graph = null): void
                      {
                          if (!$graph) {
                              $graph = $this->cgraph;
                          }
                  Severity: Minor
                  Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language