Showing 3,272 of 4,939 total issues

Method extractComparisonDirectionsFromBinaryOp has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function extractComparisonDirectionsFromBinaryOp(Node $cond_node, bool $negate): array
    {
        ['left' => $left_node, 'right' => $right_node] = $cond_node->children;
        switch ($cond_node->flags) {
            case flags\BINARY_IS_SMALLER:
Severity: Minor
Found in src/Phan/Plugin/Internal/RedundantConditionLoopCheck.php - About 1 hr to fix

    Method extractAutoloadFilesAndDirectories has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function extractAutoloadFilesAndDirectories(string $relative_dir, array $composer_settings): array
        {
            $directory_list = [];
            $file_list = [];
            $autoload_setting = $composer_settings['autoload'] ?? [];
    Severity: Minor
    Found in src/Phan/Config/Initializer.php - About 1 hr to fix

      Method analyzeParentConstructorCalled has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function analyzeParentConstructorCalled(
              CodeBase $code_base,
              Clazz $clazz
          ): void {
              // Only look at classes configured to require a call
      Severity: Minor
      Found in src/Phan/Analysis/ParentConstructorCalledAnalyzer.php - About 1 hr to fix

        Method visitBinaryBitwiseXor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function visitBinaryBitwiseXor(Node $node): UnionType
            {
                $left = UnionTypeVisitor::unionTypeFromNode(
                    $this->code_base,
                    $this->context,
        Severity: Minor
        Found in src/Phan/Analysis/AssignOperatorFlagVisitor.php - About 1 hr to fix

          Method warnNoopNew has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function warnNoopNew(
                  Node $node,
                  array $class_list
              ): void {
                  $has_constructor_or_destructor = \count($class_list) === 0;
          Severity: Minor
          Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

            Method arrayTypeFromRealTypeBuilder has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function arrayTypeFromRealTypeBuilder(?UnionTypeBuilder $builder, Node $node, bool $has_key): array
                {
                    // Here, we only check for the real type being an integer.
                    // Unknown strings such as '0' will cast to integers when used as array keys,
                    // and if we knew all of the array keys were literals we would have generated an array shape instead.
            Severity: Minor
            Found in src/Phan/AST/UnionTypeVisitor.php - About 1 hr to fix

              Method getAvailableMethodPHPDocSummaries has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function getAvailableMethodPHPDocSummaries(): array
                  {
                      return $this->memoize(__METHOD__, /** @return array<string,string> */ function (): array {
                          $method_name_map = [];
                          $maybe_add_refpurpose = static function (string $name, SimpleXMLElement $xml) use (&$method_name_map): void {
              Severity: Minor
              Found in internal/lib/IncompatibleXMLSignatureDetector.php - About 1 hr to fix

                Method visitBinaryOp has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function visitBinaryOp(Node $node): Context
                    {
                        // check every boolean binary operation
                        if (in_array($node->flags, self::BINARY_BOOL_OPERATORS, true)) {
                            // get left node and parse it
                Severity: Minor
                Found in .phan/plugins/NonBoolInLogicalArithPlugin.php - About 1 hr to fix

                  Method visitBinaryOp has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function visitBinaryOp(Node $node): void
                      {
                          switch ($node->flags) {
                              case ast\flags\BINARY_IS_EQUAL:
                              case ast\flags\BINARY_IS_NOT_EQUAL:
                  Severity: Minor
                  Found in .phan/plugins/StrictComparisonPlugin.php - About 1 hr to fix

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

                        final public function analyze(CodeBase $code_base): void
                        {
                            if ($this->isPHPInternal()) {
                                return;
                            }
                    Severity: Minor
                    Found in src/Phan/Language/Element/Clazz.php - About 1 hr to fix

                      Method extractTypePartsForStringInContext has 32 lines of code (exceeds 25 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 1 hr to fix

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

                            public static function getSuggestionsForStringSet(string $target, array $potential_candidates): array
                            {
                                if (count($potential_candidates) === 0) {
                                    return [];
                                }
                        Severity: Minor
                        Found in src/Phan/IssueFixSuggester.php - About 1 hr to fix

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

                              public function visitClassConst(Node $node): void
                              {
                                  if (!isset($node->tolerant_ast_node)) {
                                      return;
                                  }
                          Severity: Minor
                          Found in src/Phan/Plugin/Internal/PhantasmPlugin/PhantasmVisitor.php - About 1 hr to fix

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

                                public static function computeNewContents(string $file, string $contents, array $all_edits): ?string
                                {
                                    \usort($all_edits, static function (FileEdit $a, FileEdit $b): int {
                                        return ($a->replace_start <=> $b->replace_start)
                                            ?: ($a->replace_end <=> $b->replace_end)
                            Severity: Minor
                            Found in src/Phan/Plugin/Internal/IssueFixingPlugin/IssueFixer.php - About 1 hr to fix

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

                                  public function visitFor(Node $node): void
                                  {
                                      $cond_list = $node->children['cond'];
                                      if (!$cond_list instanceof Node) {
                                          return;
                              Severity: Minor
                              Found in src/Phan/Plugin/Internal/RedundantConditionVisitor.php - About 1 hr to fix

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

                                    public static function getTypeMatchingBonus(CodeBase $code_base, UnionType $actual_signature_type, UnionType $desired_type): float
                                    {
                                        if (self::isMixed($desired_type) || self::isMixed($actual_signature_type)) {
                                            return 0;
                                        }
                                Severity: Minor
                                Found in src/Phan/Plugin/Internal/MethodSearcherPlugin.php - About 1 hr to fix

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

                                      public static function isPHPBinary(string $relative_path): bool
                                      {
                                          $cwd = \getcwd();
                                          $absolute_path = "$cwd/$relative_path";
                                          if (!\file_exists($absolute_path)) {
                                  Severity: Minor
                                  Found in src/Phan/Config/Initializer.php - About 1 hr to fix

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

                                        final protected function removeFalseyFromVariable(Node $var_node, Context $context, bool $suppress_issues): Context
                                        {
                                            return $this->updateVariableWithConditionalFilter(
                                                $var_node,
                                                $context,
                                    Severity: Minor
                                    Found in src/Phan/Analysis/ConditionVisitorUtil.php - About 1 hr to fix

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

                                          public static function asTypeSupportingAccess(UnionType $type, int $access_type): UnionType
                                          {
                                              $type = $type->asMappedListUnionType(/** @return list<Type> */ static function (Type $type) use ($access_type): array {
                                                  if ($access_type === ConditionVisitor::ACCESS_IS_OBJECT) {
                                                      if (!$type->isPossiblyObject()) {
                                      Severity: Minor
                                      Found in src/Phan/Analysis/ConditionVisitorUtil.php - About 1 hr to fix

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

                                            private function analyzeMethodVisibility(
                                                Method $method,
                                                Node $node
                                            ): void {
                                                if ($method->isPublic()) {
                                        Severity: Minor
                                        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language