Showing 3,272 of 4,939 total issues

Method createClosureForUnionTypeExtractorAndAssertionType has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function createClosureForUnionTypeExtractorAndAssertionType(Closure $union_type_extractor, int $assertion_type, int $i): ?Closure
    {
        switch ($assertion_type) {
            case Assertion::IS_OF_TYPE:
                /**
Severity: Minor
Found in src/Phan/Language/Element/FunctionTrait.php - About 1 hr to fix

    Method getKeyTypeOfArrayNode has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getKeyTypeOfArrayNode(CodeBase $code_base, Context $context, Node $node, bool $should_catch_issue_exception = true): int
        {
            $key_type_enum = GenericArrayType::KEY_EMPTY;
            // Check the all elements for key types.
            foreach ($node->children as $child) {
    Severity: Minor
    Found in src/Phan/Language/Type/GenericArrayType.php - About 1 hr to fix

      Method asExpandedTypesPreservingTemplate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function asExpandedTypesPreservingTemplate(
              CodeBase $code_base,
              int $recursion_depth = 0
          ): UnionType {
              // We're going to assume that if the type hierarchy
      Severity: Minor
      Found in src/Phan/Language/Type/GenericArrayType.php - About 1 hr to fix

        Method isStrictSubtypeOf has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function isStrictSubtypeOf(CodeBase $code_base, UnionType $target): bool
            {
                // Fast-track most common cases first
                $type_set = $this->type_set;
                // If either type is unknown, we can't call it
        Severity: Minor
        Found in src/Phan/Language/UnionType.php - About 1 hr to fix

          Method canStrictCastToUnionType has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function canStrictCastToUnionType(CodeBase $code_base, UnionType $target): bool
              {
                  // Fast-track most common cases first
                  $type_set = $this->type_set;
                  // If either type is unknown, we can't call it
          Severity: Minor
          Found in src/Phan/Language/UnionType.php - About 1 hr to fix

            Method visitCall has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function visitCall(Node $node): void
                {
                    [$parent, $used] = $this->findNonUnaryParentNode($node);
                    if (!$parent) {
                        //fwrite(STDERR, "No parent in " . __METHOD__ . "\n");

              Method addParametersAndUseVariablesToGraph has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function addParametersAndUseVariablesToGraph(
                      Node $node,
                      VariableGraph $graph,
                      VariableTrackingScope $scope
                  ): array {
              Severity: Minor
              Found in src/Phan/Plugin/Internal/VariableTrackerPlugin.php - About 1 hr to fix

                Method visitEmpty has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function visitEmpty(Node $node): void
                    {
                        $var_node = $node->children['expr'];
                        try {
                            $type = UnionTypeVisitor::unionTypeFromNode($this->code_base, $this->context, $var_node, false);
                Severity: Minor
                Found in src/Phan/Plugin/Internal/RedundantConditionVisitor.php - About 1 hr to fix

                  Method emitTypeMismatchPropertyIssue has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function emitTypeMismatchPropertyIssue(
                          Node $node,
                          Property $property,
                          UnionType $resolved_right_type,
                          UnionType $warn_type,
                  Severity: Minor
                  Found in src/Phan/Analysis/AssignmentVisitor.php - About 1 hr to fix

                    Method checkForInvalidNewType has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function checkForInvalidNewType(Node $node, array $class_list): void
                        {
                            // This is either a string (new 'something'()) or a class name (new something())
                            $class_node = $node->children['class'];
                            if (!$class_node instanceof Node) {
                    Severity: Minor
                    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                      Method visitAssign has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function visitAssign(Node $node): Context
                          {
                              // Get the type of the right side of the
                              // assignment
                              $right_type = UnionTypeVisitor::unionTypeFromNode(
                      Severity: Minor
                      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                        Method checkPassingPropertyByReference has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private static function checkPassingPropertyByReference(CodeBase $code_base, Context $context, FunctionInterface $method, Parameter $parameter, Node $argument, Property $property, int $parameter_offset): void
                            {
                                $parameter_type = $parameter->getNonVariadicUnionType();
                                $expr_node = $argument->children['expr'] ?? null;
                                if ($expr_node instanceof Node &&
                        Severity: Minor
                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

                          Method handleJSONResponseFromWorker has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function handleJSONResponseFromWorker(array $uris_to_analyze, array $response_data): void
                              {
                                  $most_recent_node_info_request = $this->most_recent_node_info_request;
                                  if ($most_recent_node_info_request) {
                                      if ($most_recent_node_info_request instanceof GoToDefinitionRequest) {
                          Severity: Minor
                          Found in src/Phan/LanguageServer/LanguageServer.php - About 1 hr to fix

                            Method toStubSignature has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function toStubSignature(CodeBase $code_base): string
                                {
                                    $string = '';
                            
                                    if ($this->isFinal()) {
                            Severity: Minor
                            Found in src/Phan/Language/Element/Clazz.php - About 1 hr to fix

                              Method canNodeKindBeNull has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private static function canNodeKindBeNull($node): bool
                                  {
                                      if (!$node instanceof Node) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in src/Phan/BlockAnalysisVisitor.php - About 1 hr to fix

                                Method computeIssueSuppressionList has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private static function computeIssueSuppressionList(
                                        string $file_contents
                                    ): array {
                                        if (!\preg_match(self::SUPPRESS_ISSUE_REGEX, $file_contents)) {
                                            // If the **file** doesn't contain the regex we're looking for,
                                Severity: Minor
                                Found in src/Phan/Plugin/Internal/BuiltinSuppressionPlugin.php - About 1 hr to fix

                                  Method generateClosure has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private static function generateClosure(array $callable_params, array $class_params): Closure
                                      {
                                          $key = \json_encode([$callable_params, $class_params]);
                                          static $cache = [];
                                          $closure = $cache[$key] ?? null;
                                  Severity: Minor
                                  Found in src/Phan/Plugin/Internal/CallableParamPlugin.php - About 1 hr to fix

                                    Method checkSingleDefinitionReferenceOrGlobalOrStatic has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private function checkSingleDefinitionReferenceOrGlobalOrStatic(
                                            VariableGraph $graph,
                                            string $variable_name,
                                            array $issue_overrides_for_definition_ids
                                        ): void {
                                    Severity: Minor
                                    Found in src/Phan/Plugin/Internal/VariableTrackerPlugin.php - About 1 hr to fix

                                      Method initPhanConfig has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public static function initPhanConfig(array $opts): void
                                          {
                                              Config::setValue('use_polyfill_parser', true);
                                              $cwd = \getcwd();
                                      
                                      
                                      Severity: Minor
                                      Found in src/Phan/Config/Initializer.php - About 1 hr to fix

                                        Method visitSwitchList has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            public function visitSwitchList(Node $node): VariableTrackingScope
                                            {
                                                $outer_scope = $this->scope;
                                        
                                                $inner_scope_list = [];
                                        Severity: Minor
                                        Found in src/Phan/Plugin/Internal/VariableTracker/VariableTrackerVisitor.php - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language