Showing 3,272 of 4,939 total issues

Method recursivelyMarkNodesAsPure has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function recursivelyMarkNodesAsPure(): void
    {
        // Go through the graph. Any nodes that are impure would either never be added to $this->functions,
        // or be removed in handleImpureFunction.
        $reverse_edges = [];
Severity: Minor
Found in src/Phan/Plugin/Internal/UseReturnValuePlugin/PureMethodGraph.php - About 1 hr to fix

    Method astDump has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function astDump($ast, int $options = 0): string
        {
            if ($ast instanceof Node) {
                $result = Parser::getKindName($ast->kind);
    
    
    Severity: Minor
    Found in src/Phan/Debug.php - About 1 hr to fix

      Method getParameterCategory has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getParameterCategory(Node $method_node): string
          {
              $kind = $method_node->kind;
              if ($kind === ast\AST_CLOSURE) {
                  return Issue::UnusedClosureParameter;
      Severity: Minor
      Found in src/Phan/Plugin/Internal/VariableTrackerPlugin.php - About 1 hr to fix

        Method visitAssignOp has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function visitAssignOp(Node $node): VariableTrackingScope
            {
                $expr = $node->children['expr'];
                if ($expr instanceof Node) {
                    $this->scope = $this->analyze($this->scope, $expr);
        Severity: Minor
        Found in src/Phan/Plugin/Internal/VariableTracker/VariableTrackerVisitor.php - About 1 hr to fix

          Method visitConstDecl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function visitConstDecl(Node $node): Context
              {
                  foreach ($node->children as $child_node) {
                      if (!$child_node instanceof Node) {
                          throw new AssertionError("Expected global constant element to be a Node");
          Severity: Minor
          Found in src/Phan/Parse/ParseVisitor.php - About 1 hr to fix

            Method combineTypesAfterStrictEqualityCheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function combineTypesAfterStrictEqualityCheck(UnionType $old_union_type, UnionType $new_union_type): UnionType
                {
                    // TODO: Be more precise about these checks - e.g. forbid anything such as stdClass == false in the new type
                    if (!$new_union_type->hasRealTypeSet()) {
                        return $new_union_type->withRealTypeSet($old_union_type->getRealTypeSet());
            Severity: Minor
            Found in src/Phan/Analysis/ConditionVisitorUtil.php - About 1 hr to fix

              Method isAssignmentOrNestedAssignment has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function isAssignmentOrNestedAssignment(Node $node): ?bool
                  {
                      $parent_node_list = $this->parent_node_list;
                      $parent_node = \end($parent_node_list);
                      if (!$parent_node instanceof Node) {
              Severity: Minor
              Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                Method checkForInfiniteRecursion has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function checkForInfiniteRecursion(Node $node, FunctionInterface $method): void
                    {
                        $argument_list_node = $node->children['args'];
                        $kind = $node->kind;
                        if ($kind === ast\AST_METHOD_CALL || $kind === ast\AST_NULLSAFE_METHOD_CALL) {
                Severity: Minor
                Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                  Method print has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function print(IssueInstance $instance): void
                      {
                          $issue = $instance->getIssue();
                          $message = [
                              'type' => 'issue',
                  Severity: Minor
                  Found in src/Phan/Output/Printer/JSONPrinter.php - About 1 hr to fix

                    Method visitInstanceof has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function visitInstanceof(Node $node): Context
                        {
                            try {
                                // Fetch the class list, and emit warnings as a side effect.
                                // TODO: Unify UnionTypeVisitor, AssignmentVisitor, and PostOrderAnalysisVisitor
                    Severity: Minor
                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                      Method print has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function print(IssueInstance $instance): void
                          {
                              $issue = $instance->getIssue();
                              $message = [
                                  'type' => 'issue',
                      Severity: Minor
                      Found in src/Phan/Output/Printer/CapturingJSONPrinter.php - About 1 hr to fix

                        Method phpParserListToAstList has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private static function phpParserListToAstList(PhpParser\Node\Expression\ListIntrinsicExpression $n, int $start_line): ast\Node
                            {
                                $ast_items = [];
                                $prev_was_element = false;
                                foreach ($n->listElements->children ?? [] as $item) {
                        Severity: Minor
                        Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 1 hr to fix

                          Method checkInvalidUnpackKeyType has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function checkInvalidUnpackKeyType(Node $node, UnionType $union_type, bool $is_array_spread): void
                              {
                                  $is_invalid_because_associative = false;
                                  if (!$is_array_spread) {
                                      foreach ($union_type->getTypeSet() as $type) {
                          Severity: Minor
                          Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

                            Method analyzeReturnTypeOfFunctionLike has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private static function analyzeReturnTypeOfFunctionLike(CodeBase $code_base, FunctionInterface $method): void
                                {
                                    $union_type = $method->getUnionType();
                                    if ($union_type->isVoidType()) {
                                        self::emitIssue(
                            Severity: Minor
                            Found in .phan/plugins/PHPDocToRealTypesPlugin.php - About 1 hr to fix

                              Method analyzeEqualityCheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function analyzeEqualityCheck(Node $node): void
                                  {
                                      ['left' => $left, 'right' => $right] = $node->children;
                                      $left_is_const = ParseVisitor::isConstExpr($left);
                                      $right_is_const = ParseVisitor::isConstExpr($right);
                              Severity: Minor
                              Found in .phan/plugins/StrictLiteralComparisonPlugin.php - About 1 hr to fix

                                Method generateStaticObjectCompletions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function generateStaticObjectCompletions(array $tokens, string $completed_text): array
                                    {
                                        $i = count($tokens) - 1;
                                        $this->appendToLogFile("generateStaticObjectCompletions tokens = " . StringUtil::jsonEncode($tokens) . "\n");
                                        while (!is_array($tokens[$i]) || $tokens[$i][0] !== T_DOUBLE_COLON) {
                                Severity: Minor
                                Found in tool/phan_repl_helpers.php - About 1 hr to fix

                                  Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          Context $context,
                                          string $name,
                                          UnionType $type,
                                          int $flags,
                                          FullyQualifiedClassName $fqsen,
                                  Severity: Major
                                  Found in src/Phan/Language/Element/Clazz.php - About 1 hr to fix

                                    Method analyzeParameter has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        public static function analyzeParameter(CodeBase $code_base, Context $context, FunctionInterface $method, UnionType $argument_type, int $lineno, int $i, $argument_node, ?Node $node): void
                                    Severity: Major
                                    Found in src/Phan/Analysis/ArgumentType.php - About 1 hr to fix

                                      Method analyzePassByReferenceArgument has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                              CodeBase $code_base,
                                              Context $context,
                                              Node $argument,
                                              array $argument_list,
                                              FunctionInterface $method,
                                      Severity: Major
                                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                                        Consider simplifying this complex logical expression.
                                        Open

                                                        if (!$o_parameter_union_type->isEqualTo($parameter_union_type) &&
                                                            !($parameter_union_type->containsNullable() && $o_parameter_union_type->isEqualTo($parameter_union_type->nonNullableClone()))
                                                        ) {
                                                            // There is one exception to this in php 7.1 - the pseudo-type "iterable" can replace ArrayAccess/array in a subclass
                                                            // TODO: Traversable and array work, but Iterator doesn't. Check for those specific cases?
                                        Severity: Major
                                        Found in src/Phan/Analysis/ParameterTypesAnalyzer.php - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language