Showing 3,272 of 4,939 total issues

Method checkDeprecatedUnparenthesizedConditional has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function checkDeprecatedUnparenthesizedConditional(Node $node, Node $cond): void
    {
        if ($cond->flags & flags\PARENTHESIZED_CONDITIONAL) {
            // The condition is unambiguously parenthesized.
            return;
Severity: Minor
Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

    Method getLoopNodeTypeFetcher has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getLoopNodeTypeFetcher(CodeBase $code_base, $node): ?Closure
        {
            if (!($node instanceof Node)) {
                // This scalar won't change.
                return null;
    Severity: Minor
    Found in src/Phan/Analysis/RedundantCondition.php - About 1 hr to fix

      Method phpParserIfStmtToAstIfStmt has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function phpParserIfStmtToAstIfStmt(PhpParser\Node\Statement\IfStatementNode $node, int $start_line): ast\Node
          {
              $if_elem = static::astIfElem(
                  static::phpParserNodeToAstNode($node->expression),
                  // @phan-suppress-next-line PhanTypeMismatchArgumentNullable return_null_on_empty is false.
      Severity: Minor
      Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 1 hr to fix

        Method dumpTreeAsString has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function dumpTreeAsString($ast_node, string $key = '', string $padding = ''): string
            {
                if ($ast_node instanceof Node) {
                    $first_part = \sprintf(
                        "%s%s%s%s\n",
        Severity: Minor
        Found in src/Phan/AST/TolerantASTConverter/NodeDumper.php - About 1 hr to fix

          Method phpParserVisibilityToAstVisibility has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function phpParserVisibilityToAstVisibility(array $visibility, bool $automatically_add_public = true): int
              {
                  $ast_visibility = 0;
                  foreach ($visibility as $token) {
                      switch ($token->kind) {
          Severity: Minor
          Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 1 hr to fix

            Method applyIfNegatedToIfElseReduction has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function applyIfNegatedToIfElseReduction(Node $node): Node
                {
                    if (count($node->children) !== 1) {
                        throw new AssertionError("Expected one child node");
                    }
            Severity: Minor
            Found in src/Phan/AST/ASTSimplifier.php - About 1 hr to fix

              Method getEquivalentArraySet has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getEquivalentArraySet(Node $node): ?array
                  {
                      $elements = [];
                      $context_node = null;
                      foreach ($node->children as $child_node) {
              Severity: Minor
              Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

                Method visitType has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function visitType(Node $node): UnionType
                    {
                        switch ($node->flags) {
                            case \ast\flags\TYPE_ARRAY:
                                return ArrayType::instance(false)->asRealUnionType();
                Severity: Minor
                Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

                  Method getVariable has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getVariable(): 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 updateSignatureParamNames has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function updateSignatureParamNames(string $function_like_name, array $arguments_from_phan): array
                        {
                            $arguments_from_external_stub = $this->parseFunctionLikeSignature($function_like_name);
                            if (is_null($arguments_from_external_stub)) {
                                return $arguments_from_phan;
                    Severity: Minor
                    Found in internal/lib/IncompatibleRealStubsSignatureDetector.php - About 1 hr to fix

                      Method visitIf has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function visitIf(Node $node): void
                          {
                              // @phan-suppress-next-line PhanUndeclaredProperty set by ASTSimplifier
                              if (isset($node->is_simplified)) {
                                  $first_child = end($node->children);
                      Severity: Minor
                      Found in .phan/plugins/EmptyStatementListPlugin.php - About 1 hr to fix

                        Method analyzePostponedMethod has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private static function analyzePostponedMethod(
                                CodeBase $code_base,
                                FunctionInterface $method
                            ): void {
                                if ($method instanceof Method) {
                        Severity: Minor
                        Found in .phan/plugins/PossiblyStaticMethodPlugin.php - About 1 hr to fix

                          Function locateGlobalConstantCompletion has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static function locateGlobalConstantCompletion(
                                  CompletionRequest $request,
                                  CodeBase $code_base,
                                  Context $context,
                                  Node $node,
                          Severity: Minor
                          Found in src/Phan/LanguageServer/CompletionResolver.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 usage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function usage(string $msg = '', ?int $exit_code = EXIT_SUCCESS, int $usage_type = UsageException::PRINT_NORMAL, bool $forbid_color = true): void
                              {
                                  global $argv;
                          
                                  if ($msg !== '') {
                          Severity: Minor
                          Found in src/Phan/CLI.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 locateGlobalFunctionCompletion has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static function locateGlobalFunctionCompletion(
                                  CompletionRequest $request,
                                  CodeBase $code_base,
                                  Context $context,
                                  Node $node,
                          Severity: Minor
                          Found in src/Phan/LanguageServer/CompletionResolver.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 childSignalHandler has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function childSignalHandler(int $signo, $status = null, ?int $pid = null): void
                              {
                                  // test
                                  if ($signo !== SIGCHLD) {
                                      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 analyzeInheritedMethods has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function analyzeInheritedMethods(CodeBase $code_base): void
                              {
                                  if ($this->isClass() && !$this->isAbstract()) {
                                      foreach ($this->getMethodMap($code_base) as $method) {
                                          if ($method->getRealDefiningFQSEN() === $method->getFQSEN()) {
                          Severity: Minor
                          Found in src/Phan/Language/Element/Clazz.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 addProperty has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function addProperty(
                                  CodeBase $code_base,
                                  Property $property,
                                  Option $type_option,
                                  bool $from_trait = false
                          Severity: Minor
                          Found in src/Phan/Language/Element/Clazz.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 locateConstructorDefinitionForUnionType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static function locateConstructorDefinitionForUnionType(
                                  GoToDefinitionRequest $request,
                                  CodeBase $code_base,
                                  UnionType $union_type
                              ): void {
                          Severity: Minor
                          Found in src/Phan/LanguageServer/DefinitionResolver.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 getProjectRelativePathForPath has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function getProjectRelativePathForPath(string $cwd_relative_path): string
                              {
                                  if ($cwd_relative_path === '') {
                                      return '';
                                  }
                          Severity: Minor
                          Found in src/Phan/Language/FileRef.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