Showing 3,272 of 4,939 total issues

AssignmentVisitor has 36 functions (exceeds 20 allowed). Consider refactoring.
Open

class AssignmentVisitor extends AnalysisVisitor
{
    /**
     * @var UnionType
     * The type of the element on the right side of the assignment
Severity: Minor
Found in src/Phan/Analysis/AssignmentVisitor.php - About 4 hrs to fix

    BinaryOperatorFlagVisitor has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    final class BinaryOperatorFlagVisitor extends FlagVisitorImplementation
    {
    
        /**
         * @var CodeBase The code base within which we're operating
    Severity: Minor
    Found in src/Phan/Analysis/BinaryOperatorFlagVisitor.php - About 4 hrs to fix

      Method analyzeFileList has 115 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function analyzeFileList(
              CodeBase $code_base,
              Closure $file_path_lister
          ): bool {
              if (Config::getValue('dump_parsed_file_list') === true) {
      Severity: Major
      Found in src/Phan/Phan.php - About 4 hrs to fix

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

            public function visitFor(Node $node): Context
            {
                $context = $this->context->withLineNumberStart(
                    $node->lineno
                );
        Severity: Major
        Found in src/Phan/BlockAnalysisVisitor.php - About 4 hrs to fix

          Function warnInvalidArgumentType has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function warnInvalidArgumentType(
                  CodeBase $code_base,
                  Context $context,
                  FunctionInterface $method,
                  Parameter $alternate_parameter,
          Severity: Minor
          Found in src/Phan/Analysis/ArgumentType.php - About 4 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 combineTypesAfterWeakEqualityCheck has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function combineTypesAfterWeakEqualityCheck(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 (!$old_union_type->hasRealTypeSet()) {
                      // This is a weak check of equality. We aren't sure of the real types
          Severity: Minor
          Found in src/Phan/Analysis/ConditionVisitorUtil.php - About 4 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 init has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function init(): void
              {
                  self::$noop = static function (Node $_): string {
                      return '(unknown)';
                  };
          Severity: Minor
          Found in src/Phan/AST/ASTReverter.php - About 4 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 visitMethodCall has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              public function visitMethodCall(Node $node): UnionType
              {
                  $method_name = $node->children['method'] ?? '';
          
                  // Give up on any complicated nonsense where the
          Severity: Minor
          Found in src/Phan/AST/UnionTypeVisitor.php - About 4 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 getConst has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getConst(): GlobalConstant
              {
                  $node = $this->node;
                  if (!$node instanceof Node) {
                      throw new AssertionError('$node must be a node');
          Severity: Minor
          Found in src/Phan/AST/ContextNode.php - About 4 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 phan_repl_help has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

          function phan_repl_help($value = "\x00extended_help"): void
          {
              if ($value === "\x00extended_help") {
                  echo "Phan " . CLI::PHAN_VERSION . " CLI autocompletion utilities.\n";
                  echo "Type help(\$value); or help('function or constant or class name'); for help.\n";
          Severity: Minor
          Found in tool/phan_repl_helpers.php - About 4 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

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

              public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
              {
                  /**
                   * @return Closure(CodeBase, Context, FunctionInterface, list<mixed>):void
                   */
          Severity: Major
          Found in .phan/plugins/PhanSelfCheckPlugin.php - About 4 hrs to fix

            Method processGraph has 113 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function processGraph(array $cached_graph = null): void
                {
                    $cmd  = $_ENV['PDEP_CMD'];
                    $mode = $_ENV['PDEP_MODE'];
                    $this->depth = (int)$_ENV['PDEP_DEPTH'];
            Severity: Major
            Found in src/Phan/Plugin/Internal/DependencyGraphPlugin.php - About 4 hrs to fix

              Comment has 35 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Comment
              {
                  public const ON_CLASS      = 1;
                  public const ON_VAR        = 2;
                  public const ON_PROPERTY   = 3;
              Severity: Minor
              Found in src/Phan/Language/Element/Comment.php - About 4 hrs to fix

                File ThrowAnalyzerPlugin.php has 353 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/ThrowAnalyzerPlugin.php - About 4 hrs to fix

                  Function make has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected static function make(
                          string $namespace,
                          string $type_name,
                          array $template_parameter_type_list,
                          bool $is_nullable,
                  Severity: Minor
                  Found in src/Phan/Language/Type.php - About 4 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 suggestVariableTypoFix has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function suggestVariableTypoFix(CodeBase $code_base, Context $context, string $variable_name, string $prefix = 'Did you mean'): ?Suggestion
                      {
                          if (Config::getValue('disable_suggestions')) {
                              return null;
                          }
                  Severity: Minor
                  Found in src/Phan/IssueFixSuggester.php - About 4 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 isExpressionReturningReference has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function isExpressionReturningReference(CodeBase $code_base, Context $context, $node): bool
                      {
                          if (!($node instanceof Node)) {
                              return false;
                          }
                  Severity: Minor
                  Found in src/Phan/Analysis/ArgumentType.php - About 4 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 guessErrorColumnUsingTokens has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static function guessErrorColumnUsingTokens(
                          FileCacheEntry $file_cache_entry,
                          Error $native_parse_error
                      ): int {
                          if (!\function_exists('token_get_all')) {
                  Severity: Minor
                  Found in src/Phan/AST/Parser.php - About 4 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 methodFQSENListFromParts has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function methodFQSENListFromParts($class_or_expr, $method_name): array
                      {
                          $code_base = $this->code_base;
                          $context = $this->context;
                  
                  
                  Severity: Minor
                  Found in src/Phan/AST/UnionTypeVisitor.php - About 4 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 analyzeBackwardCompatibility has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function analyzeBackwardCompatibility(): void
                      {
                          if (!Config::get_backward_compatibility_checks()) {
                              return;
                          }
                  Severity: Minor
                  Found in src/Phan/AST/ContextNode.php - About 4 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