src/Phan/CLI.php

Summary

Maintainability
F
3 wks
Test Coverage

File CLI.php has 2193 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Phan;
Severity: Major
Found in src/Phan/CLI.php - About 6 days to fix

    Function __construct has a Cognitive Complexity of 210 (exceeds 5 allowed). Consider refactoring.
    Open

        private function __construct(array $opts, array $argv)
        {
            self::detectAndConfigureColorSupport($opts);
    
            if (\array_key_exists('extended-help', $opts)) {
    Severity: Minor
    Found in src/Phan/CLI.php - About 4 days 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 __construct has 589 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function __construct(array $opts, array $argv)
        {
            self::detectAndConfigureColorSupport($opts);
    
            if (\array_key_exists('extended-help', $opts)) {
    Severity: Major
    Found in src/Phan/CLI.php - About 2 days to fix

      Method usage has 338 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function usage(string $msg = '', ?int $exit_code = EXIT_SUCCESS, int $usage_type = UsageException::PRINT_NORMAL, bool $forbid_color = true): void
          {
              global $argv;
      
              if ($msg !== '') {
      Severity: Major
      Found in src/Phan/CLI.php - About 1 day to fix

        CLI has 61 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class CLI
        {
            /**
             * This should be updated to x.y.z-dev after every release, and x.y.z before a release.
             */
        Severity: Major
        Found in src/Phan/CLI.php - About 1 day to fix

          Function renderLongProgress has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function renderLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): string
              {
                  $buf = '';
                  if ($msg !== self::$current_progress_state_long_progress) {
                      switch ($msg) {
          Severity: Minor
          Found in src/Phan/CLI.php - About 5 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 checkAllArgsUsed has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function checkAllArgsUsed(array $opts, array &$argv): void
              {
                  $pruneargv = [];
                  foreach ($opts as $opt => $value) {
                      foreach ($argv as $key => $chunk) {
          Severity: Minor
          Found in src/Phan/CLI.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

          The class CLI has 49 non-getter- and setter-methods. Consider refactoring CLI to keep number of methods under 25.
          Open

          class CLI
          {
              /**
               * This should be updated to x.y.z-dev after every release, and x.y.z before a release.
               */
          Severity: Minor
          Found in src/Phan/CLI.php by phpmd

          TooManyMethods

          Since: 0.1

          A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

          By default it ignores methods starting with 'get' or 'set'.

          The default was changed from 10 to 25 in PHPMD 2.3.

          Example

          Source https://phpmd.org/rules/codesize.html#toomanymethods

          The class CLI has an overall complexity of 494 which is very high. The configured complexity threshold is 50.
          Open

          class CLI
          {
              /**
               * This should be updated to x.y.z-dev after every release, and x.y.z before a release.
               */
          Severity: Minor
          Found in src/Phan/CLI.php by phpmd

          The class CLI has 25 public methods. Consider refactoring CLI to keep number of public methods under 10.
          Open

          class CLI
          {
              /**
               * This should be updated to x.y.z-dev after every release, and x.y.z before a release.
               */
          Severity: Minor
          Found in src/Phan/CLI.php by phpmd

          TooManyPublicMethods

          Since: 0.1

          A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

          By default it ignores methods starting with 'get' or 'set'.

          Example

          Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

          Function getFlagSuggestionString has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getFlagSuggestionString(
                  string $key
              ): string {
                  $trim = static function (string $s): string {
                      return \rtrim($s, ':');
          Severity: Minor
          Found in src/Phan/CLI.php - About 3 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 renderLongProgress has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function renderLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): string
              {
                  $buf = '';
                  if ($msg !== self::$current_progress_state_long_progress) {
                      switch ($msg) {
          Severity: Major
          Found in src/Phan/CLI.php - About 2 hrs to fix

            Method directoryNameToFileList has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function directoryNameToFileList(
                    string $directory_name
                ): array {
                    $file_list = [];
            
            
            Severity: Major
            Found in src/Phan/CLI.php - About 2 hrs to fix

              Method getFlagSuggestionString has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getFlagSuggestionString(
                      string $key
                  ): string {
                      $trim = static function (string $s): string {
                          return \rtrim($s, ':');
              Severity: Major
              Found in src/Phan/CLI.php - About 2 hrs to fix

                Function directoryNameToFileList has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function directoryNameToFileList(
                        string $directory_name
                    ): array {
                        $file_list = [];
                
                
                Severity: Minor
                Found in src/Phan/CLI.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

                Method ensureASTParserExists has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static function ensureASTParserExists(): void
                    {
                        if (Config::getValue('use_polyfill_parser')) {
                            return;
                        }
                Severity: Minor
                Found in src/Phan/CLI.php - About 1 hr to fix

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

                      public function restartWithoutProblematicExtensions(): void
                      {
                          $extensions_to_disable = [];
                          if (self::shouldRestartToExclude('xdebug')) {
                              $extensions_to_disable[] = 'xdebug';
                  Severity: Minor
                  Found in src/Phan/CLI.php - About 1 hr to fix

                    Method checkAllArgsUsed has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function checkAllArgsUsed(array $opts, array &$argv): void
                        {
                            $pruneargv = [];
                            foreach ($opts as $opt => $value) {
                                foreach ($argv as $key => $chunk) {
                    Severity: Minor
                    Found in src/Phan/CLI.php - About 1 hr to fix

                      Function usage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function usage(string $msg = '', ?int $exit_code = EXIT_SUCCESS, int $usage_type = UsageException::PRINT_NORMAL, bool $forbid_color = true): void
                          {
                              global $argv;
                      
                              if ($msg !== '') {
                      Severity: Minor
                      Found in src/Phan/CLI.php - About 1 hr 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 outputProgressLine has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function outputProgressLine(string $msg, float $p, float $memory, float $peak, ?int $offset = null, ?int $count = null): void
                          {
                              if (self::shouldShowLongProgress()) {
                                  self::showLongProgress($msg, $p, $memory, $offset, $count);
                                  return;
                      Severity: Minor
                      Found in src/Phan/CLI.php - About 1 hr to fix

                        Method recomputeFileList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function recomputeFileList(): void
                            {
                                $this->file_list = $this->file_list_in_config;
                        
                                if (!$this->file_list_only) {
                        Severity: Minor
                        Found in src/Phan/CLI.php - About 1 hr to fix

                          Function addPHPBinariesForSyntaxCheck has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static function addPHPBinariesForSyntaxCheck(array $binaries): void
                              {
                                  $resolved_binaries = [];
                                  foreach ($binaries as $binary) {
                                      if ($binary === '') {
                          Severity: Minor
                          Found in src/Phan/CLI.php - About 1 hr 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 maybeReadConfigFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function maybeReadConfigFile(bool $require_config_exists): void
                              {
                          
                                  // If the file doesn't exist here, try a directory up
                                  $config_file_name = $this->config_file;
                          Severity: Minor
                          Found in src/Phan/CLI.php - About 1 hr to fix

                            Method progress has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function progress(
                                    string $msg,
                                    float $p,
                                    $details = null,
                                    ?int $offset = null,
                            Severity: Minor
                            Found in src/Phan/CLI.php - About 1 hr to fix

                              Function restartWithoutProblematicExtensions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function restartWithoutProblematicExtensions(): void
                                  {
                                      $extensions_to_disable = [];
                                      if (self::shouldRestartToExclude('xdebug')) {
                                          $extensions_to_disable[] = 'xdebug';
                              Severity: Minor
                              Found in src/Phan/CLI.php - About 55 mins 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 checkValidFileConfig has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private static function checkValidFileConfig(): void
                                  {
                                      $include_analysis_file_list = Config::getValue('include_analysis_file_list');
                                      if ($include_analysis_file_list) {
                                          $valid_files = 0;
                              Severity: Minor
                              Found in src/Phan/CLI.php - About 55 mins 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 maybeReadConfigFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function maybeReadConfigFile(bool $require_config_exists): void
                                  {
                              
                                      // If the file doesn't exist here, try a directory up
                                      $config_file_name = $this->config_file;
                              Severity: Minor
                              Found in src/Phan/CLI.php - About 55 mins 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 checkPluginsExist has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private static function checkPluginsExist(): void
                                  {
                                      $all_plugins_exist = true;
                                      foreach (Config::getValue('plugins') as $plugin_path_or_name) {
                                          // @phan-suppress-next-line PhanAccessMethodInternal
                              Severity: Minor
                              Found in src/Phan/CLI.php - About 45 mins 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 outputProgressLine has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public static function outputProgressLine(string $msg, float $p, float $memory, float $peak, ?int $offset = null, ?int $count = null): void
                              Severity: Minor
                              Found in src/Phan/CLI.php - About 45 mins to fix

                                Function progress has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public static function progress(
                                        string $msg,
                                        float $p,
                                        $details = null,
                                        ?int $offset = null,
                                Severity: Minor
                                Found in src/Phan/CLI.php - About 45 mins 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 progress has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        string $msg,
                                        float $p,
                                        $details = null,
                                        ?int $offset = null,
                                        ?int $count = null
                                Severity: Minor
                                Found in src/Phan/CLI.php - About 35 mins to fix

                                  Method renderLongProgress has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      private static function renderLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): string
                                  Severity: Minor
                                  Found in src/Phan/CLI.php - About 35 mins to fix

                                    Method showLongProgress has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        private static function showLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): void
                                    Severity: Minor
                                    Found in src/Phan/CLI.php - About 35 mins to fix

                                      Function supportsColor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public static function supportsColor($output): bool
                                          {
                                              if (self::isDaemonOrLanguageServer()) {
                                                  return false;
                                              }
                                      Severity: Minor
                                      Found in src/Phan/CLI.php - About 35 mins 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 checkCanDaemonize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private static function checkCanDaemonize(string $protocol, string $opt): void
                                          {
                                              $opt = strlen($opt) >= 2 ? "--$opt" : "-$opt";
                                              if (!in_array($protocol, \stream_get_transports(), true)) {
                                                  throw new UsageException("The $protocol:///path/to/file schema is not supported on this system, cannot create a daemon with $opt", 1);
                                      Severity: Minor
                                      Found in src/Phan/CLI.php - About 35 mins 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

                                      Avoid too many return statements within this method.
                                      Open

                                                      return true;
                                      Severity: Major
                                      Found in src/Phan/CLI.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return '';
                                        Severity: Major
                                        Found in src/Phan/CLI.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      return $generate_suggestion_text($similarity_values[0][2]);
                                          Severity: Major
                                          Found in src/Phan/CLI.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return $generate_suggestion_text($similarity_values[0][2], $similarity_values[1][2]);
                                            Severity: Major
                                            Found in src/Phan/CLI.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                              return $generate_suggestion_text($alternate);
                                              Severity: Major
                                              Found in src/Phan/CLI.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                        return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
                                                Severity: Major
                                                Found in src/Phan/CLI.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                          return false;
                                                  Severity: Major
                                                  Found in src/Phan/CLI.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                            return false;
                                                    Severity: Major
                                                    Found in src/Phan/CLI.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                  return \posix_isatty($output);
                                                      Severity: Major
                                                      Found in src/Phan/CLI.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                                return false;
                                                        Severity: Major
                                                        Found in src/Phan/CLI.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                                  return false;
                                                          Severity: Major
                                                          Found in src/Phan/CLI.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        return '';
                                                            Severity: Major
                                                            Found in src/Phan/CLI.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                                  return " (This option is probably missing the required value. Or this option may not apply to a regular Phan analysis, and/or it may be unintentionally unhandled in \Phan\CLI::__construct())";
                                                              Severity: Major
                                                              Found in src/Phan/CLI.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                    return false;
                                                                Severity: Major
                                                                Found in src/Phan/CLI.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                          return '';
                                                                  Severity: Major
                                                                  Found in src/Phan/CLI.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                            return \array_values($normalized_file_list);
                                                                    Severity: Major
                                                                    Found in src/Phan/CLI.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                              return false;
                                                                      Severity: Major
                                                                      Found in src/Phan/CLI.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                    return '';
                                                                        Severity: Major
                                                                        Found in src/Phan/CLI.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                              return " (This option may not apply to a regular Phan analysis, and/or it may be unintentionally unhandled in \Phan\CLI::__construct())";
                                                                          Severity: Major
                                                                          Found in src/Phan/CLI.php - About 30 mins to fix

                                                                            Function shouldParse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public static function shouldParse(string $file_path): bool
                                                                                {
                                                                                    $exclude_file_regex = Config::getValue('exclude_file_regex');
                                                                                    if ($exclude_file_regex && self::isPathMatchedByRegex($exclude_file_regex, $file_path)) {
                                                                                        return false;
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php - About 25 mins 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 debugProgress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public static function debugProgress(string $msg, float $p, $details): void
                                                                                {
                                                                                    $pct = \sprintf("%d%%", (int)(100 * self::boundPercentage($p)));
                                                                            
                                                                                    if ($details === null) {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php - About 25 mins 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 detectAndConfigureColorSupport has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                private static function detectAndConfigureColorSupport(array $opts): void
                                                                                {
                                                                                    if (is_string($opts['color-scheme'] ?? false)) {
                                                                                        \putenv('PHAN_COLOR_SCHEME=' . $opts['color-scheme']);
                                                                                    }
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php - About 25 mins 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 renderInnerProgressBar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                private static function renderInnerProgressBar(int $length, float $p): string
                                                                                {
                                                                                    $current_float = $p * $length;
                                                                                    $current = (int)$current_float;
                                                                                    $rest = \max($length - $current, 0);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php - About 25 mins 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 recomputeFileList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public function recomputeFileList(): void
                                                                                {
                                                                                    $this->file_list = $this->file_list_in_config;
                                                                            
                                                                                    if (!$this->file_list_only) {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php - About 25 mins 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

                                                                            The class CLI has 2799 lines of code. Current threshold is 1000. Avoid really long classes.
                                                                            Open

                                                                            class CLI
                                                                            {
                                                                                /**
                                                                                 * This should be updated to x.y.z-dev after every release, and x.y.z before a release.
                                                                                 */
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            The method checkAllArgsUsed() has an NPath complexity of 308. The configured NPath complexity threshold is 200.
                                                                            Open

                                                                                private static function checkAllArgsUsed(array $opts, array &$argv): void
                                                                                {
                                                                                    $pruneargv = [];
                                                                                    foreach ($opts as $opt => $value) {
                                                                                        foreach ($argv as $key => $chunk) {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            NPathComplexity

                                                                            Since: 0.1

                                                                            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                            Example

                                                                            class Foo {
                                                                                function bar() {
                                                                                    // lots of complicated code
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                            The method __construct() has an NPath complexity of 7390310400. The configured NPath complexity threshold is 200.
                                                                            Open

                                                                                private function __construct(array $opts, array $argv)
                                                                                {
                                                                                    self::detectAndConfigureColorSupport($opts);
                                                                            
                                                                                    if (\array_key_exists('extended-help', $opts)) {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            NPathComplexity

                                                                            Since: 0.1

                                                                            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                            Example

                                                                            class Foo {
                                                                                function bar() {
                                                                                    // lots of complicated code
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                            The method usage() has 442 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                            Open

                                                                                public static function usage(string $msg = '', ?int $exit_code = EXIT_SUCCESS, int $usage_type = UsageException::PRINT_NORMAL, bool $forbid_color = true): void
                                                                                {
                                                                                    global $argv;
                                                                            
                                                                                    if ($msg !== '') {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            The method renderLongProgress() has an NPath complexity of 216. The configured NPath complexity threshold is 200.
                                                                            Open

                                                                                private static function renderLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): string
                                                                                {
                                                                                    $buf = '';
                                                                                    if ($msg !== self::$current_progress_state_long_progress) {
                                                                                        switch ($msg) {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            NPathComplexity

                                                                            Since: 0.1

                                                                            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                            Example

                                                                            class Foo {
                                                                                function bar() {
                                                                                    // lots of complicated code
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                            The method __construct() has 648 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                            Open

                                                                                private function __construct(array $opts, array $argv)
                                                                                {
                                                                                    self::detectAndConfigureColorSupport($opts);
                                                                            
                                                                                    if (\array_key_exists('extended-help', $opts)) {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            The method getFlagSuggestionString() has an NPath complexity of 1672. The configured NPath complexity threshold is 200.
                                                                            Open

                                                                                public static function getFlagSuggestionString(
                                                                                    string $key
                                                                                ): string {
                                                                                    $trim = static function (string $s): string {
                                                                                        return \rtrim($s, ':');
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            NPathComplexity

                                                                            Since: 0.1

                                                                            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                            Example

                                                                            class Foo {
                                                                                function bar() {
                                                                                    // lots of complicated code
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                            The method directoryNameToFileList() has an NPath complexity of 3032. The configured NPath complexity threshold is 200.
                                                                            Open

                                                                                private static function directoryNameToFileList(
                                                                                    string $directory_name
                                                                                ): array {
                                                                                    $file_list = [];
                                                                            
                                                                            
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            NPathComplexity

                                                                            Since: 0.1

                                                                            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                            Example

                                                                            class Foo {
                                                                                function bar() {
                                                                                    // lots of complicated code
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                            The method __construct() has a Cyclomatic Complexity of 200. The configured cyclomatic complexity threshold is 10.
                                                                            Open

                                                                                private function __construct(array $opts, array $argv)
                                                                                {
                                                                                    self::detectAndConfigureColorSupport($opts);
                                                                            
                                                                                    if (\array_key_exists('extended-help', $opts)) {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            CyclomaticComplexity

                                                                            Since: 0.1

                                                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                            Example

                                                                            // Cyclomatic Complexity = 11
                                                                            class Foo {
                                                                            1   public function example() {
                                                                            2       if ($a == $b) {
                                                                            3           if ($a1 == $b1) {
                                                                                            fiddle();
                                                                            4           } elseif ($a2 == $b2) {
                                                                                            fiddle();
                                                                                        } else {
                                                                                            fiddle();
                                                                                        }
                                                                            5       } elseif ($c == $d) {
                                                                            6           while ($c == $d) {
                                                                                            fiddle();
                                                                                        }
                                                                            7        } elseif ($e == $f) {
                                                                            8           for ($n = 0; $n < $h; $n++) {
                                                                                            fiddle();
                                                                                        }
                                                                                    } else {
                                                                                        switch ($z) {
                                                                            9               case 1:
                                                                                                fiddle();
                                                                                                break;
                                                                            10              case 2:
                                                                                                fiddle();
                                                                                                break;
                                                                            11              case 3:
                                                                                                fiddle();
                                                                                                break;
                                                                                            default:
                                                                                                fiddle();
                                                                                                break;
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                            The method checkCanDaemonize() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                                                            Open

                                                                                private static function checkCanDaemonize(string $protocol, string $opt): void
                                                                                {
                                                                                    $opt = strlen($opt) >= 2 ? "--$opt" : "-$opt";
                                                                                    if (!in_array($protocol, \stream_get_transports(), true)) {
                                                                                        throw new UsageException("The $protocol:///path/to/file schema is not supported on this system, cannot create a daemon with $opt", 1);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            CyclomaticComplexity

                                                                            Since: 0.1

                                                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                            Example

                                                                            // Cyclomatic Complexity = 11
                                                                            class Foo {
                                                                            1   public function example() {
                                                                            2       if ($a == $b) {
                                                                            3           if ($a1 == $b1) {
                                                                                            fiddle();
                                                                            4           } elseif ($a2 == $b2) {
                                                                                            fiddle();
                                                                                        } else {
                                                                                            fiddle();
                                                                                        }
                                                                            5       } elseif ($c == $d) {
                                                                            6           while ($c == $d) {
                                                                                            fiddle();
                                                                                        }
                                                                            7        } elseif ($e == $f) {
                                                                            8           for ($n = 0; $n < $h; $n++) {
                                                                                            fiddle();
                                                                                        }
                                                                                    } else {
                                                                                        switch ($z) {
                                                                            9               case 1:
                                                                                                fiddle();
                                                                                                break;
                                                                            10              case 2:
                                                                                                fiddle();
                                                                                                break;
                                                                            11              case 3:
                                                                                                fiddle();
                                                                                                break;
                                                                                            default:
                                                                                                fiddle();
                                                                                                break;
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                            The method renderLongProgress() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
                                                                            Open

                                                                                private static function renderLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): string
                                                                                {
                                                                                    $buf = '';
                                                                                    if ($msg !== self::$current_progress_state_long_progress) {
                                                                                        switch ($msg) {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            CyclomaticComplexity

                                                                            Since: 0.1

                                                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                            Example

                                                                            // Cyclomatic Complexity = 11
                                                                            class Foo {
                                                                            1   public function example() {
                                                                            2       if ($a == $b) {
                                                                            3           if ($a1 == $b1) {
                                                                                            fiddle();
                                                                            4           } elseif ($a2 == $b2) {
                                                                                            fiddle();
                                                                                        } else {
                                                                                            fiddle();
                                                                                        }
                                                                            5       } elseif ($c == $d) {
                                                                            6           while ($c == $d) {
                                                                                            fiddle();
                                                                                        }
                                                                            7        } elseif ($e == $f) {
                                                                            8           for ($n = 0; $n < $h; $n++) {
                                                                                            fiddle();
                                                                                        }
                                                                                    } else {
                                                                                        switch ($z) {
                                                                            9               case 1:
                                                                                                fiddle();
                                                                                                break;
                                                                            10              case 2:
                                                                                                fiddle();
                                                                                                break;
                                                                            11              case 3:
                                                                                                fiddle();
                                                                                                break;
                                                                                            default:
                                                                                                fiddle();
                                                                                                break;
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                            The method supportsColor() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                                            Open

                                                                                public static function supportsColor($output): bool
                                                                                {
                                                                                    if (self::isDaemonOrLanguageServer()) {
                                                                                        return false;
                                                                                    }
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            CyclomaticComplexity

                                                                            Since: 0.1

                                                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                            Example

                                                                            // Cyclomatic Complexity = 11
                                                                            class Foo {
                                                                            1   public function example() {
                                                                            2       if ($a == $b) {
                                                                            3           if ($a1 == $b1) {
                                                                                            fiddle();
                                                                            4           } elseif ($a2 == $b2) {
                                                                                            fiddle();
                                                                                        } else {
                                                                                            fiddle();
                                                                                        }
                                                                            5       } elseif ($c == $d) {
                                                                            6           while ($c == $d) {
                                                                                            fiddle();
                                                                                        }
                                                                            7        } elseif ($e == $f) {
                                                                            8           for ($n = 0; $n < $h; $n++) {
                                                                                            fiddle();
                                                                                        }
                                                                                    } else {
                                                                                        switch ($z) {
                                                                            9               case 1:
                                                                                                fiddle();
                                                                                                break;
                                                                            10              case 2:
                                                                                                fiddle();
                                                                                                break;
                                                                            11              case 3:
                                                                                                fiddle();
                                                                                                break;
                                                                                            default:
                                                                                                fiddle();
                                                                                                break;
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                            The method getFlagSuggestionString() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                                                                            Open

                                                                                public static function getFlagSuggestionString(
                                                                                    string $key
                                                                                ): string {
                                                                                    $trim = static function (string $s): string {
                                                                                        return \rtrim($s, ':');
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            CyclomaticComplexity

                                                                            Since: 0.1

                                                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                            Example

                                                                            // Cyclomatic Complexity = 11
                                                                            class Foo {
                                                                            1   public function example() {
                                                                            2       if ($a == $b) {
                                                                            3           if ($a1 == $b1) {
                                                                                            fiddle();
                                                                            4           } elseif ($a2 == $b2) {
                                                                                            fiddle();
                                                                                        } else {
                                                                                            fiddle();
                                                                                        }
                                                                            5       } elseif ($c == $d) {
                                                                            6           while ($c == $d) {
                                                                                            fiddle();
                                                                                        }
                                                                            7        } elseif ($e == $f) {
                                                                            8           for ($n = 0; $n < $h; $n++) {
                                                                                            fiddle();
                                                                                        }
                                                                                    } else {
                                                                                        switch ($z) {
                                                                            9               case 1:
                                                                                                fiddle();
                                                                                                break;
                                                                            10              case 2:
                                                                                                fiddle();
                                                                                                break;
                                                                            11              case 3:
                                                                                                fiddle();
                                                                                                break;
                                                                                            default:
                                                                                                fiddle();
                                                                                                break;
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                            The method directoryNameToFileList() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                                                                            Open

                                                                                private static function directoryNameToFileList(
                                                                                    string $directory_name
                                                                                ): array {
                                                                                    $file_list = [];
                                                                            
                                                                            
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            CyclomaticComplexity

                                                                            Since: 0.1

                                                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                            Example

                                                                            // Cyclomatic Complexity = 11
                                                                            class Foo {
                                                                            1   public function example() {
                                                                            2       if ($a == $b) {
                                                                            3           if ($a1 == $b1) {
                                                                                            fiddle();
                                                                            4           } elseif ($a2 == $b2) {
                                                                                            fiddle();
                                                                                        } else {
                                                                                            fiddle();
                                                                                        }
                                                                            5       } elseif ($c == $d) {
                                                                            6           while ($c == $d) {
                                                                                            fiddle();
                                                                                        }
                                                                            7        } elseif ($e == $f) {
                                                                            8           for ($n = 0; $n < $h; $n++) {
                                                                                            fiddle();
                                                                                        }
                                                                                    } else {
                                                                                        switch ($z) {
                                                                            9               case 1:
                                                                                                fiddle();
                                                                                                break;
                                                                            10              case 2:
                                                                                                fiddle();
                                                                                                break;
                                                                            11              case 3:
                                                                                                fiddle();
                                                                                                break;
                                                                                            default:
                                                                                                fiddle();
                                                                                                break;
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                            The method checkAllArgsUsed() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
                                                                            Open

                                                                                private static function checkAllArgsUsed(array $opts, array &$argv): void
                                                                                {
                                                                                    $pruneargv = [];
                                                                                    foreach ($opts as $opt => $value) {
                                                                                        foreach ($argv as $key => $chunk) {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            CyclomaticComplexity

                                                                            Since: 0.1

                                                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                            Example

                                                                            // Cyclomatic Complexity = 11
                                                                            class Foo {
                                                                            1   public function example() {
                                                                            2       if ($a == $b) {
                                                                            3           if ($a1 == $b1) {
                                                                                            fiddle();
                                                                            4           } elseif ($a2 == $b2) {
                                                                                            fiddle();
                                                                                        } else {
                                                                                            fiddle();
                                                                                        }
                                                                            5       } elseif ($c == $d) {
                                                                            6           while ($c == $d) {
                                                                                            fiddle();
                                                                                        }
                                                                            7        } elseif ($e == $f) {
                                                                            8           for ($n = 0; $n < $h; $n++) {
                                                                                            fiddle();
                                                                                        }
                                                                                    } else {
                                                                                        switch ($z) {
                                                                            9               case 1:
                                                                                                fiddle();
                                                                                                break;
                                                                            10              case 2:
                                                                                                fiddle();
                                                                                                break;
                                                                            11              case 3:
                                                                                                fiddle();
                                                                                                break;
                                                                                            default:
                                                                                                fiddle();
                                                                                                break;
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                            The class CLI has a coupling between objects value of 39. Consider to reduce the number of dependencies under 13.
                                                                            Open

                                                                            class CLI
                                                                            {
                                                                                /**
                                                                                 * This should be updated to x.y.z-dev after every release, and x.y.z before a release.
                                                                                 */
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            CouplingBetweenObjects

                                                                            Since: 1.1.0

                                                                            A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                                                                            Example

                                                                            class Foo {
                                                                                /**
                                                                                 * @var \foo\bar\X
                                                                                 */
                                                                                private $x = null;
                                                                            
                                                                                /**
                                                                                 * @var \foo\bar\Y
                                                                                 */
                                                                                private $y = null;
                                                                            
                                                                                /**
                                                                                 * @var \foo\bar\Z
                                                                                 */
                                                                                private $z = null;
                                                                            
                                                                                public function setFoo(\Foo $foo) {}
                                                                                public function setBar(\Bar $bar) {}
                                                                                public function setBaz(\Baz $baz) {}
                                                                            
                                                                                /**
                                                                                 * @return \SplObjectStorage
                                                                                 * @throws \OutOfRangeException
                                                                                 * @throws \InvalidArgumentException
                                                                                 * @throws \ErrorException
                                                                                 */
                                                                                public function process(\Iterator $it) {}
                                                                            
                                                                                // ...
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#couplingbetweenobjects

                                                                            The method ensureASTParserExists() contains an exit expression.
                                                                            Open

                                                                                        exit(EXIT_FAILURE);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method usage() contains an exit expression.
                                                                            Open

                                                                                        exit($exit_code);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method ensureASTParserExists() contains an exit expression.
                                                                            Open

                                                                                        exit(EXIT_FAILURE);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method __construct() contains an exit expression.
                                                                            Open

                                                                                        exit(EXIT_SUCCESS);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method usage() contains an exit expression.
                                                                            Open

                                                                                        exit($exit_code);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method sanityCheckAstVersion() contains an exit expression.
                                                                            Open

                                                                                        exit(1);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method __construct() contains an exit expression.
                                                                            Open

                                                                                        exit(1);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method checkPluginsExist() contains an exit expression.
                                                                            Open

                                                                                        exit(1);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method ensureASTParserExists() contains an exit expression.
                                                                            Open

                                                                                        exit(EXIT_FAILURE);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method __construct() contains an exit expression.
                                                                            Open

                                                                                                    exit(1);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method usage() contains an exit expression.
                                                                            Open

                                                                                    exit($exit_code);
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method fromArgv() contains an exit expression.
                                                                            Open

                                                                                        exit((int)$e->getCode());  // unreachable
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            The method fromArgv() contains an exit expression.
                                                                            Open

                                                                                        exit($e->getCode());
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ExitExpression

                                                                            Since: 0.2

                                                                            An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                                                            Example

                                                                            class Foo {
                                                                                public function bar($param)  {
                                                                                    if ($param === 42) {
                                                                                        exit(23);
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/design.html#exitexpression

                                                                            Avoid variables with short names like $p. Configured minimum length is 3.
                                                                            Open

                                                                                private static function renderInnerProgressBar(int $length, float $p): string
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ShortVariable

                                                                            Since: 0.2

                                                                            Detects when a field, local, or parameter has a very short name.

                                                                            Example

                                                                            class Something {
                                                                                private $q = 15; // VIOLATION - Field
                                                                                public static function main( array $as ) { // VIOLATION - Formal
                                                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                        $r += $this->q;
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/naming.html#shortvariable

                                                                            Avoid variables with short names like $p. Configured minimum length is 3.
                                                                            Open

                                                                                    float $p,
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ShortVariable

                                                                            Since: 0.2

                                                                            Detects when a field, local, or parameter has a very short name.

                                                                            Example

                                                                            class Something {
                                                                                private $q = 15; // VIOLATION - Field
                                                                                public static function main( array $as ) { // VIOLATION - Formal
                                                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                        $r += $this->q;
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/naming.html#shortvariable

                                                                            Avoid variables with short names like $p. Configured minimum length is 3.
                                                                            Open

                                                                                public static function debugProgress(string $msg, float $p, $details): void
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ShortVariable

                                                                            Since: 0.2

                                                                            Detects when a field, local, or parameter has a very short name.

                                                                            Example

                                                                            class Something {
                                                                                private $q = 15; // VIOLATION - Field
                                                                                public static function main( array $as ) { // VIOLATION - Formal
                                                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                        $r += $this->q;
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/naming.html#shortvariable

                                                                            Avoid variables with short names like $s. Configured minimum length is 3.
                                                                            Open

                                                                                    $trim = static function (string $s): string {
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ShortVariable

                                                                            Since: 0.2

                                                                            Detects when a field, local, or parameter has a very short name.

                                                                            Example

                                                                            class Something {
                                                                                private $q = 15; // VIOLATION - Field
                                                                                public static function main( array $as ) { // VIOLATION - Formal
                                                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                        $r += $this->q;
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/naming.html#shortvariable

                                                                            Avoid variables with short names like $_. Configured minimum length is 3.
                                                                            Open

                                                                                        [$_, $prefix, $cli_flag, $suffix] = $match;
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ShortVariable

                                                                            Since: 0.2

                                                                            Detects when a field, local, or parameter has a very short name.

                                                                            Example

                                                                            class Something {
                                                                                private $q = 15; // VIOLATION - Field
                                                                                public static function main( array $as ) { // VIOLATION - Formal
                                                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                        $r += $this->q;
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/naming.html#shortvariable

                                                                            Avoid variables with short names like $p. Configured minimum length is 3.
                                                                            Open

                                                                                private static function showLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): void
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ShortVariable

                                                                            Since: 0.2

                                                                            Detects when a field, local, or parameter has a very short name.

                                                                            Example

                                                                            class Something {
                                                                                private $q = 15; // VIOLATION - Field
                                                                                public static function main( array $as ) { // VIOLATION - Formal
                                                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                        $r += $this->q;
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/naming.html#shortvariable

                                                                            Avoid variables with short names like $p. Configured minimum length is 3.
                                                                            Open

                                                                                private static function renderLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): string
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ShortVariable

                                                                            Since: 0.2

                                                                            Detects when a field, local, or parameter has a very short name.

                                                                            Example

                                                                            class Something {
                                                                                private $q = 15; // VIOLATION - Field
                                                                                public static function main( array $as ) { // VIOLATION - Formal
                                                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                        $r += $this->q;
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/naming.html#shortvariable

                                                                            Avoid variables with short names like $p. Configured minimum length is 3.
                                                                            Open

                                                                                private static function boundPercentage(float $p): float
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ShortVariable

                                                                            Since: 0.2

                                                                            Detects when a field, local, or parameter has a very short name.

                                                                            Example

                                                                            class Something {
                                                                                private $q = 15; // VIOLATION - Field
                                                                                public static function main( array $as ) { // VIOLATION - Formal
                                                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                        $r += $this->q;
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/naming.html#shortvariable

                                                                            Avoid variables with short names like $p. Configured minimum length is 3.
                                                                            Open

                                                                                public static function outputProgressLine(string $msg, float $p, float $memory, float $peak, ?int $offset = null, ?int $count = null): void
                                                                            Severity: Minor
                                                                            Found in src/Phan/CLI.php by phpmd

                                                                            ShortVariable

                                                                            Since: 0.2

                                                                            Detects when a field, local, or parameter has a very short name.

                                                                            Example

                                                                            class Something {
                                                                                private $q = 15; // VIOLATION - Field
                                                                                public static function main( array $as ) { // VIOLATION - Formal
                                                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                                                        $r += $this->q;
                                                                                    }
                                                                                }
                                                                            }

                                                                            Source https://phpmd.org/rules/naming.html#shortvariable

                                                                            There are no issues that match your filters.

                                                                            Category
                                                                            Status