Showing 3,272 of 4,939 total issues

Method visitBinaryAdd has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function visitBinaryAdd(Node $node): UnionType
    {
        static $int_or_float_or_array;
        static $probably_int_type;
        static $probably_array_type;
Severity: Major
Found in src/Phan/Analysis/AssignOperatorFlagVisitor.php - About 3 hrs to fix

    Method analyzePassByReferenceArgument has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function analyzePassByReferenceArgument(
            CodeBase $code_base,
            Context $context,
            Node $argument,
            array $argument_list,
    Severity: Major
    Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs to fix

      Method updateParameterTypeByArgument has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function updateParameterTypeByArgument(
              FunctionInterface $method,
              Parameter $parameter,
              $argument,
              array $argument_types,
      Severity: Major
      Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 3 hrs to fix

        File AssignOperatorFlagVisitor.php has 293 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare(strict_types=1);
        
        namespace Phan\Analysis;
        Severity: Minor
        Found in src/Phan/Analysis/AssignOperatorFlagVisitor.php - About 3 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                  if (!$this->comment_flags &&
                      !$this->return_comment &&
                      !$this->parameter_list &&
                      !$this->variable_list &&
                      !$this->template_type_list &&
          Severity: Critical
          Found in src/Phan/Language/Element/Comment/Builder.php - About 3 hrs to fix

            TypedElement has 26 functions (exceeds 20 allowed). Consider refactoring.
            Open

            abstract class TypedElement implements TypedElementInterface
            {
                /**
                 * @var string
                 * The name of the typed structural element
            Severity: Minor
            Found in src/Phan/Language/Element/TypedElement.php - About 3 hrs to fix

              NullType has 26 functions (exceeds 20 allowed). Consider refactoring.
              Open

              final class NullType extends ScalarType implements LiteralTypeInterface
              {
                  /** @phan-override */
                  public const NAME = 'null';
              
              
              Severity: Minor
              Found in src/Phan/Language/Type/NullType.php - About 3 hrs to fix

                Issue has 26 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Issue
                {
                    // phpcs:disable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase
                    // this is deliberate for issue names
                    // Issue::CATEGORY_SYNTAX
                Severity: Minor
                Found in src/Phan/Issue.php - About 3 hrs to fix

                  Method shouldWarnAboutImpossibleArrayKeyExists has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function shouldWarnAboutImpossibleArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?UnionType $key_type = null, ?UnionType $array_type = null): bool
                      {
                          $array_type = $array_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
                          if (!$array_type->hasRealTypeSet()) {
                              return false;
                  Severity: Major
                  Found in src/Phan/Plugin/Internal/MiscParamPlugin.php - About 3 hrs to fix

                    File RedundantConditionCallPlugin.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    declare(strict_types=1);
                    
                    namespace Phan\Plugin\Internal;
                    Severity: Minor
                    Found in src/Phan/Plugin/Internal/RedundantConditionCallPlugin.php - About 3 hrs to fix

                      File LiteralStringType.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      declare(strict_types=1);
                      
                      namespace Phan\Language\Type;
                      Severity: Minor
                      Found in src/Phan/Language/Type/LiteralStringType.php - About 2 hrs to fix

                        Method getAnalyzeFunctionCallClosures has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
                            {
                                /**
                                 * Analyzes a printf-like function with a format directive in the first position.
                                 * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
                        Severity: Major
                        Found in .phan/plugins/PrintfCheckerPlugin.php - About 2 hrs to fix

                          Method analyzeNode has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function analyzeNode(Node $stmts): array
                              {
                                  $kind = $stmts->kind;
                                  switch ($kind) {
                                      // Nodes that create new scopes

                            Method visitReturn has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function visitReturn(Node $node): Context
                                {
                                    $context = $this->context;
                                    // Make sure we're actually returning from a method.
                                    if (!$context->isInFunctionLikeScope()) {
                            Severity: Major
                            Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 2 hrs to fix

                              Function addGlobalConstantsByNames has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function addGlobalConstantsByNames(array $const_name_list): void
                                  {
                                      $included_extension_subset = self::getIncludedExtensionSubset();
                                      if (is_array($included_extension_subset)) {
                                          $excluded_constant_set = [];
                              Severity: Minor
                              Found in src/Phan/CodeBase.php - About 2 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 magicMethodFromCommentLine has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function magicMethodFromCommentLine(
                                      string $line,
                                      int $comment_line_offset
                                  ): ?Method {
                                      // https://phpdoc.org/docs/latest/references/phpdoc/tags/method.html
                              Severity: Minor
                              Found in src/Phan/Language/Element/Comment/Builder.php - About 2 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 fromNode has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function fromNode(
                                      Context $context,
                                      CodeBase $code_base,
                                      Node $node,
                                      FullyQualifiedFunctionName $fqsen
                              Severity: Minor
                              Found in src/Phan/Language/Element/Func.php - About 2 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 asNormalizedTypeSetInner has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private static function asNormalizedTypeSetInner(array $type_set): array
                                  {
                                      if (\count($type_set) <= 1) {
                                          return $type_set;
                                      }
                              Severity: Minor
                              Found in src/Phan/Language/UnionType.php - About 2 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 asClassList has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function asClassList(
                                      CodeBase $code_base,
                                      Context $context
                                  ): Generator {
                                      // Iterate over each viable class type to see if any
                              Severity: Minor
                              Found in src/Phan/Language/UnionType.php - About 2 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 canCastTraversableToIterable has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function canCastTraversableToIterable(GenericIterableType $type): bool
                                  {
                                      $template_types = $this->template_parameter_type_list;
                                      $count = count($template_types);
                                      $name = $this->name;
                              Severity: Minor
                              Found in src/Phan/Language/Type.php - About 2 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

                              Severity
                              Category
                              Status
                              Source
                              Language