Showing 3,272 of 4,939 total issues

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

    public function visitThrow(Node $node): void
    {
        $code_base = $this->code_base;
        $context = $this->context;
        $union_type = UnionTypeVisitor::unionTypeFromNode($code_base, $context, $node->children['expr']);
Severity: Minor
Found in src/Phan/Plugin/Internal/ThrowAnalyzerPlugin.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 analyze has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public static function analyze(
        FunctionInterface $method,
        Node $node,
        Context $context,
        CodeBase $code_base
Severity: Minor
Found in src/Phan/Analysis/ArgumentType.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 parseCommentLine has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function parseCommentLine(int $i, string $line): void
    {
        // https://secure.php.net/manual/en/regexp.reference.internal-options.php
        // (?i) makes this case-sensitive, (?-1) makes it case-insensitive
        // phpcs:ignore Generic.Files.LineLength.MaxExceeded
Severity: Major
Found in src/Phan/Language/Element/Comment/Builder.php - About 4 hrs to fix

    Method dumpGraphML has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function dumpGraphML(string $title, array $graph, bool $is_classgraph, bool $hide_labels): void
        {
            $node_id = 0;
            $edge_id = 0;
    
    
    Severity: Major
    Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 4 hrs to fix

      Method fromNode has 100 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function fromNode(
              Context $context,
              CodeBase $code_base,
              Node $node,
              FullyQualifiedFunctionName $fqsen
      Severity: Major
      Found in src/Phan/Language/Element/Func.php - About 4 hrs to fix

        Method visitMatchArmList has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function visitMatchArmList(Node $node): Context
            {
                // Make a copy of the internal context so that we don't
                // leak any changes within the closed context to the
                // outer scope
        Severity: Major
        Found in src/Phan/BlockAnalysisVisitor.php - About 4 hrs to fix

          Method checkCall has 100 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function checkCall(FunctionInterface $function, array $args, Node $node): void
              {
                  $arg_names = [];
                  foreach ($args as $i => $arg_node) {
                      $name = self::extractName($arg_node);
          Severity: Major
          Found in .phan/plugins/SuspiciousParamOrderPlugin.php - About 4 hrs to fix

            File UnknownElementTypePlugin.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              File UseReturnValueVisitor.php has 331 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              declare(strict_types=1);
              
              namespace Phan\Plugin\Internal\UseReturnValuePlugin;

                Method analyzeProp has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function analyzeProp(Node $node, bool $is_static): UnionType
                    {
                        // Either expr(instance) or class(static) is set
                        $expr_node = $node->children['expr'] ?? null;
                        try {
                Severity: Major
                Found in src/Phan/AST/UnionTypeVisitor.php - About 3 hrs to fix

                  Function resolveTemplateType has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function resolveTemplateType(
                          CodeBase $code_base,
                          UnionType $object_union_type
                      ): Method {
                          $defining_fqsen = $this->getDefiningClassFQSEN();
                  Severity: Minor
                  Found in src/Phan/Language/Element/Method.php - About 3 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 visitIf has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function visitIf(Node $node): Context
                      {
                          $context = $this->context->withLineNumberStart(
                              $node->lineno
                          );
                  Severity: Minor
                  Found in src/Phan/BlockAnalysisVisitor.php - About 3 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 getConfigErrors has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getConfigErrors(array $configuration): array
                      {
                          /**
                           * @param mixed $value
                           */
                  Severity: Minor
                  Found in src/Phan/Config.php - About 3 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 finalizeProcess has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function finalizeProcess(CodeBase $code_base): void
                      {
                          if (!self::$use_dynamic) {
                              return;
                          }
                  Severity: Minor
                  Found in src/Phan/Plugin/Internal/UseReturnValuePlugin.php - About 3 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 visitProp has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function visitProp(Node $node): Context
                      {
                          // Get class list first, warn if the class list is invalid.
                          try {
                              $class_list = (new ContextNode(
                  Severity: Minor
                  Found in src/Phan/Analysis/AssignmentVisitor.php - About 3 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 checkAbstractStaticMethodCall has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static function checkAbstractStaticMethodCall(
                          FunctionInterface $method,
                          Node $node,
                          Context $context,
                          CodeBase $code_base
                  Severity: Minor
                  Found in src/Phan/Analysis/ArgumentType.php - About 3 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 analyzeCallToFunctionLike has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function analyzeCallToFunctionLike(
                          FunctionInterface $method,
                          Node $node
                      ): void {
                          $code_base = $this->code_base;
                  Severity: Minor
                  Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 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

                  NativeType has 31 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  abstract class NativeType extends Type
                  {
                      public const NAME = '';
                  
                      /** @phan-override */
                  Severity: Minor
                  Found in src/Phan/Language/Type/NativeType.php - About 3 hrs to fix

                    File SuspiciousParamOrderPlugin.php has 326 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    declare(strict_types=1);
                    
                    use ast\Node;
                    Severity: Minor
                    Found in .phan/plugins/SuspiciousParamOrderPlugin.php - About 3 hrs to fix

                      Method combineScopeList has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function combineScopeList(array $scope_list): Context
                          {
                              if (\count($scope_list) < 2) {
                                  throw new AssertionError("Expected at least two child contexts in " . __METHOD__);
                              }
                      Severity: Major
                      Found in src/Phan/Analysis/ContextMergeVisitor.php - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language