diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c635b8182c..8294d53803 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -32,9 +32,11 @@ + + diff --git a/src/Config.php b/src/Config.php index 2233162ba6..9ab8fe5ff7 100644 --- a/src/Config.php +++ b/src/Config.php @@ -294,56 +294,56 @@ public function __set(string $name, $value) } switch ($name) { - case 'reportWidth' : - if (is_string($value) === true && $value === 'auto') { - // Nothing to do. Leave at 'auto'. - break; - } + case 'reportWidth' : + if (is_string($value) === true && $value === 'auto') { + // Nothing to do. Leave at 'auto'. + break; + } - if (is_int($value) === true) { - $value = abs($value); - } elseif (is_string($value) === true && preg_match('`^\d+$`', $value) === 1) { - $value = (int) $value; - } else { - $value = self::DEFAULT_REPORT_WIDTH; - } - break; + if (is_int($value) === true) { + $value = abs($value); + } elseif (is_string($value) === true && preg_match('`^\d+$`', $value) === 1) { + $value = (int) $value; + } else { + $value = self::DEFAULT_REPORT_WIDTH; + } + break; - case 'standards' : - $cleaned = []; + case 'standards' : + $cleaned = []; - // Check if the standard name is valid, or if the case is invalid. - $installedStandards = Standards::getInstalledStandards(); - foreach ($value as $standard) { - foreach ($installedStandards as $validStandard) { - if (strtolower($standard) === strtolower($validStandard)) { - $standard = $validStandard; - break; + // Check if the standard name is valid, or if the case is invalid. + $installedStandards = Standards::getInstalledStandards(); + foreach ($value as $standard) { + foreach ($installedStandards as $validStandard) { + if (strtolower($standard) === strtolower($validStandard)) { + $standard = $validStandard; + break; + } } - } - $cleaned[] = $standard; - } + $cleaned[] = $standard; + } - $value = $cleaned; - break; + $value = $cleaned; + break; - // Only track time when explicitly needed. - case 'verbosity': - if ($value > 2) { - $this->settings['trackTime'] = true; - } - break; - case 'reports': - $reports = array_change_key_case($value, CASE_LOWER); - if (array_key_exists('performance', $reports) === true) { - $this->settings['trackTime'] = true; - } - break; + // Only track time when explicitly needed. + case 'verbosity': + if ($value > 2) { + $this->settings['trackTime'] = true; + } + break; + case 'reports': + $reports = array_change_key_case($value, CASE_LOWER); + if (array_key_exists('performance', $reports) === true) { + $this->settings['trackTime'] = true; + } + break; - default : - // No validation required. - break; + default : + // No validation required. + break; } $this->settings[$name] = $value; @@ -669,101 +669,101 @@ public function restoreDefaults() public function processShortArgument(string $arg, int $pos) { switch ($arg) { - case 'h': - case '?': - $this->printUsage(); - throw new DeepExitException('', ExitCode::OKAY); - case 'i' : - $output = Standards::prepareInstalledStandardsForDisplay() . PHP_EOL; - throw new DeepExitException($output, ExitCode::OKAY); - case 'v' : - if ($this->quiet === true) { - // Ignore when quiet mode is enabled. - break; - } + case 'h': + case '?': + $this->printUsage(); + throw new DeepExitException('', ExitCode::OKAY); + case 'i' : + $output = Standards::prepareInstalledStandardsForDisplay() . PHP_EOL; + throw new DeepExitException($output, ExitCode::OKAY); + case 'v' : + if ($this->quiet === true) { + // Ignore when quiet mode is enabled. + break; + } - $this->verbosity++; - $this->overriddenDefaults['verbosity'] = true; - break; - case 'l' : - $this->local = true; - $this->overriddenDefaults['local'] = true; - break; - case 's' : - $this->showSources = true; - $this->overriddenDefaults['showSources'] = true; - break; - case 'a' : - $this->interactive = true; - $this->overriddenDefaults['interactive'] = true; - break; - case 'e': - $this->explain = true; - $this->overriddenDefaults['explain'] = true; - break; - case 'p' : - if ($this->quiet === true) { - // Ignore when quiet mode is enabled. + $this->verbosity++; + $this->overriddenDefaults['verbosity'] = true; break; - } + case 'l' : + $this->local = true; + $this->overriddenDefaults['local'] = true; + break; + case 's' : + $this->showSources = true; + $this->overriddenDefaults['showSources'] = true; + break; + case 'a' : + $this->interactive = true; + $this->overriddenDefaults['interactive'] = true; + break; + case 'e': + $this->explain = true; + $this->overriddenDefaults['explain'] = true; + break; + case 'p' : + if ($this->quiet === true) { + // Ignore when quiet mode is enabled. + break; + } - $this->showProgress = true; - $this->overriddenDefaults['showProgress'] = true; - break; - case 'q' : - // Quiet mode disables a few other settings as well. - $this->quiet = true; - $this->showProgress = false; - $this->verbosity = 0; - - $this->overriddenDefaults['quiet'] = true; - break; - case 'm' : - $this->recordErrors = false; - $this->overriddenDefaults['recordErrors'] = true; - break; - case 'd' : - $ini = explode('=', $this->cliArgs[($pos + 1)]); - $this->cliArgs[($pos + 1)] = ''; - if (isset($ini[1]) === false) { - // Set to true. - $ini[1] = '1'; - } + $this->showProgress = true; + $this->overriddenDefaults['showProgress'] = true; + break; + case 'q' : + // Quiet mode disables a few other settings as well. + $this->quiet = true; + $this->showProgress = false; + $this->verbosity = 0; - $current = ini_get($ini[0]); - if ($current === false) { - // Ini setting which doesn't exist, or is from an unavailable extension. - // Silently ignore it. + $this->overriddenDefaults['quiet'] = true; break; - } + case 'm' : + $this->recordErrors = false; + $this->overriddenDefaults['recordErrors'] = true; + break; + case 'd' : + $ini = explode('=', $this->cliArgs[($pos + 1)]); + $this->cliArgs[($pos + 1)] = ''; + if (isset($ini[1]) === false) { + // Set to true. + $ini[1] = '1'; + } - $changed = ini_set($ini[0], $ini[1]); - if ($changed === false && ini_get($ini[0]) !== $ini[1]) { - $error = sprintf('ERROR: Ini option "%s" cannot be changed at runtime.', $ini[0]) . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } - break; - case 'n' : - if (isset($this->overriddenDefaults['warningSeverity']) === false) { - $this->warningSeverity = 0; - $this->overriddenDefaults['warningSeverity'] = true; - } - break; - case 'w' : - if (isset($this->overriddenDefaults['warningSeverity']) === false) { - $this->warningSeverity = $this->errorSeverity; - $this->overriddenDefaults['warningSeverity'] = true; - } - break; - default: - if ($this->dieOnUnknownArg === false) { - $unknown = $this->unknown; - $unknown[] = $arg; - $this->unknown = $unknown; - } else { - $this->processUnknownArgument('-' . $arg, $pos); - } + $current = ini_get($ini[0]); + if ($current === false) { + // Ini setting which doesn't exist, or is from an unavailable extension. + // Silently ignore it. + break; + } + + $changed = ini_set($ini[0], $ini[1]); + if ($changed === false && ini_get($ini[0]) !== $ini[1]) { + $error = sprintf('ERROR: Ini option "%s" cannot be changed at runtime.', $ini[0]) . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } + break; + case 'n' : + if (isset($this->overriddenDefaults['warningSeverity']) === false) { + $this->warningSeverity = 0; + $this->overriddenDefaults['warningSeverity'] = true; + } + break; + case 'w' : + if (isset($this->overriddenDefaults['warningSeverity']) === false) { + $this->warningSeverity = $this->errorSeverity; + $this->overriddenDefaults['warningSeverity'] = true; + } + break; + default: + if ($this->dieOnUnknownArg === false) { + $unknown = $this->unknown; + $unknown[] = $arg; + $this->unknown = $unknown; + } else { + $this->processUnknownArgument('-' . $arg, $pos); + } } } @@ -780,521 +780,521 @@ public function processShortArgument(string $arg, int $pos) public function processLongArgument(string $arg, int $pos) { switch ($arg) { - case 'help': - $this->printUsage(); - throw new DeepExitException('', ExitCode::OKAY); - case 'version': - $output = 'PHP_CodeSniffer version ' . self::VERSION . ' (' . self::STABILITY . ') '; - $output .= 'by Squiz and PHPCSStandards' . PHP_EOL; - throw new DeepExitException($output, ExitCode::OKAY); - case 'colors': - if (isset($this->overriddenDefaults['colors']) === true) { - break; - } + case 'help': + $this->printUsage(); + throw new DeepExitException('', ExitCode::OKAY); + case 'version': + $output = 'PHP_CodeSniffer version ' . self::VERSION . ' (' . self::STABILITY . ') '; + $output .= 'by Squiz and PHPCSStandards' . PHP_EOL; + throw new DeepExitException($output, ExitCode::OKAY); + case 'colors': + if (isset($this->overriddenDefaults['colors']) === true) { + break; + } - $this->colors = true; - $this->overriddenDefaults['colors'] = true; - break; - case 'no-colors': - if (isset($this->overriddenDefaults['colors']) === true) { + $this->colors = true; + $this->overriddenDefaults['colors'] = true; break; - } + case 'no-colors': + if (isset($this->overriddenDefaults['colors']) === true) { + break; + } - $this->colors = false; - $this->overriddenDefaults['colors'] = true; - break; - case 'cache': - if (isset($this->overriddenDefaults['cache']) === true) { + $this->colors = false; + $this->overriddenDefaults['colors'] = true; break; - } + case 'cache': + if (isset($this->overriddenDefaults['cache']) === true) { + break; + } - $this->cache = true; - $this->overriddenDefaults['cache'] = true; - break; - case 'no-cache': - if (isset($this->overriddenDefaults['cache']) === true) { + $this->cache = true; + $this->overriddenDefaults['cache'] = true; break; - } + case 'no-cache': + if (isset($this->overriddenDefaults['cache']) === true) { + break; + } - $this->cache = false; - $this->overriddenDefaults['cache'] = true; - break; - case 'ignore-annotations': - if (isset($this->overriddenDefaults['annotations']) === true) { + $this->cache = false; + $this->overriddenDefaults['cache'] = true; break; - } - - $this->annotations = false; - $this->overriddenDefaults['annotations'] = true; - break; - case 'config-set': - if (isset($this->cliArgs[($pos + 1)]) === false - || isset($this->cliArgs[($pos + 2)]) === false - ) { - $error = 'ERROR: Setting a config option requires a name and value' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } - - $key = $this->cliArgs[($pos + 1)]; - $value = $this->cliArgs[($pos + 2)]; - $current = self::getConfigData($key); - - try { - $this->setConfigData($key, $value); - } catch (Exception $e) { - throw new DeepExitException($e->getMessage() . PHP_EOL, ExitCode::PROCESS_ERROR); - } - - $output = 'Using config file: ' . self::$configDataFile . PHP_EOL . PHP_EOL; + case 'ignore-annotations': + if (isset($this->overriddenDefaults['annotations']) === true) { + break; + } - if ($current === null) { - $output .= "Config value \"$key\" added successfully" . PHP_EOL; - } else { - $output .= "Config value \"$key\" updated successfully; old value was \"$current\"" . PHP_EOL; - } - throw new DeepExitException($output, ExitCode::OKAY); - case 'config-delete': - if (isset($this->cliArgs[($pos + 1)]) === false) { - $error = 'ERROR: Deleting a config option requires the name of the option' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } + $this->annotations = false; + $this->overriddenDefaults['annotations'] = true; + break; + case 'config-set': + if (isset($this->cliArgs[($pos + 1)]) === false + || isset($this->cliArgs[($pos + 2)]) === false + ) { + $error = 'ERROR: Setting a config option requires a name and value' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } - $output = 'Using config file: ' . self::$configDataFile . PHP_EOL . PHP_EOL; + $key = $this->cliArgs[($pos + 1)]; + $value = $this->cliArgs[($pos + 2)]; + $current = self::getConfigData($key); - $key = $this->cliArgs[($pos + 1)]; - $current = self::getConfigData($key); - if ($current === null) { - $output .= "Config value \"$key\" has not been set" . PHP_EOL; - } else { try { - $this->setConfigData($key, null); + $this->setConfigData($key, $value); } catch (Exception $e) { throw new DeepExitException($e->getMessage() . PHP_EOL, ExitCode::PROCESS_ERROR); } - $output .= "Config value \"$key\" removed successfully; old value was \"$current\"" . PHP_EOL; - } - throw new DeepExitException($output, ExitCode::OKAY); - case 'config-show': - $data = self::getAllConfigData(); - $output = 'Using config file: ' . self::$configDataFile . PHP_EOL . PHP_EOL; - $output .= $this->prepareConfigDataForDisplay($data); - throw new DeepExitException($output, ExitCode::OKAY); - case 'runtime-set': - if (isset($this->cliArgs[($pos + 1)]) === false - || isset($this->cliArgs[($pos + 2)]) === false - ) { - $error = 'ERROR: Setting a runtime config option requires a name and value' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } - - $key = $this->cliArgs[($pos + 1)]; - $value = $this->cliArgs[($pos + 2)]; - $this->cliArgs[($pos + 1)] = ''; - $this->cliArgs[($pos + 2)] = ''; - $this->setConfigData($key, $value, true); - if (isset($this->overriddenDefaults['runtime-set']) === false) { - $this->overriddenDefaults['runtime-set'] = []; - } + $output = 'Using config file: ' . self::$configDataFile . PHP_EOL . PHP_EOL; - $this->overriddenDefaults['runtime-set'][$key] = true; - break; - default: - if (substr($arg, 0, 7) === 'sniffs=') { - if (isset($this->overriddenDefaults['sniffs']) === true) { - break; + if ($current === null) { + $output .= "Config value \"$key\" added successfully" . PHP_EOL; + } else { + $output .= "Config value \"$key\" updated successfully; old value was \"$current\"" . PHP_EOL; } - - $this->sniffs = $this->parseSniffCodes(substr($arg, 7), 'sniffs'); - $this->overriddenDefaults['sniffs'] = true; - } elseif (substr($arg, 0, 8) === 'exclude=') { - if (isset($this->overriddenDefaults['exclude']) === true) { - break; + throw new DeepExitException($output, ExitCode::OKAY); + case 'config-delete': + if (isset($this->cliArgs[($pos + 1)]) === false) { + $error = 'ERROR: Deleting a config option requires the name of the option' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); } - $this->exclude = $this->parseSniffCodes(substr($arg, 8), 'exclude'); - $this->overriddenDefaults['exclude'] = true; - } elseif (substr($arg, 0, 6) === 'cache=') { - if ((isset($this->overriddenDefaults['cache']) === true - && $this->cache === false) - || isset($this->overriddenDefaults['cacheFile']) === true + $output = 'Using config file: ' . self::$configDataFile . PHP_EOL . PHP_EOL; + + $key = $this->cliArgs[($pos + 1)]; + $current = self::getConfigData($key); + if ($current === null) { + $output .= "Config value \"$key\" has not been set" . PHP_EOL; + } else { + try { + $this->setConfigData($key, null); + } catch (Exception $e) { + throw new DeepExitException($e->getMessage() . PHP_EOL, ExitCode::PROCESS_ERROR); + } + + $output .= "Config value \"$key\" removed successfully; old value was \"$current\"" . PHP_EOL; + } + throw new DeepExitException($output, ExitCode::OKAY); + case 'config-show': + $data = self::getAllConfigData(); + $output = 'Using config file: ' . self::$configDataFile . PHP_EOL . PHP_EOL; + $output .= $this->prepareConfigDataForDisplay($data); + throw new DeepExitException($output, ExitCode::OKAY); + case 'runtime-set': + if (isset($this->cliArgs[($pos + 1)]) === false + || isset($this->cliArgs[($pos + 2)]) === false ) { - break; + $error = 'ERROR: Setting a runtime config option requires a name and value' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); } - // Turn caching on. - $this->cache = true; - $this->overriddenDefaults['cache'] = true; + $key = $this->cliArgs[($pos + 1)]; + $value = $this->cliArgs[($pos + 2)]; + $this->cliArgs[($pos + 1)] = ''; + $this->cliArgs[($pos + 2)] = ''; + $this->setConfigData($key, $value, true); + if (isset($this->overriddenDefaults['runtime-set']) === false) { + $this->overriddenDefaults['runtime-set'] = []; + } - $this->cacheFile = Common::realpath(substr($arg, 6)); + $this->overriddenDefaults['runtime-set'][$key] = true; + break; + default: + if (substr($arg, 0, 7) === 'sniffs=') { + if (isset($this->overriddenDefaults['sniffs']) === true) { + break; + } - // It may not exist and return false instead. - if ($this->cacheFile === false) { - $this->cacheFile = substr($arg, 6); + $this->sniffs = $this->parseSniffCodes(substr($arg, 7), 'sniffs'); + $this->overriddenDefaults['sniffs'] = true; + } elseif (substr($arg, 0, 8) === 'exclude=') { + if (isset($this->overriddenDefaults['exclude']) === true) { + break; + } - $dir = dirname($this->cacheFile); - if (is_dir($dir) === false) { - $error = 'ERROR: The specified cache file path "' . $this->cacheFile . '" points to a non-existent directory' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + $this->exclude = $this->parseSniffCodes(substr($arg, 8), 'exclude'); + $this->overriddenDefaults['exclude'] = true; + } elseif (substr($arg, 0, 6) === 'cache=') { + if ((isset($this->overriddenDefaults['cache']) === true + && $this->cache === false) + || isset($this->overriddenDefaults['cacheFile']) === true + ) { + break; } - if ($dir === '.') { - // Passed cache file is a file in the current directory. - $this->cacheFile = getcwd() . '/' . basename($this->cacheFile); - } else { - if ($dir[0] === '/') { - // An absolute path. - $dir = Common::realpath($dir); - } else { - $dir = Common::realpath(getcwd() . '/' . $dir); + // Turn caching on. + $this->cache = true; + $this->overriddenDefaults['cache'] = true; + + $this->cacheFile = Common::realpath(substr($arg, 6)); + + // It may not exist and return false instead. + if ($this->cacheFile === false) { + $this->cacheFile = substr($arg, 6); + + $dir = dirname($this->cacheFile); + if (is_dir($dir) === false) { + $error = 'ERROR: The specified cache file path "' . $this->cacheFile . '" points to a non-existent directory' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); } - if ($dir !== false) { - // Cache file path is relative. - $this->cacheFile = $dir . '/' . basename($this->cacheFile); + if ($dir === '.') { + // Passed cache file is a file in the current directory. + $this->cacheFile = getcwd() . '/' . basename($this->cacheFile); + } else { + if ($dir[0] === '/') { + // An absolute path. + $dir = Common::realpath($dir); + } else { + $dir = Common::realpath(getcwd() . '/' . $dir); + } + + if ($dir !== false) { + // Cache file path is relative. + $this->cacheFile = $dir . '/' . basename($this->cacheFile); + } } } - } - $this->overriddenDefaults['cacheFile'] = true; + $this->overriddenDefaults['cacheFile'] = true; - if (is_dir($this->cacheFile) === true) { - $error = 'ERROR: The specified cache file path "' . $this->cacheFile . '" is a directory' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } - } elseif (substr($arg, 0, 10) === 'bootstrap=') { - $files = explode(',', substr($arg, 10)); - $bootstrap = []; - foreach ($files as $file) { - $path = Common::realpath($file); + if (is_dir($this->cacheFile) === true) { + $error = 'ERROR: The specified cache file path "' . $this->cacheFile . '" is a directory' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } + } elseif (substr($arg, 0, 10) === 'bootstrap=') { + $files = explode(',', substr($arg, 10)); + $bootstrap = []; + foreach ($files as $file) { + $path = Common::realpath($file); + if ($path === false) { + $error = 'ERROR: The specified bootstrap file "' . $file . '" does not exist' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } + + $bootstrap[] = $path; + } + + $this->bootstrap = array_merge($this->bootstrap, $bootstrap); + $this->overriddenDefaults['bootstrap'] = true; + } elseif (substr($arg, 0, 10) === 'file-list=') { + $fileList = substr($arg, 10); + $path = Common::realpath($fileList); if ($path === false) { - $error = 'ERROR: The specified bootstrap file "' . $file . '" does not exist' . PHP_EOL . PHP_EOL; + $error = 'ERROR: The specified file list "' . $fileList . '" does not exist' . PHP_EOL . PHP_EOL; $error .= $this->printShortUsage(true); throw new DeepExitException($error, ExitCode::PROCESS_ERROR); } - $bootstrap[] = $path; - } + $files = file($path); + foreach ($files as $inputFile) { + $inputFile = trim($inputFile); - $this->bootstrap = array_merge($this->bootstrap, $bootstrap); - $this->overriddenDefaults['bootstrap'] = true; - } elseif (substr($arg, 0, 10) === 'file-list=') { - $fileList = substr($arg, 10); - $path = Common::realpath($fileList); - if ($path === false) { - $error = 'ERROR: The specified file list "' . $fileList . '" does not exist' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } + // Skip empty lines. + if ($inputFile === '') { + continue; + } + + $this->processFilePath($inputFile); + } + } elseif (substr($arg, 0, 11) === 'stdin-path=') { + if (isset($this->overriddenDefaults['stdinPath']) === true) { + break; + } - $files = file($path); - foreach ($files as $inputFile) { - $inputFile = trim($inputFile); + $this->stdinPath = Common::realpath(substr($arg, 11)); - // Skip empty lines. - if ($inputFile === '') { - continue; + // It may not exist and return false instead, so use whatever they gave us. + if ($this->stdinPath === false) { + $this->stdinPath = trim(substr($arg, 11)); } - $this->processFilePath($inputFile); - } - } elseif (substr($arg, 0, 11) === 'stdin-path=') { - if (isset($this->overriddenDefaults['stdinPath']) === true) { - break; - } + $this->overriddenDefaults['stdinPath'] = true; + } elseif (substr($arg, 0, 12) === 'report-file=') { + if (PHP_CODESNIFFER_CBF === true || isset($this->overriddenDefaults['reportFile']) === true) { + break; + } - $this->stdinPath = Common::realpath(substr($arg, 11)); + $this->reportFile = Common::realpath(substr($arg, 12)); - // It may not exist and return false instead, so use whatever they gave us. - if ($this->stdinPath === false) { - $this->stdinPath = trim(substr($arg, 11)); - } + // It may not exist and return false instead. + if ($this->reportFile === false) { + $this->reportFile = substr($arg, 12); - $this->overriddenDefaults['stdinPath'] = true; - } elseif (substr($arg, 0, 12) === 'report-file=') { - if (PHP_CODESNIFFER_CBF === true || isset($this->overriddenDefaults['reportFile']) === true) { - break; - } + $dir = Common::realpath(dirname($this->reportFile)); + if (is_dir($dir) === false) { + $error = 'ERROR: The specified report file path "' . $this->reportFile . '" points to a non-existent directory' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } - $this->reportFile = Common::realpath(substr($arg, 12)); + $this->reportFile = $dir . '/' . basename($this->reportFile); + } - // It may not exist and return false instead. - if ($this->reportFile === false) { - $this->reportFile = substr($arg, 12); + $this->overriddenDefaults['reportFile'] = true; - $dir = Common::realpath(dirname($this->reportFile)); - if (is_dir($dir) === false) { - $error = 'ERROR: The specified report file path "' . $this->reportFile . '" points to a non-existent directory' . PHP_EOL . PHP_EOL; + if (is_dir($this->reportFile) === true) { + $error = 'ERROR: The specified report file path "' . $this->reportFile . '" is a directory' . PHP_EOL . PHP_EOL; $error .= $this->printShortUsage(true); throw new DeepExitException($error, ExitCode::PROCESS_ERROR); } + } elseif (substr($arg, 0, 13) === 'report-width=') { + if (isset($this->overriddenDefaults['reportWidth']) === true) { + break; + } - $this->reportFile = $dir . '/' . basename($this->reportFile); - } - - $this->overriddenDefaults['reportFile'] = true; - - if (is_dir($this->reportFile) === true) { - $error = 'ERROR: The specified report file path "' . $this->reportFile . '" is a directory' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } - } elseif (substr($arg, 0, 13) === 'report-width=') { - if (isset($this->overriddenDefaults['reportWidth']) === true) { - break; - } - - $this->reportWidth = substr($arg, 13); - $this->overriddenDefaults['reportWidth'] = true; - } elseif (substr($arg, 0, 9) === 'basepath=') { - if (isset($this->overriddenDefaults['basepath']) === true) { - break; - } - - $this->overriddenDefaults['basepath'] = true; + $this->reportWidth = substr($arg, 13); + $this->overriddenDefaults['reportWidth'] = true; + } elseif (substr($arg, 0, 9) === 'basepath=') { + if (isset($this->overriddenDefaults['basepath']) === true) { + break; + } - if (substr($arg, 9) === '') { - $this->basepath = null; - break; - } + $this->overriddenDefaults['basepath'] = true; - $basepath = Common::realpath(substr($arg, 9)); + if (substr($arg, 9) === '') { + $this->basepath = null; + break; + } - // It may not exist and return false instead. - if ($basepath === false) { - $this->basepath = substr($arg, 9); - } else { - $this->basepath = $basepath; - } + $basepath = Common::realpath(substr($arg, 9)); - if (is_dir($this->basepath) === false) { - $error = 'ERROR: The specified basepath "' . $this->basepath . '" points to a non-existent directory' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } - } elseif ((substr($arg, 0, 7) === 'report=' || substr($arg, 0, 7) === 'report-')) { - $reports = []; - - if ($arg[6] === '-') { - // This is a report with file output. - $split = strpos($arg, '='); - if ($split === false) { - $report = substr($arg, 7); - $output = null; + // It may not exist and return false instead. + if ($basepath === false) { + $this->basepath = substr($arg, 9); } else { - $report = substr($arg, 7, ($split - 7)); - $output = substr($arg, ($split + 1)); - if ($output === false) { + $this->basepath = $basepath; + } + + if (is_dir($this->basepath) === false) { + $error = 'ERROR: The specified basepath "' . $this->basepath . '" points to a non-existent directory' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } + } elseif ((substr($arg, 0, 7) === 'report=' || substr($arg, 0, 7) === 'report-')) { + $reports = []; + + if ($arg[6] === '-') { + // This is a report with file output. + $split = strpos($arg, '='); + if ($split === false) { + $report = substr($arg, 7); $output = null; } else { - $dir = Common::realpath(dirname($output)); - if (is_dir($dir) === false) { - $error = 'ERROR: The specified ' . $report . ' report file path "' . $output . '" points to a non-existent directory' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + $report = substr($arg, 7, ($split - 7)); + $output = substr($arg, ($split + 1)); + if ($output === false) { + $output = null; + } else { + $dir = Common::realpath(dirname($output)); + if (is_dir($dir) === false) { + $error = 'ERROR: The specified ' . $report . ' report file path "' . $output . '" points to a non-existent directory' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } + + $output = $dir . '/' . basename($output); + + if (is_dir($output) === true) { + $error = 'ERROR: The specified ' . $report . ' report file path "' . $output . '" is a directory' . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } } + } - $output = $dir . '/' . basename($output); + $reports[$report] = $output; + } else { + // This is a single report. + if (isset($this->overriddenDefaults['reports']) === true) { + break; + } - if (is_dir($output) === true) { - $error = 'ERROR: The specified ' . $report . ' report file path "' . $output . '" is a directory' . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } + $reportNames = explode(',', substr($arg, 7)); + foreach ($reportNames as $report) { + $reports[$report] = null; } } - $reports[$report] = $output; - } else { - // This is a single report. - if (isset($this->overriddenDefaults['reports']) === true) { - break; + // Remove the default value so the CLI value overrides it. + if (isset($this->overriddenDefaults['reports']) === false) { + $this->reports = $reports; + } else { + $this->reports = array_merge($this->reports, $reports); } - $reportNames = explode(',', substr($arg, 7)); - foreach ($reportNames as $report) { - $reports[$report] = null; + $this->overriddenDefaults['reports'] = true; + } elseif (substr($arg, 0, 7) === 'filter=') { + if (isset($this->overriddenDefaults['filter']) === true) { + break; } - } - - // Remove the default value so the CLI value overrides it. - if (isset($this->overriddenDefaults['reports']) === false) { - $this->reports = $reports; - } else { - $this->reports = array_merge($this->reports, $reports); - } - - $this->overriddenDefaults['reports'] = true; - } elseif (substr($arg, 0, 7) === 'filter=') { - if (isset($this->overriddenDefaults['filter']) === true) { - break; - } - $this->filter = substr($arg, 7); - $this->overriddenDefaults['filter'] = true; - } elseif (substr($arg, 0, 9) === 'standard=') { - $standards = trim(substr($arg, 9)); - if ($standards !== '') { - $this->standards = explode(',', $standards); - } + $this->filter = substr($arg, 7); + $this->overriddenDefaults['filter'] = true; + } elseif (substr($arg, 0, 9) === 'standard=') { + $standards = trim(substr($arg, 9)); + if ($standards !== '') { + $this->standards = explode(',', $standards); + } - $this->overriddenDefaults['standards'] = true; - } elseif (substr($arg, 0, 11) === 'extensions=') { - if (isset($this->overriddenDefaults['extensions']) === true) { - break; - } + $this->overriddenDefaults['standards'] = true; + } elseif (substr($arg, 0, 11) === 'extensions=') { + if (isset($this->overriddenDefaults['extensions']) === true) { + break; + } - $extensionsString = substr($arg, 11); - $newExtensions = []; - if (empty($extensionsString) === false) { - $extensions = explode(',', $extensionsString); - foreach ($extensions as $ext) { - if (strpos($ext, '/') !== false) { - // They specified the tokenizer too. - list($ext, $tokenizer) = explode('/', $ext); - if (strtoupper($tokenizer) !== 'PHP') { - $error = 'ERROR: Specifying the tokenizer to use for an extension is no longer supported.' . PHP_EOL; - $error .= 'PHP_CodeSniffer >= 4.0 only supports scanning PHP files.' . PHP_EOL; - $error .= 'Received: ' . substr($arg, 11) . PHP_EOL . PHP_EOL; - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + $extensionsString = substr($arg, 11); + $newExtensions = []; + if (empty($extensionsString) === false) { + $extensions = explode(',', $extensionsString); + foreach ($extensions as $ext) { + if (strpos($ext, '/') !== false) { + // They specified the tokenizer too. + list($ext, $tokenizer) = explode('/', $ext); + if (strtoupper($tokenizer) !== 'PHP') { + $error = 'ERROR: Specifying the tokenizer to use for an extension is no longer supported.' . PHP_EOL; + $error .= 'PHP_CodeSniffer >= 4.0 only supports scanning PHP files.' . PHP_EOL; + $error .= 'Received: ' . substr($arg, 11) . PHP_EOL . PHP_EOL; + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } } + + $newExtensions[$ext] = 'PHP'; } + } - $newExtensions[$ext] = 'PHP'; + $this->extensions = $newExtensions; + $this->overriddenDefaults['extensions'] = true; + } elseif (substr($arg, 0, 7) === 'suffix=') { + if (isset($this->overriddenDefaults['suffix']) === true) { + break; } - } - $this->extensions = $newExtensions; - $this->overriddenDefaults['extensions'] = true; - } elseif (substr($arg, 0, 7) === 'suffix=') { - if (isset($this->overriddenDefaults['suffix']) === true) { - break; - } + $this->suffix = substr($arg, 7); + $this->overriddenDefaults['suffix'] = true; + } elseif (substr($arg, 0, 9) === 'parallel=') { + if (isset($this->overriddenDefaults['parallel']) === true) { + break; + } - $this->suffix = substr($arg, 7); - $this->overriddenDefaults['suffix'] = true; - } elseif (substr($arg, 0, 9) === 'parallel=') { - if (isset($this->overriddenDefaults['parallel']) === true) { - break; - } + $this->parallel = max((int) substr($arg, 9), 1); + $this->overriddenDefaults['parallel'] = true; + } elseif (substr($arg, 0, 9) === 'severity=') { + $this->errorSeverity = (int) substr($arg, 9); + $this->warningSeverity = $this->errorSeverity; + if (isset($this->overriddenDefaults['errorSeverity']) === false) { + $this->overriddenDefaults['errorSeverity'] = true; + } + + if (isset($this->overriddenDefaults['warningSeverity']) === false) { + $this->overriddenDefaults['warningSeverity'] = true; + } + } elseif (substr($arg, 0, 15) === 'error-severity=') { + if (isset($this->overriddenDefaults['errorSeverity']) === true) { + break; + } - $this->parallel = max((int) substr($arg, 9), 1); - $this->overriddenDefaults['parallel'] = true; - } elseif (substr($arg, 0, 9) === 'severity=') { - $this->errorSeverity = (int) substr($arg, 9); - $this->warningSeverity = $this->errorSeverity; - if (isset($this->overriddenDefaults['errorSeverity']) === false) { + $this->errorSeverity = (int) substr($arg, 15); $this->overriddenDefaults['errorSeverity'] = true; - } + } elseif (substr($arg, 0, 17) === 'warning-severity=') { + if (isset($this->overriddenDefaults['warningSeverity']) === true) { + break; + } - if (isset($this->overriddenDefaults['warningSeverity']) === false) { + $this->warningSeverity = (int) substr($arg, 17); $this->overriddenDefaults['warningSeverity'] = true; - } - } elseif (substr($arg, 0, 15) === 'error-severity=') { - if (isset($this->overriddenDefaults['errorSeverity']) === true) { - break; - } + } elseif (substr($arg, 0, 7) === 'ignore=') { + if (isset($this->overriddenDefaults['ignored']) === true) { + break; + } - $this->errorSeverity = (int) substr($arg, 15); - $this->overriddenDefaults['errorSeverity'] = true; - } elseif (substr($arg, 0, 17) === 'warning-severity=') { - if (isset($this->overriddenDefaults['warningSeverity']) === true) { - break; - } + // Split the ignore string on commas, unless the comma is escaped + // using 1 or 3 slashes (\, or \\\,). + $patterns = preg_split( + '/(?<=(?warningSeverity = (int) substr($arg, 17); - $this->overriddenDefaults['warningSeverity'] = true; - } elseif (substr($arg, 0, 7) === 'ignore=') { - if (isset($this->overriddenDefaults['ignored']) === true) { - break; - } + $ignored = []; + foreach ($patterns as $pattern) { + $pattern = trim($pattern); + if ($pattern === '') { + continue; + } - // Split the ignore string on commas, unless the comma is escaped - // using 1 or 3 slashes (\, or \\\,). - $patterns = preg_split( - '/(?<=(?ignored = $ignored; - $this->overriddenDefaults['ignored'] = true; - } elseif (substr($arg, 0, 10) === 'generator=' - && PHP_CODESNIFFER_CBF === false - ) { - if (isset($this->overriddenDefaults['generator']) === true) { - break; - } - - $generatorName = substr($arg, 10); - $lowerCaseGeneratorName = strtolower($generatorName); + $this->ignored = $ignored; + $this->overriddenDefaults['ignored'] = true; + } elseif (substr($arg, 0, 10) === 'generator=' + && PHP_CODESNIFFER_CBF === false + ) { + if (isset($this->overriddenDefaults['generator']) === true) { + break; + } - if (isset(self::VALID_GENERATORS[$lowerCaseGeneratorName]) === false) { - $validOptions = implode(', ', self::VALID_GENERATORS); - $validOptions = substr_replace($validOptions, ' and', strrpos($validOptions, ','), 1); - $error = sprintf( - 'ERROR: "%s" is not a valid generator. The following generators are supported: %s.' . PHP_EOL . PHP_EOL, - $generatorName, - $validOptions - ); - $error .= $this->printShortUsage(true); - throw new DeepExitException($error, ExitCode::PROCESS_ERROR); - } + $generatorName = substr($arg, 10); + $lowerCaseGeneratorName = strtolower($generatorName); + + if (isset(self::VALID_GENERATORS[$lowerCaseGeneratorName]) === false) { + $validOptions = implode(', ', self::VALID_GENERATORS); + $validOptions = substr_replace($validOptions, ' and', strrpos($validOptions, ','), 1); + $error = sprintf( + 'ERROR: "%s" is not a valid generator. The following generators are supported: %s.' . PHP_EOL . PHP_EOL, + $generatorName, + $validOptions + ); + $error .= $this->printShortUsage(true); + throw new DeepExitException($error, ExitCode::PROCESS_ERROR); + } - $this->generator = self::VALID_GENERATORS[$lowerCaseGeneratorName]; - $this->overriddenDefaults['generator'] = true; - } elseif (substr($arg, 0, 9) === 'encoding=') { - if (isset($this->overriddenDefaults['encoding']) === true) { - break; - } + $this->generator = self::VALID_GENERATORS[$lowerCaseGeneratorName]; + $this->overriddenDefaults['generator'] = true; + } elseif (substr($arg, 0, 9) === 'encoding=') { + if (isset($this->overriddenDefaults['encoding']) === true) { + break; + } - $this->encoding = strtolower(substr($arg, 9)); - $this->overriddenDefaults['encoding'] = true; - } elseif (substr($arg, 0, 10) === 'tab-width=') { - if (isset($this->overriddenDefaults['tabWidth']) === true) { - break; - } + $this->encoding = strtolower(substr($arg, 9)); + $this->overriddenDefaults['encoding'] = true; + } elseif (substr($arg, 0, 10) === 'tab-width=') { + if (isset($this->overriddenDefaults['tabWidth']) === true) { + break; + } - $this->tabWidth = (int) substr($arg, 10); - $this->overriddenDefaults['tabWidth'] = true; - } else { - if ($this->dieOnUnknownArg === false) { - $eqPos = strpos($arg, '='); - try { - $unknown = $this->unknown; + $this->tabWidth = (int) substr($arg, 10); + $this->overriddenDefaults['tabWidth'] = true; + } else { + if ($this->dieOnUnknownArg === false) { + $eqPos = strpos($arg, '='); + try { + $unknown = $this->unknown; + + if ($eqPos === false) { + $unknown[$arg] = $arg; + } else { + $value = substr($arg, ($eqPos + 1)); + $arg = substr($arg, 0, $eqPos); + $unknown[$arg] = $value; + } - if ($eqPos === false) { - $unknown[$arg] = $arg; - } else { - $value = substr($arg, ($eqPos + 1)); - $arg = substr($arg, 0, $eqPos); - $unknown[$arg] = $value; + $this->unknown = $unknown; + } catch (RuntimeException $e) { + // Value is not valid, so just ignore it. } - - $this->unknown = $unknown; - } catch (RuntimeException $e) { - // Value is not valid, so just ignore it. + } else { + $this->processUnknownArgument('--' . $arg, $pos); } - } else { - $this->processUnknownArgument('--' . $arg, $pos); } - } - break; + break; } } diff --git a/src/Files/File.php b/src/Files/File.php index 8dab97f01c..9fcb7e3dd8 100644 --- a/src/Files/File.php +++ b/src/Files/File.php @@ -1450,208 +1450,208 @@ public function getMethodParameters(int $stackPtr) } switch ($this->tokens[$i]['code']) { - case T_ATTRIBUTE: - $hasAttributes = true; + case T_ATTRIBUTE: + $hasAttributes = true; - // Skip to the end of the attribute. - $i = $this->tokens[$i]['attribute_closer']; - break; - case T_BITWISE_AND: - if ($defaultStart === null) { - $passByReference = true; - $referenceToken = $i; - } - break; - case T_VARIABLE: - $currVar = $i; - break; - case T_ELLIPSIS: - $variableLength = true; - $variadicToken = $i; - break; - case T_CALLABLE: - if ($typeHintToken === false) { - $typeHintToken = $i; - } - - $typeHint .= $this->tokens[$i]['content']; - $typeHintEndToken = $i; - break; - case T_SELF: - case T_PARENT: - case T_STATIC: - // Self and parent are valid, static invalid, but was probably intended as type hint. - if (isset($defaultStart) === false) { + // Skip to the end of the attribute. + $i = $this->tokens[$i]['attribute_closer']; + break; + case T_BITWISE_AND: + if ($defaultStart === null) { + $passByReference = true; + $referenceToken = $i; + } + break; + case T_VARIABLE: + $currVar = $i; + break; + case T_ELLIPSIS: + $variableLength = true; + $variadicToken = $i; + break; + case T_CALLABLE: if ($typeHintToken === false) { $typeHintToken = $i; } $typeHint .= $this->tokens[$i]['content']; $typeHintEndToken = $i; - } - break; - case T_STRING: - case T_NAME_QUALIFIED: - case T_NAME_FULLY_QUALIFIED: - case T_NAME_RELATIVE: - // This is an identifier name, so it may be a type declaration, but it could - // also be a constant used as a default value. - $prevComma = false; - for ($t = $i; $t >= $opener; $t--) { - if ($this->tokens[$t]['code'] === T_COMMA) { - $prevComma = $t; - break; - } - } + break; + case T_SELF: + case T_PARENT: + case T_STATIC: + // Self and parent are valid, static invalid, but was probably intended as type hint. + if (isset($defaultStart) === false) { + if ($typeHintToken === false) { + $typeHintToken = $i; + } - if ($prevComma !== false) { - $nextEquals = false; - for ($t = $prevComma; $t < $i; $t++) { - if ($this->tokens[$t]['code'] === T_EQUAL) { - $nextEquals = $t; + $typeHint .= $this->tokens[$i]['content']; + $typeHintEndToken = $i; + } + break; + case T_STRING: + case T_NAME_QUALIFIED: + case T_NAME_FULLY_QUALIFIED: + case T_NAME_RELATIVE: + // This is an identifier name, so it may be a type declaration, but it could + // also be a constant used as a default value. + $prevComma = false; + for ($t = $i; $t >= $opener; $t--) { + if ($this->tokens[$t]['code'] === T_COMMA) { + $prevComma = $t; break; } } - if ($nextEquals !== false) { - break; + if ($prevComma !== false) { + $nextEquals = false; + for ($t = $prevComma; $t < $i; $t++) { + if ($this->tokens[$t]['code'] === T_EQUAL) { + $nextEquals = $t; + break; + } + } + + if ($nextEquals !== false) { + break; + } } - } - if ($defaultStart === null) { - if ($typeHintToken === false) { - $typeHintToken = $i; + if ($defaultStart === null) { + if ($typeHintToken === false) { + $typeHintToken = $i; + } + + $typeHint .= $this->tokens[$i]['content']; + $typeHintEndToken = $i; } + break; + case T_NAMESPACE: + case T_NS_SEPARATOR: + case T_TYPE_UNION: + case T_TYPE_INTERSECTION: + case T_TYPE_OPEN_PARENTHESIS: + case T_TYPE_CLOSE_PARENTHESIS: + case T_FALSE: + case T_TRUE: + case T_NULL: + // Part of a type hint or default value. + if ($defaultStart === null) { + if ($typeHintToken === false) { + $typeHintToken = $i; + } - $typeHint .= $this->tokens[$i]['content']; - $typeHintEndToken = $i; - } - break; - case T_NAMESPACE: - case T_NS_SEPARATOR: - case T_TYPE_UNION: - case T_TYPE_INTERSECTION: - case T_TYPE_OPEN_PARENTHESIS: - case T_TYPE_CLOSE_PARENTHESIS: - case T_FALSE: - case T_TRUE: - case T_NULL: - // Part of a type hint or default value. - if ($defaultStart === null) { - if ($typeHintToken === false) { - $typeHintToken = $i; + $typeHint .= $this->tokens[$i]['content']; + $typeHintEndToken = $i; + } + break; + case T_NULLABLE: + if ($defaultStart === null) { + $nullableType = true; + $typeHint .= $this->tokens[$i]['content']; + $typeHintEndToken = $i; + } + break; + case T_PUBLIC: + case T_PROTECTED: + case T_PRIVATE: + if ($defaultStart === null) { + $visibilityToken = $i; + } + break; + case T_PUBLIC_SET: + case T_PROTECTED_SET: + case T_PRIVATE_SET: + if ($defaultStart === null) { + $setVisibilityToken = $i; + } + break; + case T_READONLY: + if ($defaultStart === null) { + $readonlyToken = $i; + } + break; + case T_CLOSE_PARENTHESIS: + case T_COMMA: + // If it's null, then there must be no parameters for this + // method. + if ($currVar === null) { + continue 2; } - $typeHint .= $this->tokens[$i]['content']; - $typeHintEndToken = $i; - } - break; - case T_NULLABLE: - if ($defaultStart === null) { - $nullableType = true; - $typeHint .= $this->tokens[$i]['content']; - $typeHintEndToken = $i; - } - break; - case T_PUBLIC: - case T_PROTECTED: - case T_PRIVATE: - if ($defaultStart === null) { - $visibilityToken = $i; - } - break; - case T_PUBLIC_SET: - case T_PROTECTED_SET: - case T_PRIVATE_SET: - if ($defaultStart === null) { - $setVisibilityToken = $i; - } - break; - case T_READONLY: - if ($defaultStart === null) { - $readonlyToken = $i; - } - break; - case T_CLOSE_PARENTHESIS: - case T_COMMA: - // If it's null, then there must be no parameters for this - // method. - if ($currVar === null) { - continue 2; - } + $vars[$paramCount] = []; + $vars[$paramCount]['token'] = $currVar; + $vars[$paramCount]['name'] = $this->tokens[$currVar]['content']; + $vars[$paramCount]['content'] = trim($this->getTokensAsString($paramStart, ($i - $paramStart))); - $vars[$paramCount] = []; - $vars[$paramCount]['token'] = $currVar; - $vars[$paramCount]['name'] = $this->tokens[$currVar]['content']; - $vars[$paramCount]['content'] = trim($this->getTokensAsString($paramStart, ($i - $paramStart))); + if ($defaultStart !== null) { + $vars[$paramCount]['default'] = trim($this->getTokensAsString($defaultStart, ($i - $defaultStart))); + $vars[$paramCount]['default_token'] = $defaultStart; + $vars[$paramCount]['default_equal_token'] = $equalToken; + } - if ($defaultStart !== null) { - $vars[$paramCount]['default'] = trim($this->getTokensAsString($defaultStart, ($i - $defaultStart))); - $vars[$paramCount]['default_token'] = $defaultStart; - $vars[$paramCount]['default_equal_token'] = $equalToken; - } + $vars[$paramCount]['has_attributes'] = $hasAttributes; + $vars[$paramCount]['pass_by_reference'] = $passByReference; + $vars[$paramCount]['reference_token'] = $referenceToken; + $vars[$paramCount]['variable_length'] = $variableLength; + $vars[$paramCount]['variadic_token'] = $variadicToken; + $vars[$paramCount]['type_hint'] = $typeHint; + $vars[$paramCount]['type_hint_token'] = $typeHintToken; + $vars[$paramCount]['type_hint_end_token'] = $typeHintEndToken; + $vars[$paramCount]['nullable_type'] = $nullableType; + + if ($visibilityToken !== null || $setVisibilityToken !== null || $readonlyToken !== null) { + $vars[$paramCount]['property_visibility'] = 'public'; + $vars[$paramCount]['visibility_token'] = false; + + if ($visibilityToken !== null) { + $vars[$paramCount]['property_visibility'] = $this->tokens[$visibilityToken]['content']; + $vars[$paramCount]['visibility_token'] = $visibilityToken; + } - $vars[$paramCount]['has_attributes'] = $hasAttributes; - $vars[$paramCount]['pass_by_reference'] = $passByReference; - $vars[$paramCount]['reference_token'] = $referenceToken; - $vars[$paramCount]['variable_length'] = $variableLength; - $vars[$paramCount]['variadic_token'] = $variadicToken; - $vars[$paramCount]['type_hint'] = $typeHint; - $vars[$paramCount]['type_hint_token'] = $typeHintToken; - $vars[$paramCount]['type_hint_end_token'] = $typeHintEndToken; - $vars[$paramCount]['nullable_type'] = $nullableType; - - if ($visibilityToken !== null || $setVisibilityToken !== null || $readonlyToken !== null) { - $vars[$paramCount]['property_visibility'] = 'public'; - $vars[$paramCount]['visibility_token'] = false; - - if ($visibilityToken !== null) { - $vars[$paramCount]['property_visibility'] = $this->tokens[$visibilityToken]['content']; - $vars[$paramCount]['visibility_token'] = $visibilityToken; - } + if ($setVisibilityToken !== null) { + $vars[$paramCount]['set_visibility'] = $this->tokens[$setVisibilityToken]['content']; + $vars[$paramCount]['set_visibility_token'] = $setVisibilityToken; + } - if ($setVisibilityToken !== null) { - $vars[$paramCount]['set_visibility'] = $this->tokens[$setVisibilityToken]['content']; - $vars[$paramCount]['set_visibility_token'] = $setVisibilityToken; + $vars[$paramCount]['property_readonly'] = false; + if ($readonlyToken !== null) { + $vars[$paramCount]['property_readonly'] = true; + $vars[$paramCount]['readonly_token'] = $readonlyToken; + } } - $vars[$paramCount]['property_readonly'] = false; - if ($readonlyToken !== null) { - $vars[$paramCount]['property_readonly'] = true; - $vars[$paramCount]['readonly_token'] = $readonlyToken; + if ($this->tokens[$i]['code'] === T_COMMA) { + $vars[$paramCount]['comma_token'] = $i; + } else { + $vars[$paramCount]['comma_token'] = false; } - } - - if ($this->tokens[$i]['code'] === T_COMMA) { - $vars[$paramCount]['comma_token'] = $i; - } else { - $vars[$paramCount]['comma_token'] = false; - } - // Reset the vars, as we are about to process the next parameter. - $currVar = null; - $paramStart = ($i + 1); - $defaultStart = null; - $equalToken = null; - $hasAttributes = false; - $passByReference = false; - $referenceToken = false; - $variableLength = false; - $variadicToken = false; - $typeHint = ''; - $typeHintToken = false; - $typeHintEndToken = false; - $nullableType = false; - $visibilityToken = null; - $setVisibilityToken = null; - $readonlyToken = null; - - $paramCount++; - break; - case T_EQUAL: - $defaultStart = $this->findNext(Tokens::EMPTY_TOKENS, ($i + 1), null, true); - $equalToken = $i; - break; + // Reset the vars, as we are about to process the next parameter. + $currVar = null; + $paramStart = ($i + 1); + $defaultStart = null; + $equalToken = null; + $hasAttributes = false; + $passByReference = false; + $referenceToken = false; + $variableLength = false; + $variadicToken = false; + $typeHint = ''; + $typeHintToken = false; + $typeHintEndToken = false; + $nullableType = false; + $visibilityToken = null; + $setVisibilityToken = null; + $readonlyToken = null; + + $paramCount++; + break; + case T_EQUAL: + $defaultStart = $this->findNext(Tokens::EMPTY_TOKENS, ($i + 1), null, true); + $equalToken = $i; + break; } } @@ -1728,27 +1728,27 @@ public function getMethodProperties(int $stackPtr) } switch ($this->tokens[$i]['code']) { - case T_PUBLIC: - $scope = 'public'; - $scopeSpecified = true; - break; - case T_PRIVATE: - $scope = 'private'; - $scopeSpecified = true; - break; - case T_PROTECTED: - $scope = 'protected'; - $scopeSpecified = true; - break; - case T_ABSTRACT: - $isAbstract = true; - break; - case T_FINAL: - $isFinal = true; - break; - case T_STATIC: - $isStatic = true; - break; + case T_PUBLIC: + $scope = 'public'; + $scopeSpecified = true; + break; + case T_PRIVATE: + $scope = 'private'; + $scopeSpecified = true; + break; + case T_PROTECTED: + $scope = 'protected'; + $scopeSpecified = true; + break; + case T_ABSTRACT: + $isAbstract = true; + break; + case T_FINAL: + $isFinal = true; + break; + case T_STATIC: + $isStatic = true; + break; } } @@ -1942,39 +1942,39 @@ public function getMemberProperties(int $stackPtr) } switch ($this->tokens[$i]['code']) { - case T_PUBLIC: - $scope = 'public'; - $scopeSpecified = true; - break; - case T_PRIVATE: - $scope = 'private'; - $scopeSpecified = true; - break; - case T_PROTECTED: - $scope = 'protected'; - $scopeSpecified = true; - break; - case T_PUBLIC_SET: - $setScope = 'public'; - break; - case T_PROTECTED_SET: - $setScope = 'protected'; - break; - case T_PRIVATE_SET: - $setScope = 'private'; - break; - case T_STATIC: - $isStatic = true; - break; - case T_READONLY: - $isReadonly = true; - break; - case T_FINAL: - $isFinal = true; - break; - case T_ABSTRACT: - $isAbstract = true; - break; + case T_PUBLIC: + $scope = 'public'; + $scopeSpecified = true; + break; + case T_PRIVATE: + $scope = 'private'; + $scopeSpecified = true; + break; + case T_PROTECTED: + $scope = 'protected'; + $scopeSpecified = true; + break; + case T_PUBLIC_SET: + $setScope = 'public'; + break; + case T_PROTECTED_SET: + $setScope = 'protected'; + break; + case T_PRIVATE_SET: + $setScope = 'private'; + break; + case T_STATIC: + $isStatic = true; + break; + case T_READONLY: + $isReadonly = true; + break; + case T_FINAL: + $isFinal = true; + break; + case T_ABSTRACT: + $isAbstract = true; + break; } } @@ -2083,17 +2083,17 @@ public function getClassProperties(int $stackPtr) } switch ($this->tokens[$i]['code']) { - case T_ABSTRACT: - $isAbstract = true; - break; + case T_ABSTRACT: + $isAbstract = true; + break; - case T_FINAL: - $isFinal = true; - break; + case T_FINAL: + $isFinal = true; + break; - case T_READONLY: - $isReadonly = true; - break; + case T_READONLY: + $isReadonly = true; + break; } } diff --git a/src/Fixer.php b/src/Fixer.php index 066cf51340..5caa211259 100644 --- a/src/Fixer.php +++ b/src/Fixer.php @@ -319,14 +319,14 @@ public function generateDiff(?string $filePath = null, bool $colors = true) foreach ($diffLines as $line) { if (isset($line[0]) === true) { switch ($line[0]) { - case '-': - $diff[] = "\033[31m$line\033[0m"; - break; - case '+': - $diff[] = "\033[32m$line\033[0m"; - break; - default: - $diff[] = $line; + case '-': + $diff[] = "\033[31m$line\033[0m"; + break; + case '+': + $diff[] = "\033[32m$line\033[0m"; + break; + default: + $diff[] = $line; } } } diff --git a/src/Reports/VersionControl.php b/src/Reports/VersionControl.php index 2abd9d0861..c112900345 100644 --- a/src/Reports/VersionControl.php +++ b/src/Reports/VersionControl.php @@ -177,40 +177,40 @@ public function generate( foreach ($lines as $line) { $parts = explode('>>', $line); switch ($parts[0]) { - case 'AUTHOR': - if (isset($authorCache[$parts[1]]) === false) { - $authorCache[$parts[1]] = $parts[2]; - } else { - $authorCache[$parts[1]] += $parts[2]; - } - break; - case 'PRAISE': - if (isset($praiseCache[$parts[1]]) === false) { - $praiseCache[$parts[1]] = [ - 'good' => $parts[2], - 'bad' => $parts[3], - ]; - } else { - $praiseCache[$parts[1]]['good'] += $parts[2]; - $praiseCache[$parts[1]]['bad'] += $parts[3]; - } - break; - case 'SOURCE': - if (isset($praiseCache[$parts[1]]) === false) { - $praiseCache[$parts[1]] = []; - } + case 'AUTHOR': + if (isset($authorCache[$parts[1]]) === false) { + $authorCache[$parts[1]] = $parts[2]; + } else { + $authorCache[$parts[1]] += $parts[2]; + } + break; + case 'PRAISE': + if (isset($praiseCache[$parts[1]]) === false) { + $praiseCache[$parts[1]] = [ + 'good' => $parts[2], + 'bad' => $parts[3], + ]; + } else { + $praiseCache[$parts[1]]['good'] += $parts[2]; + $praiseCache[$parts[1]]['bad'] += $parts[3]; + } + break; + case 'SOURCE': + if (isset($praiseCache[$parts[1]]) === false) { + $praiseCache[$parts[1]] = []; + } - if (isset($sourceCache[$parts[1]][$parts[2]]) === false) { - $sourceCache[$parts[1]][$parts[2]] = [ - 'count' => $parts[3], - 'fixable' => (bool) $parts[4], - ]; - } else { - $sourceCache[$parts[1]][$parts[2]]['count'] += $parts[3]; - } - break; - default: - break; + if (isset($sourceCache[$parts[1]][$parts[2]]) === false) { + $sourceCache[$parts[1]][$parts[2]] = [ + 'count' => $parts[3], + 'fixable' => (bool) $parts[4], + ]; + } else { + $sourceCache[$parts[1]][$parts[2]]['count'] += $parts[3]; + } + break; + default: + break; } } diff --git a/src/Runner.php b/src/Runner.php index 3181076831..04605344f4 100644 --- a/src/Runner.php +++ b/src/Runner.php @@ -647,20 +647,20 @@ public function processFile(File $file) $input = trim($input); switch ($input) { - case 's': - break(2); - case 'q': - // User request to "quit": exit code should be 0. - throw new DeepExitException('', ExitCode::OKAY); - default: - // Repopulate the sniffs because some of them save their state - // and only clear it when the file changes, but we are rechecking - // the same file. - $file->ruleset->populateTokenListeners(); - $file->reloadContent(); - $file->process(); - $this->reporter->cacheFileReport($file); - break; + case 's': + break(2); + case 'q': + // User request to "quit": exit code should be 0. + throw new DeepExitException('', ExitCode::OKAY); + default: + // Repopulate the sniffs because some of them save their state + // and only clear it when the file changes, but we are rechecking + // the same file. + $file->ruleset->populateTokenListeners(); + $file->reloadContent(); + $file->process(); + $this->reporter->cacheFileReport($file); + break; } } } diff --git a/src/Sniffs/AbstractPatternSniff.php b/src/Sniffs/AbstractPatternSniff.php index b972e99362..e41726b8ef 100644 --- a/src/Sniffs/AbstractPatternSniff.php +++ b/src/Sniffs/AbstractPatternSniff.php @@ -853,26 +853,26 @@ private function createSkipPattern(string $pattern, int $from) $nestedBraces = 0; for ($start = $from; $start >= 0; $start--) { switch ($pattern[$start]) { - case '(': - if ($nestedParenthesis === 0) { - $skip['to'] = 'parenthesis_closer'; - } + case '(': + if ($nestedParenthesis === 0) { + $skip['to'] = 'parenthesis_closer'; + } - $nestedParenthesis--; - break; - case '{': - if ($nestedBraces === 0) { - $skip['to'] = 'scope_closer'; - } + $nestedParenthesis--; + break; + case '{': + if ($nestedBraces === 0) { + $skip['to'] = 'scope_closer'; + } - $nestedBraces--; - break; - case '}': - $nestedBraces++; - break; - case ')': - $nestedParenthesis++; - break; + $nestedBraces--; + break; + case '}': + $nestedBraces++; + break; + case ')': + $nestedParenthesis++; + break; } if (isset($skip['to']) === true) { diff --git a/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php b/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php index 59ce71cf18..3ed2ceca36 100644 --- a/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php +++ b/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php @@ -86,18 +86,18 @@ public function process(File $phpcsFile, int $stackPtr) if ($fix === true) { $tokens = $phpcsFile->getTokens(); switch ($this->eolChar) { - case '\n': - $eolChar = "\n"; - break; - case '\r': - $eolChar = "\r"; - break; - case '\r\n': - $eolChar = "\r\n"; - break; - default: - $eolChar = $this->eolChar; - break; + case '\n': + $eolChar = "\n"; + break; + case '\r': + $eolChar = "\r"; + break; + case '\r\n': + $eolChar = "\r\n"; + break; + default: + $eolChar = $this->eolChar; + break; } for ($i = 0; $i < $phpcsFile->numTokens; $i++) { diff --git a/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php b/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php index 54c2696203..fe1948f10c 100644 --- a/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php +++ b/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php @@ -62,62 +62,62 @@ public function process(File $phpcsFile, int $stackPtr) } switch ($tokens[$i]['code']) { - // Check for first non-comment, non-heredoc/nowdoc, non-inline HTML merge conflict opener. - case T_SL: - if (isset($tokens[($i + 1)], $tokens[($i + 2)]) !== false - && $tokens[($i + 1)]['code'] === T_SL - && $tokens[($i + 2)]['code'] === T_STRING - && trim($tokens[($i + 2)]['content']) === '<<< HEAD' - ) { - $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); - $i += 2; - } - break; - - // Check for merge conflict closer which was opened in a heredoc/nowdoc. - case T_SR: - if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)], $tokens[($i + 4)]) !== false - && $tokens[($i + 1)]['code'] === T_SR - && $tokens[($i + 2)]['code'] === T_SR - && $tokens[($i + 3)]['code'] === T_GREATER_THAN - && $tokens[($i + 4)]['code'] === T_WHITESPACE - && $tokens[($i + 4)]['content'] === ' ' - ) { - $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); - $i += 4; - } - break; - - // - Check for delimiters and closers. - // - Inspect heredoc/nowdoc content, comments and inline HTML. - // - Check for subsequent merge conflict openers after the first broke the tokenizer. - case T_ENCAPSED_AND_WHITESPACE: - case T_COMMENT: - case T_DOC_COMMENT_STRING: - case T_INLINE_HTML: - case T_HEREDOC: - case T_NOWDOC: - if (substr($tokens[$i]['content'], 0, 12) === '<<<<<<< HEAD') { - $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); - break; - } elseif (substr($tokens[$i]['content'], 0, 8) === '>>>>>>> ') { - $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); + // Check for first non-comment, non-heredoc/nowdoc, non-inline HTML merge conflict opener. + case T_SL: + if (isset($tokens[($i + 1)], $tokens[($i + 2)]) !== false + && $tokens[($i + 1)]['code'] === T_SL + && $tokens[($i + 2)]['code'] === T_STRING + && trim($tokens[($i + 2)]['content']) === '<<< HEAD' + ) { + $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); + $i += 2; + } break; - } - if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING) { - if ($tokens[$i]['content'] === '=======' - && $tokens[($i + 1)]['code'] === T_DOC_COMMENT_WHITESPACE + // Check for merge conflict closer which was opened in a heredoc/nowdoc. + case T_SR: + if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)], $tokens[($i + 4)]) !== false + && $tokens[($i + 1)]['code'] === T_SR + && $tokens[($i + 2)]['code'] === T_SR + && $tokens[($i + 3)]['code'] === T_GREATER_THAN + && $tokens[($i + 4)]['code'] === T_WHITESPACE + && $tokens[($i + 4)]['content'] === ' ' ) { - $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); + $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); + $i += 4; + } + break; + + // - Check for delimiters and closers. + // - Inspect heredoc/nowdoc content, comments and inline HTML. + // - Check for subsequent merge conflict openers after the first broke the tokenizer. + case T_ENCAPSED_AND_WHITESPACE: + case T_COMMENT: + case T_DOC_COMMENT_STRING: + case T_INLINE_HTML: + case T_HEREDOC: + case T_NOWDOC: + if (substr($tokens[$i]['content'], 0, 12) === '<<<<<<< HEAD') { + $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); + break; + } elseif (substr($tokens[$i]['content'], 0, 8) === '>>>>>>> ') { + $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); break; } - } else { - if ($tokens[$i]['content'] === "=======\n") { - $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); + + if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING) { + if ($tokens[$i]['content'] === '=======' + && $tokens[($i + 1)]['code'] === T_DOC_COMMENT_WHITESPACE + ) { + $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); + break; + } + } else { + if ($tokens[$i]['content'] === "=======\n") { + $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); + } } - } - break; + break; } } diff --git a/src/Standards/Generic/Tests/Arrays/DisallowLongArraySyntaxUnitTest.php b/src/Standards/Generic/Tests/Arrays/DisallowLongArraySyntaxUnitTest.php index 43d94df70f..6a61a33e2a 100644 --- a/src/Standards/Generic/Tests/Arrays/DisallowLongArraySyntaxUnitTest.php +++ b/src/Standards/Generic/Tests/Arrays/DisallowLongArraySyntaxUnitTest.php @@ -33,25 +33,25 @@ final class DisallowLongArraySyntaxUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'DisallowLongArraySyntaxUnitTest.1.inc': - return [ - 2 => 1, - 4 => 1, - 6 => 1, - 7 => 1, - 12 => 1, - ]; - case 'DisallowLongArraySyntaxUnitTest.2.inc': - return [ - 2 => 1, - 9 => 1, - ]; - case 'DisallowLongArraySyntaxUnitTest.3.inc': - return [ - 7 => 1, - ]; - default: - return []; + case 'DisallowLongArraySyntaxUnitTest.1.inc': + return [ + 2 => 1, + 4 => 1, + 6 => 1, + 7 => 1, + 12 => 1, + ]; + case 'DisallowLongArraySyntaxUnitTest.2.inc': + return [ + 2 => 1, + 9 => 1, + ]; + case 'DisallowLongArraySyntaxUnitTest.3.inc': + return [ + 7 => 1, + ]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.php b/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.php index eda1359cc7..d103b8a19c 100644 --- a/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.php +++ b/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.php @@ -47,48 +47,48 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'DuplicateClassNameUnitTest.1.inc': - return [ - 10 => 1, - 11 => 1, - 12 => 1, - 13 => 1, - ]; + case 'DuplicateClassNameUnitTest.1.inc': + return [ + 10 => 1, + 11 => 1, + 12 => 1, + 13 => 1, + ]; - case 'DuplicateClassNameUnitTest.2.inc': - return [ - 2 => 1, - 3 => 1, - 4 => 1, - 5 => 1, - ]; + case 'DuplicateClassNameUnitTest.2.inc': + return [ + 2 => 1, + 3 => 1, + 4 => 1, + 5 => 1, + ]; - case 'DuplicateClassNameUnitTest.5.inc': - return [ - 3 => 1, - 7 => 1, - ]; + case 'DuplicateClassNameUnitTest.5.inc': + return [ + 3 => 1, + 7 => 1, + ]; - case 'DuplicateClassNameUnitTest.6.inc': - return [10 => 1]; + case 'DuplicateClassNameUnitTest.6.inc': + return [10 => 1]; - case 'DuplicateClassNameUnitTest.8.inc': - return [ - 7 => 1, - 8 => 1, - ]; + case 'DuplicateClassNameUnitTest.8.inc': + return [ + 7 => 1, + 8 => 1, + ]; - case 'DuplicateClassNameUnitTest.9.inc': - return [ - 3 => 1, - 4 => 1, - ]; + case 'DuplicateClassNameUnitTest.9.inc': + return [ + 3 => 1, + 4 => 1, + ]; - case 'DuplicateClassNameUnitTest.11.inc': - return [13 => 1]; + case 'DuplicateClassNameUnitTest.11.inc': + return [13 => 1]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.php index e40fed1771..05cece210f 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.php @@ -47,46 +47,46 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'AssignmentInConditionUnitTest.1.inc': - return [ - 46 => 1, - 47 => 1, - 48 => 1, - 49 => 1, - 50 => 1, - 51 => 1, - 52 => 1, - 53 => 1, - 54 => 1, - 55 => 1, - 56 => 1, - 57 => 1, - 58 => 1, - 59 => 1, - 60 => 1, - 61 => 2, - 63 => 1, - 64 => 1, - 67 => 1, - 68 => 1, - 69 => 1, - 70 => 1, - 71 => 1, - 72 => 1, - 73 => 1, - 75 => 1, - 77 => 1, - 80 => 2, - 84 => 1, - 85 => 2, - 88 => 1, - 90 => 1, - 92 => 1, - 95 => 1, - ]; + case 'AssignmentInConditionUnitTest.1.inc': + return [ + 46 => 1, + 47 => 1, + 48 => 1, + 49 => 1, + 50 => 1, + 51 => 1, + 52 => 1, + 53 => 1, + 54 => 1, + 55 => 1, + 56 => 1, + 57 => 1, + 58 => 1, + 59 => 1, + 60 => 1, + 61 => 2, + 63 => 1, + 64 => 1, + 67 => 1, + 68 => 1, + 69 => 1, + 70 => 1, + 71 => 1, + 72 => 1, + 73 => 1, + 75 => 1, + 77 => 1, + 80 => 2, + 84 => 1, + 85 => 2, + 88 => 1, + 90 => 1, + 92 => 1, + 95 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.php index 4eadc75b62..fa4c995811 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/EmptyPHPStatementUnitTest.php @@ -67,40 +67,40 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'EmptyPHPStatementUnitTest.1.inc': - return [ - 9 => 1, - 12 => 1, - 15 => 1, - 18 => 1, - 21 => 1, - 22 => 2, - 31 => 1, - 33 => 1, - 43 => 1, - 45 => 2, - 49 => 1, - 50 => 1, - 57 => 1, - 59 => 1, - 61 => 1, - 63 => 2, - 71 => 1, - 72 => 1, - 80 => 1, - ]; - case 'EmptyPHPStatementUnitTest.2.inc': - return [ - 2 => 1, - 3 => 1, - 4 => 1, - 13 => 1, - 15 => 1, - 25 => 1, - 27 => 1, - ]; - default: - return []; + case 'EmptyPHPStatementUnitTest.1.inc': + return [ + 9 => 1, + 12 => 1, + 15 => 1, + 18 => 1, + 21 => 1, + 22 => 2, + 31 => 1, + 33 => 1, + 43 => 1, + 45 => 2, + 49 => 1, + 50 => 1, + 57 => 1, + 59 => 1, + 61 => 1, + 63 => 2, + 71 => 1, + 72 => 1, + 80 => 1, + ]; + case 'EmptyPHPStatementUnitTest.2.inc': + return [ + 2 => 1, + 3 => 1, + 4 => 1, + 13 => 1, + 15 => 1, + 25 => 1, + 27 => 1, + ]; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.php index e36a993e08..6993f1d3d6 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.php @@ -47,14 +47,14 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'ForLoopShouldBeWhileLoopUnitTest.1.inc': - return [ - 6 => 1, - 10 => 1, - 34 => 1, - ]; - default: - return []; + case 'ForLoopShouldBeWhileLoopUnitTest.1.inc': + return [ + 6 => 1, + 10 => 1, + 34 => 1, + ]; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.php index 355ae172b2..846838176e 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.php @@ -47,28 +47,28 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'ForLoopWithTestFunctionCallUnitTest.1.inc': - return [ - 4 => 1, - 13 => 1, - 17 => 1, - 21 => 1, - 26 => 1, - 35 => 1, - 39 => 1, - 43 => 1, - 47 => 1, - 52 => 1, - 58 => 1, - 66 => 1, - 72 => 1, - 81 => 1, - 97 => 1, - 98 => 1, - 99 => 1, - ]; - default: - return []; + case 'ForLoopWithTestFunctionCallUnitTest.1.inc': + return [ + 4 => 1, + 13 => 1, + 17 => 1, + 21 => 1, + 26 => 1, + 35 => 1, + 39 => 1, + 43 => 1, + 47 => 1, + 52 => 1, + 58 => 1, + 66 => 1, + 72 => 1, + 81 => 1, + 97 => 1, + 98 => 1, + 99 => 1, + ]; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.php index 9f40ded175..182e3e59d8 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.php @@ -47,22 +47,22 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'JumbledIncrementerUnitTest.1.inc': - return [ - 3 => 2, - 4 => 1, - 20 => 1, - 40 => 2, - 41 => 1, - 58 => 1, - 69 => 1, - 79 => 2, - 80 => 1, - 87 => 1, - ]; + case 'JumbledIncrementerUnitTest.1.inc': + return [ + 3 => 2, + 4 => 1, + 20 => 1, + 40 => 2, + 41 => 1, + 58 => 1, + 69 => 1, + 79 => 2, + 80 => 1, + 87 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.php index 5c6b234d0c..24aa54ba71 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.php @@ -47,17 +47,17 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'UnconditionalIfStatementUnitTest.1.inc': - return [ - 3 => 1, - 5 => 1, - 7 => 1, - 16 => 1, - 17 => 1, - ]; - - default: - return []; + case 'UnconditionalIfStatementUnitTest.1.inc': + return [ + 3 => 1, + 5 => 1, + 7 => 1, + 16 => 1, + 17 => 1, + ]; + + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.php index 10b127ce8b..c5ae8d2a3e 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.php @@ -47,21 +47,21 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'UnnecessaryFinalModifierUnitTest.1.inc': - return [ - 11 => 1, - 12 => 1, - 15 => 1, - 18 => 1, - 32 => 1, - 33 => 1, - 37 => 1, - 38 => 1, - 59 => 1, - 60 => 1, - ]; - default: - return []; + case 'UnnecessaryFinalModifierUnitTest.1.inc': + return [ + 11 => 1, + 12 => 1, + 15 => 1, + 18 => 1, + 32 => 1, + 33 => 1, + 37 => 1, + 38 => 1, + 59 => 1, + 60 => 1, + ]; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php index 9f5aa12592..e60e31bffd 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php @@ -47,28 +47,28 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'UnusedFunctionParameterUnitTest.1.inc': - return [ - 3 => 1, - 7 => 1, - 78 => 1, - 94 => 1, - 100 => 1, - 106 => 1, - 117 => 1, - 121 => 2, - 125 => 2, - 163 => 1, - 172 => 1, - 228 => 2, - 232 => 2, - 244 => 2, - 248 => 2, - 271 => 1, - ]; + case 'UnusedFunctionParameterUnitTest.1.inc': + return [ + 3 => 1, + 7 => 1, + 78 => 1, + 94 => 1, + 100 => 1, + 106 => 1, + 117 => 1, + 121 => 2, + 125 => 2, + 163 => 1, + 172 => 1, + 228 => 2, + 232 => 2, + 244 => 2, + 248 => 2, + 271 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.php index bac42c4bd0..17797f7f95 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.php @@ -47,22 +47,22 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'UselessOverridingMethodUnitTest.1.inc': - return [ - 4 => 1, - 16 => 1, - 38 => 1, - 56 => 1, - 68 => 1, - 72 => 1, - 93 => 1, - 116 => 1, - 134 => 1, - 146 => 1, - 153 => 1, - ]; - default: - return []; + case 'UselessOverridingMethodUnitTest.1.inc': + return [ + 4 => 1, + 16 => 1, + 38 => 1, + 56 => 1, + 68 => 1, + 72 => 1, + 93 => 1, + 116 => 1, + 134 => 1, + 146 => 1, + 153 => 1, + ]; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.php b/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.php index d1aaf74c0e..ee35c2deb3 100644 --- a/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.php +++ b/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.php @@ -48,61 +48,61 @@ public function setCliValues(string $testFile, Config $config) public function getErrorList($testFile = '') { switch ($testFile) { - case 'DocCommentUnitTest.1.inc': - return [ - 14 => 1, - 16 => 1, - 18 => 1, - 23 => 1, - 26 => 1, - 30 => 1, - 32 => 1, - 38 => 2, - 40 => 1, - 41 => 1, - 51 => 1, - 54 => 1, - 58 => 1, - 60 => 2, - 67 => 1, - 69 => 2, - 80 => 1, - 81 => 2, - 88 => 1, - 91 => 1, - 95 => 1, - 156 => 1, - 158 => 1, - 170 => 3, - 171 => 3, - 179 => 1, - 183 => 1, - 184 => 2, - 185 => 1, - 186 => 1, - 187 => 2, - 193 => 1, - 196 => 1, - 199 => 1, - 203 => 1, - 206 => 1, - 211 => 1, - 214 => 4, - 218 => 1, - 220 => 2, - 222 => 1, - 224 => 3, - 243 => 1, - 244 => 1, - 246 => 1, - 248 => 1, - 249 => 1, - 263 => 1, - 266 => 1, - ]; + case 'DocCommentUnitTest.1.inc': + return [ + 14 => 1, + 16 => 1, + 18 => 1, + 23 => 1, + 26 => 1, + 30 => 1, + 32 => 1, + 38 => 2, + 40 => 1, + 41 => 1, + 51 => 1, + 54 => 1, + 58 => 1, + 60 => 2, + 67 => 1, + 69 => 2, + 80 => 1, + 81 => 2, + 88 => 1, + 91 => 1, + 95 => 1, + 156 => 1, + 158 => 1, + 170 => 3, + 171 => 3, + 179 => 1, + 183 => 1, + 184 => 2, + 185 => 1, + 186 => 1, + 187 => 2, + 193 => 1, + 196 => 1, + 199 => 1, + 203 => 1, + 206 => 1, + 211 => 1, + 214 => 4, + 218 => 1, + 220 => 2, + 222 => 1, + 224 => 3, + 243 => 1, + 244 => 1, + 246 => 1, + 248 => 1, + 249 => 1, + 263 => 1, + 266 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.php b/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.php index 202072f7e1..37ab05ba56 100644 --- a/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.php +++ b/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.php @@ -33,59 +33,59 @@ final class InlineControlStructureUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'InlineControlStructureUnitTest.1.inc': - return [ - 3 => 1, - 7 => 1, - 11 => 1, - 13 => 1, - 15 => 1, - 17 => 1, - 23 => 1, - 45 => 1, - 46 => 1, - 49 => 1, - 62 => 1, - 66 => 1, - 78 => 1, - 109 => 1, - 120 => 1, - 128 => 1, - 134 => 1, - 142 => 1, - 143 => 1, - 144 => 1, - 150 => 1, - 158 => 1, - 159 => 1, - 162 => 1, - 163 => 1, - 164 => 1, - 167 => 1, - 168 => 1, - 170 => 1, - 178 => 1, - 185 => 1, - 188 => 2, - 191 => 1, - 195 => 1, - 198 => 1, - 204 => 1, - 205 => 1, - 222 => 1, - 232 => 1, - 235 => 1, - 236 => 1, - 238 => 1, - 242 => 1, - 260 => 1, - 269 => 1, - 278 => 1, - 289 => 1, - ]; + case 'InlineControlStructureUnitTest.1.inc': + return [ + 3 => 1, + 7 => 1, + 11 => 1, + 13 => 1, + 15 => 1, + 17 => 1, + 23 => 1, + 45 => 1, + 46 => 1, + 49 => 1, + 62 => 1, + 66 => 1, + 78 => 1, + 109 => 1, + 120 => 1, + 128 => 1, + 134 => 1, + 142 => 1, + 143 => 1, + 144 => 1, + 150 => 1, + 158 => 1, + 159 => 1, + 162 => 1, + 163 => 1, + 164 => 1, + 167 => 1, + 168 => 1, + 170 => 1, + 178 => 1, + 185 => 1, + 188 => 2, + 191 => 1, + 195 => 1, + 198 => 1, + 204 => 1, + 205 => 1, + 222 => 1, + 232 => 1, + 235 => 1, + 236 => 1, + 238 => 1, + 242 => 1, + 260 => 1, + 269 => 1, + 278 => 1, + 289 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.php b/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.php index c1059fd087..b6414f35d7 100644 --- a/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.php +++ b/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.php @@ -33,13 +33,13 @@ final class ByteOrderMarkUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ByteOrderMarkUnitTest.1.inc': - case 'ByteOrderMarkUnitTest.4.inc': - case 'ByteOrderMarkUnitTest.5.inc': - return [1 => 1]; + case 'ByteOrderMarkUnitTest.1.inc': + case 'ByteOrderMarkUnitTest.4.inc': + case 'ByteOrderMarkUnitTest.5.inc': + return [1 => 1]; - default: - return []; + default: + return []; } } @@ -57,17 +57,17 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'ByteOrderMarkUnitTest.3.inc': - case 'ByteOrderMarkUnitTest.4.inc': - case 'ByteOrderMarkUnitTest.5.inc': - if ((bool) ini_get('short_open_tag') === false) { - // Warning about "no code found in file". - return [1 => 1]; - } - return []; + case 'ByteOrderMarkUnitTest.3.inc': + case 'ByteOrderMarkUnitTest.4.inc': + case 'ByteOrderMarkUnitTest.5.inc': + if ((bool) ini_get('short_open_tag') === false) { + // Warning about "no code found in file". + return [1 => 1]; + } + return []; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.php b/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.php index c1b0523292..b26beb2878 100644 --- a/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.php +++ b/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.php @@ -33,14 +33,14 @@ final class EndFileNewlineUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'EndFileNewlineUnitTest.3.inc': - case 'EndFileNewlineUnitTest.4.inc': - return [2 => 1]; - case 'EndFileNewlineUnitTest.6.inc': - case 'EndFileNewlineUnitTest.7.inc': - return [1 => 1]; - default: - return []; + case 'EndFileNewlineUnitTest.3.inc': + case 'EndFileNewlineUnitTest.4.inc': + return [2 => 1]; + case 'EndFileNewlineUnitTest.6.inc': + case 'EndFileNewlineUnitTest.7.inc': + return [1 => 1]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.php b/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.php index 0ad8a04e6a..bb7e021835 100644 --- a/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.php +++ b/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.php @@ -33,16 +33,16 @@ final class EndFileNoNewlineUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'EndFileNoNewlineUnitTest.1.inc': - case 'EndFileNoNewlineUnitTest.2.inc': - return [3 => 1]; - case 'EndFileNoNewlineUnitTest.6.inc': - return [2 => 1]; - case 'EndFileNoNewlineUnitTest.8.inc': - case 'EndFileNoNewlineUnitTest.9.inc': - return [1 => 1]; - default: - return []; + case 'EndFileNoNewlineUnitTest.1.inc': + case 'EndFileNoNewlineUnitTest.2.inc': + return [3 => 1]; + case 'EndFileNoNewlineUnitTest.6.inc': + return [2 => 1]; + case 'EndFileNoNewlineUnitTest.8.inc': + case 'EndFileNoNewlineUnitTest.9.inc': + return [1 => 1]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Files/ExecutableFileUnitTest.php b/src/Standards/Generic/Tests/Files/ExecutableFileUnitTest.php index 2295a90d5b..9c32d502e9 100644 --- a/src/Standards/Generic/Tests/Files/ExecutableFileUnitTest.php +++ b/src/Standards/Generic/Tests/Files/ExecutableFileUnitTest.php @@ -45,11 +45,11 @@ protected function shouldSkipTest() public function getErrorList($testFile = '') { switch ($testFile) { - case 'ExecutableFileUnitTest.2.inc': - case 'ExecutableFileUnitTest.4.inc': - return [1 => 1]; - default: - return []; + case 'ExecutableFileUnitTest.2.inc': + case 'ExecutableFileUnitTest.4.inc': + return [1 => 1]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.php b/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.php index c73ecf22a0..c468adf409 100644 --- a/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.php +++ b/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.php @@ -33,17 +33,17 @@ final class InlineHTMLUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'InlineHTMLUnitTest.3.inc': - return [4 => 1]; + case 'InlineHTMLUnitTest.3.inc': + return [4 => 1]; - case 'InlineHTMLUnitTest.4.inc': - return [1 => 1]; + case 'InlineHTMLUnitTest.4.inc': + return [1 => 1]; - case 'InlineHTMLUnitTest.7.inc': - return [1 => 1]; + case 'InlineHTMLUnitTest.7.inc': + return [1 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Files/LineLengthUnitTest.php b/src/Standards/Generic/Tests/Files/LineLengthUnitTest.php index aceb710ef8..4daf274d47 100644 --- a/src/Standards/Generic/Tests/Files/LineLengthUnitTest.php +++ b/src/Standards/Generic/Tests/Files/LineLengthUnitTest.php @@ -48,20 +48,20 @@ public function setCliValues(string $testFile, Config $config) public function getErrorList($testFile = '') { switch ($testFile) { - case 'LineLengthUnitTest.1.inc': - return [ - 31 => 1, - 34 => 1, - 45 => 1, - 82 => 1, - ]; + case 'LineLengthUnitTest.1.inc': + return [ + 31 => 1, + 34 => 1, + 45 => 1, + 82 => 1, + ]; - case 'LineLengthUnitTest.2.inc': - case 'LineLengthUnitTest.3.inc': - return [7 => 1]; + case 'LineLengthUnitTest.2.inc': + case 'LineLengthUnitTest.3.inc': + return [7 => 1]; - default: - return []; + default: + return []; } } @@ -79,32 +79,32 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'LineLengthUnitTest.1.inc': - return [ - 9 => 1, - 15 => 1, - 21 => 1, - 24 => 1, - 29 => 1, - 37 => 1, - 63 => 1, - 73 => 1, - 75 => 1, - 84 => 1, - ]; + case 'LineLengthUnitTest.1.inc': + return [ + 9 => 1, + 15 => 1, + 21 => 1, + 24 => 1, + 29 => 1, + 37 => 1, + 63 => 1, + 73 => 1, + 75 => 1, + 84 => 1, + ]; - case 'LineLengthUnitTest.2.inc': - case 'LineLengthUnitTest.3.inc': - return [6 => 1]; + case 'LineLengthUnitTest.2.inc': + case 'LineLengthUnitTest.3.inc': + return [6 => 1]; - case 'LineLengthUnitTest.4.inc': - return [ - 10 => 1, - 14 => 1, - ]; + case 'LineLengthUnitTest.4.inc': + return [ + 10 => 1, + 14 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php b/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php index 0306fddb2b..9f252f9003 100644 --- a/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php +++ b/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php @@ -53,11 +53,11 @@ protected function getTestFiles(string $testFileBase) public function getErrorList($testFile = '') { switch ($testFile) { - case 'LowercasedFilenameUnitTest.1.inc': - case 'LowercasedFilenameUnitTest.2.inc': - return [1 => 1]; - default: - return []; + case 'LowercasedFilenameUnitTest.1.inc': + case 'LowercasedFilenameUnitTest.2.inc': + return [1 => 1]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.php b/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.php index 1f19a20f7a..6816666ddb 100644 --- a/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.php +++ b/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.php @@ -33,53 +33,53 @@ final class SpaceAfterCastUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'SpaceAfterCastUnitTest.1.inc': - return [ - 4 => 1, - 5 => 1, - 8 => 1, - 9 => 1, - 12 => 1, - 13 => 1, - 16 => 1, - 17 => 1, - 20 => 1, - 21 => 1, - 24 => 1, - 25 => 1, - 28 => 1, - 29 => 1, - 32 => 1, - 33 => 1, - 36 => 1, - 37 => 1, - 40 => 1, - 41 => 1, - 44 => 1, - 45 => 1, - 51 => 1, - 53 => 1, - 55 => 1, - 58 => 1, - 64 => 1, - 72 => 1, - 73 => 1, - 75 => 1, - 76 => 1, - 78 => 1, - 82 => 1, - 84 => 1, - 85 => 1, - 86 => 1, - 88 => 1, - 93 => 1, - 97 => 1, - 99 => 1, - 100 => 1, - ]; + case 'SpaceAfterCastUnitTest.1.inc': + return [ + 4 => 1, + 5 => 1, + 8 => 1, + 9 => 1, + 12 => 1, + 13 => 1, + 16 => 1, + 17 => 1, + 20 => 1, + 21 => 1, + 24 => 1, + 25 => 1, + 28 => 1, + 29 => 1, + 32 => 1, + 33 => 1, + 36 => 1, + 37 => 1, + 40 => 1, + 41 => 1, + 44 => 1, + 45 => 1, + 51 => 1, + 53 => 1, + 55 => 1, + 58 => 1, + 64 => 1, + 72 => 1, + 73 => 1, + 75 => 1, + 76 => 1, + 78 => 1, + 82 => 1, + 84 => 1, + 85 => 1, + 86 => 1, + 88 => 1, + 93 => 1, + 97 => 1, + 99 => 1, + 100 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.php b/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.php index 2545da6088..badf229d5c 100644 --- a/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.php +++ b/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.php @@ -33,39 +33,39 @@ final class SpaceAfterNotUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'SpaceAfterNotUnitTest.1.inc': - return [ - 3 => 2, - 4 => 2, - 5 => 2, - 6 => 1, - 7 => 1, - 8 => 1, - 11 => 1, - 14 => 1, - 17 => 1, - 20 => 1, - 28 => 1, - 38 => 2, - 39 => 2, - 40 => 1, - 41 => 1, - 42 => 1, - 48 => 1, - 51 => 1, - 56 => 2, - 57 => 1, - 58 => 1, - 59 => 1, - 62 => 1, - 65 => 1, - 68 => 1, - 71 => 1, - 79 => 1, - ]; + case 'SpaceAfterNotUnitTest.1.inc': + return [ + 3 => 2, + 4 => 2, + 5 => 2, + 6 => 1, + 7 => 1, + 8 => 1, + 11 => 1, + 14 => 1, + 17 => 1, + 20 => 1, + 28 => 1, + 38 => 2, + 39 => 2, + 40 => 1, + 41 => 1, + 42 => 1, + 48 => 1, + 51 => 1, + 56 => 2, + 57 => 1, + 58 => 1, + 59 => 1, + 62 => 1, + 65 => 1, + 68 => 1, + 71 => 1, + 79 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.php b/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.php index d81a1a0148..0226cf5a8a 100644 --- a/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.php +++ b/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.php @@ -33,49 +33,49 @@ final class FunctionCallArgumentSpacingUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FunctionCallArgumentSpacingUnitTest.1.inc': - return [ - 5 => 1, - 6 => 1, - 7 => 2, - 8 => 1, - 11 => 1, - 12 => 1, - 13 => 1, - 42 => 3, - 43 => 3, - 45 => 1, - 46 => 2, - 79 => 1, - 82 => 1, - 93 => 1, - 105 => 1, - 107 => 1, - 108 => 2, - 114 => 1, - 115 => 1, - 119 => 1, - 125 => 2, - 130 => 2, - 131 => 1, - 132 => 2, - 133 => 2, - 134 => 1, - 154 => 2, - 155 => 1, - 162 => 2, - 170 => 1, - 177 => 1, - 190 => 2, - 191 => 2, - 197 => 1, - 201 => 1, - 202 => 1, - 203 => 2, - ]; + case 'FunctionCallArgumentSpacingUnitTest.1.inc': + return [ + 5 => 1, + 6 => 1, + 7 => 2, + 8 => 1, + 11 => 1, + 12 => 1, + 13 => 1, + 42 => 3, + 43 => 3, + 45 => 1, + 46 => 2, + 79 => 1, + 82 => 1, + 93 => 1, + 105 => 1, + 107 => 1, + 108 => 2, + 114 => 1, + 115 => 1, + 119 => 1, + 125 => 2, + 130 => 2, + 131 => 1, + 132 => 2, + 133 => 2, + 134 => 1, + 154 => 2, + 155 => 1, + 162 => 2, + 170 => 1, + 177 => 1, + 190 => 2, + 191 => 2, + 197 => 1, + 201 => 1, + 202 => 1, + 203 => 2, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceKernighanRitchieUnitTest.php b/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceKernighanRitchieUnitTest.php index 3b99f3cb51..131904e5d3 100644 --- a/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceKernighanRitchieUnitTest.php +++ b/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceKernighanRitchieUnitTest.php @@ -50,49 +50,49 @@ public function setCliValues(string $testFile, Config $config) public function getErrorList($testFile = '') { switch ($testFile) { - case 'OpeningFunctionBraceKernighanRitchieUnitTest.1.inc': - return [ - 9 => 1, - 13 => 1, - 17 => 1, - 29 => 1, - 33 => 1, - 37 => 1, - 53 => 1, - 58 => 1, - 63 => 1, - 77 => 1, - 82 => 1, - 87 => 1, - 104 => 1, - 119 => 1, - 123 => 1, - 127 => 1, - 132 => 1, - 137 => 1, - 142 => 1, - 157 => 1, - 162 => 1, - 171 => 1, - 181 => 1, - 191 => 1, - 197 => 1, - 203 => 1, - 213 => 1, - 214 => 1, - 222 => 1, - 224 => 1, - 227 => 1, - ]; - case 'OpeningFunctionBraceKernighanRitchieUnitTest.2.inc': - return [ - 6 => 1, - 10 => 1, - 14 => 1, - 18 => 1, - ]; - default: - return []; + case 'OpeningFunctionBraceKernighanRitchieUnitTest.1.inc': + return [ + 9 => 1, + 13 => 1, + 17 => 1, + 29 => 1, + 33 => 1, + 37 => 1, + 53 => 1, + 58 => 1, + 63 => 1, + 77 => 1, + 82 => 1, + 87 => 1, + 104 => 1, + 119 => 1, + 123 => 1, + 127 => 1, + 132 => 1, + 137 => 1, + 142 => 1, + 157 => 1, + 162 => 1, + 171 => 1, + 181 => 1, + 191 => 1, + 197 => 1, + 203 => 1, + 213 => 1, + 214 => 1, + 222 => 1, + 224 => 1, + 227 => 1, + ]; + case 'OpeningFunctionBraceKernighanRitchieUnitTest.2.inc': + return [ + 6 => 1, + 10 => 1, + 14 => 1, + 18 => 1, + ]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.php b/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.php index db0453758b..f7527d0371 100644 --- a/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.php +++ b/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.php @@ -33,10 +33,10 @@ final class CyclomaticComplexityUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'CyclomaticComplexityUnitTest.1.inc': - return [118 => 1]; - default: - return []; + case 'CyclomaticComplexityUnitTest.1.inc': + return [118 => 1]; + default: + return []; } } @@ -54,20 +54,20 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'CyclomaticComplexityUnitTest.1.inc': - return [ - 45 => 1, - 72 => 1, - 189 => 1, - 237 => 1, - 285 => 1, - 333 => 1, - 381 => 1, - 417 => 1, - 445 => 1, - ]; - default: - return []; + case 'CyclomaticComplexityUnitTest.1.inc': + return [ + 45 => 1, + 72 => 1, + 189 => 1, + 237 => 1, + 285 => 1, + 333 => 1, + 381 => 1, + 417 => 1, + 445 => 1, + ]; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.php b/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.php index d02953a1b2..4726aa6856 100644 --- a/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.php +++ b/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.php @@ -33,10 +33,10 @@ final class NestingLevelUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'NestingLevelUnitTest.1.inc': - return [73 => 1]; - default: - return []; + case 'NestingLevelUnitTest.1.inc': + return [73 => 1]; + default: + return []; } } @@ -54,13 +54,13 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'NestingLevelUnitTest.1.inc': - return [ - 27 => 1, - 46 => 1, - ]; - default: - return []; + case 'NestingLevelUnitTest.1.inc': + return [ + 27 => 1, + 46 => 1, + ]; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/NamingConventions/AbstractClassNamePrefixUnitTest.php b/src/Standards/Generic/Tests/NamingConventions/AbstractClassNamePrefixUnitTest.php index af12b143c4..018cfaefc9 100644 --- a/src/Standards/Generic/Tests/NamingConventions/AbstractClassNamePrefixUnitTest.php +++ b/src/Standards/Generic/Tests/NamingConventions/AbstractClassNamePrefixUnitTest.php @@ -32,18 +32,18 @@ final class AbstractClassNamePrefixUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'AbstractClassNamePrefixUnitTest.1.inc': - return [ - 3 => 1, - 7 => 1, - 11 => 1, - 16 => 1, - 29 => 1, - 44 => 1, - 45 => 1, - ]; - default: - return []; + case 'AbstractClassNamePrefixUnitTest.1.inc': + return [ + 3 => 1, + 7 => 1, + 11 => 1, + 16 => 1, + 29 => 1, + 44 => 1, + 45 => 1, + ]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.php b/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.php index 5809f027d0..afe9bca40c 100644 --- a/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.php +++ b/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.php @@ -33,55 +33,55 @@ final class CamelCapsFunctionNameUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'CamelCapsFunctionNameUnitTest.1.inc': - return[ - 10 => 1, - 11 => 1, - 12 => 1, - 13 => 1, - 16 => 1, - 17 => 1, - 20 => 1, - 21 => 1, - 24 => 1, - 25 => 1, - 30 => 1, - 31 => 1, - 50 => 1, - 52 => 1, - 53 => 2, - 57 => 1, - 58 => 1, - 59 => 1, - 60 => 1, - 61 => 1, - 62 => 1, - 63 => 1, - 64 => 1, - 65 => 1, - 66 => 1, - 67 => 1, - 68 => 2, - 69 => 1, - 71 => 1, - 72 => 1, - 73 => 2, - 118 => 1, - 144 => 1, - 146 => 1, - 147 => 2, - 158 => 1, - 159 => 1, - 179 => 1, - 180 => 2, - 183 => 1, - 184 => 1, - 189 => 1, - 197 => 1, - 204 => 1, - ]; - default: - return []; + case 'CamelCapsFunctionNameUnitTest.1.inc': + return[ + 10 => 1, + 11 => 1, + 12 => 1, + 13 => 1, + 16 => 1, + 17 => 1, + 20 => 1, + 21 => 1, + 24 => 1, + 25 => 1, + 30 => 1, + 31 => 1, + 50 => 1, + 52 => 1, + 53 => 2, + 57 => 1, + 58 => 1, + 59 => 1, + 60 => 1, + 61 => 1, + 62 => 1, + 63 => 1, + 64 => 1, + 65 => 1, + 66 => 1, + 67 => 1, + 68 => 2, + 69 => 1, + 71 => 1, + 72 => 1, + 73 => 2, + 118 => 1, + 144 => 1, + 146 => 1, + 147 => 2, + 158 => 1, + 159 => 1, + 179 => 1, + 180 => 2, + 183 => 1, + 184 => 1, + 189 => 1, + 197 => 1, + 204 => 1, + ]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.php b/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.php index 627c21cb14..34f7f26f1a 100644 --- a/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.php +++ b/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.php @@ -33,23 +33,23 @@ final class ConstructorNameUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ConstructorNameUnitTest.1.inc': - return [ - 6 => 1, - 11 => 1, - 47 => 1, - 62 => 1, - 91 => 1, - 103 => 1, - 104 => 1, - 112 => 1, - 120 => 1, - 121 => 1, - 126 => 1, - 127 => 1, - ]; - default: - return []; + case 'ConstructorNameUnitTest.1.inc': + return [ + 6 => 1, + 11 => 1, + 47 => 1, + 62 => 1, + 91 => 1, + 103 => 1, + 104 => 1, + 112 => 1, + 120 => 1, + 121 => 1, + 126 => 1, + 127 => 1, + ]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/NamingConventions/InterfaceNameSuffixUnitTest.php b/src/Standards/Generic/Tests/NamingConventions/InterfaceNameSuffixUnitTest.php index 95f3f6b397..6837f038fc 100644 --- a/src/Standards/Generic/Tests/NamingConventions/InterfaceNameSuffixUnitTest.php +++ b/src/Standards/Generic/Tests/NamingConventions/InterfaceNameSuffixUnitTest.php @@ -32,13 +32,13 @@ final class InterfaceNameSuffixUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'InterfaceNameSuffixUnitTest.1.inc': - return [ - 5 => 1, - 9 => 1, - ]; - default: - return []; + case 'InterfaceNameSuffixUnitTest.1.inc': + return [ + 5 => 1, + 9 => 1, + ]; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/NamingConventions/TraitNameSuffixUnitTest.php b/src/Standards/Generic/Tests/NamingConventions/TraitNameSuffixUnitTest.php index 69b45f9b37..f264b926e1 100644 --- a/src/Standards/Generic/Tests/NamingConventions/TraitNameSuffixUnitTest.php +++ b/src/Standards/Generic/Tests/NamingConventions/TraitNameSuffixUnitTest.php @@ -32,14 +32,14 @@ final class TraitNameSuffixUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'TraitNameSuffixUnitTest.1.inc': - return [ - 3 => 1, - 9 => 1, - ]; - - default: - return []; + case 'TraitNameSuffixUnitTest.1.inc': + return [ + 3 => 1, + 9 => 1, + ]; + + default: + return []; } } diff --git a/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.php b/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.php index 0c2e3e41c6..1a8d998d92 100644 --- a/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.php +++ b/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.php @@ -33,26 +33,26 @@ final class UpperCaseConstantNameUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'UpperCaseConstantNameUnitTest.1.inc': - return [ - 8 => 1, - 10 => 1, - 12 => 1, - 14 => 1, - 19 => 1, - 28 => 1, - 30 => 1, - 40 => 1, - 41 => 1, - 45 => 1, - 51 => 1, - 71 => 1, - 73 => 1, - 94 => 1, - ]; + case 'UpperCaseConstantNameUnitTest.1.inc': + return [ + 8 => 1, + 10 => 1, + 12 => 1, + 14 => 1, + 19 => 1, + 28 => 1, + 30 => 1, + 40 => 1, + 41 => 1, + 45 => 1, + 51 => 1, + 71 => 1, + 73 => 1, + 94 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.php b/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.php index 1aa1c660dc..d1ef9ae8ea 100644 --- a/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.php +++ b/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.php @@ -33,11 +33,11 @@ final class CharacterBeforePHPOpeningTagUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'CharacterBeforePHPOpeningTagUnitTest.1.inc': - return [2 => 1]; + case 'CharacterBeforePHPOpeningTagUnitTest.1.inc': + return [2 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/PHP/ClosingPHPTagUnitTest.php b/src/Standards/Generic/Tests/PHP/ClosingPHPTagUnitTest.php index 75ba4c163f..4bb587c536 100644 --- a/src/Standards/Generic/Tests/PHP/ClosingPHPTagUnitTest.php +++ b/src/Standards/Generic/Tests/PHP/ClosingPHPTagUnitTest.php @@ -33,14 +33,14 @@ final class ClosingPHPTagUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ClosingPHPTagUnitTest.1.inc': - return [9 => 1]; + case 'ClosingPHPTagUnitTest.1.inc': + return [9 => 1]; - case 'ClosingPHPTagUnitTest.2.inc': - return [5 => 1]; + case 'ClosingPHPTagUnitTest.2.inc': + return [5 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php b/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php index dd71fefbfa..bbaff27bf5 100644 --- a/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php +++ b/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php @@ -33,16 +33,16 @@ final class DisallowAlternativePHPTagsUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'DisallowAlternativePHPTagsUnitTest.1.inc': - return [ - 4 => 1, - 7 => 1, - 8 => 1, - 11 => 1, - ]; + case 'DisallowAlternativePHPTagsUnitTest.1.inc': + return [ + 4 => 1, + 7 => 1, + 8 => 1, + 11 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.php b/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.php index a49bce496b..854e1f1c7b 100644 --- a/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.php +++ b/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.php @@ -56,22 +56,22 @@ protected function getTestFiles(string $testFileBase) public function getErrorList($testFile = '') { switch ($testFile) { - case 'DisallowShortOpenTagUnitTest.1.inc': - return [ - 5 => 1, - 6 => 1, - 7 => 1, - 10 => 1, - ]; - case 'DisallowShortOpenTagUnitTest.2.inc': - return [ - 2 => 1, - 3 => 1, - 4 => 1, - 7 => 1, - ]; - default: - return []; + case 'DisallowShortOpenTagUnitTest.1.inc': + return [ + 5 => 1, + 6 => 1, + 7 => 1, + 10 => 1, + ]; + case 'DisallowShortOpenTagUnitTest.2.inc': + return [ + 2 => 1, + 3 => 1, + 4 => 1, + 7 => 1, + ]; + default: + return []; } } @@ -89,22 +89,22 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'DisallowShortOpenTagUnitTest.3.inc': - // Check if the Internal.NoCodeFound error can be expected on line 1. - $option = (bool) ini_get('short_open_tag'); - $line1 = 1; - if ($option === true) { - $line1 = 0; - } - return [ - 1 => $line1, - 3 => 1, - 6 => 1, - 11 => 1, - 16 => 1, - ]; - default: - return []; + case 'DisallowShortOpenTagUnitTest.3.inc': + // Check if the Internal.NoCodeFound error can be expected on line 1. + $option = (bool) ini_get('short_open_tag'); + $line1 = 1; + if ($option === true) { + $line1 = 0; + } + return [ + 1 => $line1, + 3 => 1, + 6 => 1, + 11 => 1, + 16 => 1, + ]; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php b/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php index fe0c67d11a..86b8490cee 100644 --- a/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php +++ b/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php @@ -33,50 +33,50 @@ final class LowerCaseConstantUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'LowerCaseConstantUnitTest.1.inc': - return [ - 7 => 1, - 10 => 1, - 15 => 1, - 16 => 1, - 23 => 1, - 26 => 1, - 31 => 1, - 32 => 1, - 39 => 1, - 42 => 1, - 47 => 1, - 48 => 1, - 70 => 1, - 71 => 1, - 87 => 1, - 89 => 1, - 90 => 1, - 92 => 2, - 94 => 2, - 95 => 1, - 100 => 2, - 104 => 1, - 108 => 1, - 118 => 1, - 119 => 1, - 120 => 1, - 121 => 1, - 125 => 1, - 129 => 1, - 149 => 1, - 153 => 1, - 164 => 1, - 165 => 1, - 166 => 1, - 171 => 1, - 173 => 1, - 175 => 1, - 177 => 1, - ]; + case 'LowerCaseConstantUnitTest.1.inc': + return [ + 7 => 1, + 10 => 1, + 15 => 1, + 16 => 1, + 23 => 1, + 26 => 1, + 31 => 1, + 32 => 1, + 39 => 1, + 42 => 1, + 47 => 1, + 48 => 1, + 70 => 1, + 71 => 1, + 87 => 1, + 89 => 1, + 90 => 1, + 92 => 2, + 94 => 2, + 95 => 1, + 100 => 2, + 104 => 1, + 108 => 1, + 118 => 1, + 119 => 1, + 120 => 1, + 121 => 1, + 125 => 1, + 129 => 1, + 149 => 1, + 153 => 1, + 164 => 1, + 165 => 1, + 166 => 1, + 171 => 1, + 173 => 1, + 175 => 1, + 177 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.php b/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.php index 4105c48631..b3846f8f2d 100644 --- a/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.php +++ b/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.php @@ -33,75 +33,75 @@ final class LowerCaseTypeUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'LowerCaseTypeUnitTest.1.inc': - return [ - 14 => 1, - 15 => 1, - 16 => 1, - 17 => 1, - 18 => 1, - 21 => 4, - 22 => 3, - 23 => 3, - 25 => 1, - 26 => 2, - 27 => 2, - 32 => 4, - 36 => 1, - 37 => 1, - 38 => 1, - 39 => 1, - 43 => 2, - 44 => 1, - 46 => 1, - 49 => 1, - 51 => 2, - 53 => 1, - 55 => 2, - 60 => 1, - 61 => 1, - 62 => 1, - 63 => 1, - 64 => 1, - 65 => 1, - 66 => 1, - 67 => 1, - 68 => 1, - 69 => 1, - 71 => 3, - 72 => 2, - 73 => 3, - 74 => 3, - 78 => 3, - 82 => 2, - 85 => 1, - 94 => 5, - 96 => 4, - 105 => 1, - 106 => 1, - 107 => 1, - 111 => 1, - 112 => 1, - 113 => 1, - 114 => 1, - 117 => 1, - 118 => 1, - 119 => 1, - 122 => 3, - 123 => 2, - 124 => 3, - 125 => 3, - 129 => 2, - 131 => 1, - 134 => 1, - 135 => 1, - 136 => 1, - 139 => 2, - 143 => 1, - ]; + case 'LowerCaseTypeUnitTest.1.inc': + return [ + 14 => 1, + 15 => 1, + 16 => 1, + 17 => 1, + 18 => 1, + 21 => 4, + 22 => 3, + 23 => 3, + 25 => 1, + 26 => 2, + 27 => 2, + 32 => 4, + 36 => 1, + 37 => 1, + 38 => 1, + 39 => 1, + 43 => 2, + 44 => 1, + 46 => 1, + 49 => 1, + 51 => 2, + 53 => 1, + 55 => 2, + 60 => 1, + 61 => 1, + 62 => 1, + 63 => 1, + 64 => 1, + 65 => 1, + 66 => 1, + 67 => 1, + 68 => 1, + 69 => 1, + 71 => 3, + 72 => 2, + 73 => 3, + 74 => 3, + 78 => 3, + 82 => 2, + 85 => 1, + 94 => 5, + 96 => 4, + 105 => 1, + 106 => 1, + 107 => 1, + 111 => 1, + 112 => 1, + 113 => 1, + 114 => 1, + 117 => 1, + 118 => 1, + 119 => 1, + 122 => 3, + 123 => 2, + 124 => 3, + 125 => 3, + 129 => 2, + 131 => 1, + 134 => 1, + 135 => 1, + 136 => 1, + 139 => 2, + 143 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/PHP/RequireStrictTypesUnitTest.php b/src/Standards/Generic/Tests/PHP/RequireStrictTypesUnitTest.php index e5bf1bb3a2..dc32d2ba71 100644 --- a/src/Standards/Generic/Tests/PHP/RequireStrictTypesUnitTest.php +++ b/src/Standards/Generic/Tests/PHP/RequireStrictTypesUnitTest.php @@ -33,14 +33,14 @@ final class RequireStrictTypesUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'RequireStrictTypesUnitTest.2.inc': - case 'RequireStrictTypesUnitTest.5.inc': - case 'RequireStrictTypesUnitTest.6.inc': - case 'RequireStrictTypesUnitTest.10.inc': - return [1 => 1]; + case 'RequireStrictTypesUnitTest.2.inc': + case 'RequireStrictTypesUnitTest.5.inc': + case 'RequireStrictTypesUnitTest.6.inc': + case 'RequireStrictTypesUnitTest.10.inc': + return [1 => 1]; - default: - return []; + default: + return []; } } @@ -55,14 +55,14 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'RequireStrictTypesUnitTest.11.inc': - case 'RequireStrictTypesUnitTest.12.inc': - case 'RequireStrictTypesUnitTest.14.inc': - case 'RequireStrictTypesUnitTest.15.inc': - return [3 => 1]; + case 'RequireStrictTypesUnitTest.11.inc': + case 'RequireStrictTypesUnitTest.12.inc': + case 'RequireStrictTypesUnitTest.14.inc': + case 'RequireStrictTypesUnitTest.15.inc': + return [3 => 1]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php b/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php index 0cb614d07a..f577c7bcc1 100644 --- a/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php +++ b/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php @@ -37,12 +37,12 @@ final class SyntaxUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'SyntaxUnitTest.1.inc': - case 'SyntaxUnitTest.2.inc': - return [3 => 1]; + case 'SyntaxUnitTest.1.inc': + case 'SyntaxUnitTest.2.inc': + return [3 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/Strings/UnnecessaryHeredocUnitTest.php b/src/Standards/Generic/Tests/Strings/UnnecessaryHeredocUnitTest.php index f338d600ab..beb01c4994 100644 --- a/src/Standards/Generic/Tests/Strings/UnnecessaryHeredocUnitTest.php +++ b/src/Standards/Generic/Tests/Strings/UnnecessaryHeredocUnitTest.php @@ -52,19 +52,19 @@ public function getWarningList($testFile = '') ]; switch ($testFile) { - case 'UnnecessaryHeredocUnitTest.1.inc': - return $warnings; - - case 'UnnecessaryHeredocUnitTest.2.inc': - if (PHP_VERSION_ID >= 70300) { + case 'UnnecessaryHeredocUnitTest.1.inc': return $warnings; - } - // PHP 7.2 or lower: PHP version which doesn't support flexible heredocs/nowdocs yet. - return []; + case 'UnnecessaryHeredocUnitTest.2.inc': + if (PHP_VERSION_ID >= 70300) { + return $warnings; + } + + // PHP 7.2 or lower: PHP version which doesn't support flexible heredocs/nowdocs yet. + return []; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.php b/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.php index 39498ae110..9cf7606e8a 100644 --- a/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.php +++ b/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.php @@ -33,18 +33,18 @@ final class UnnecessaryStringConcatUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'UnnecessaryStringConcatUnitTest.1.inc': - return [ - 2 => 1, - 6 => 1, - 9 => 1, - 12 => 1, - 19 => 1, - 20 => 1, - ]; + case 'UnnecessaryStringConcatUnitTest.1.inc': + return [ + 2 => 1, + 6 => 1, + 9 => 1, + 12 => 1, + 19 => 1, + 20 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php b/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php index 5f2400c1b3..af9972165e 100644 --- a/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php +++ b/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php @@ -33,89 +33,89 @@ final class GitMergeConflictUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'GitMergeConflictUnitTest.1.inc': - return [ - 26 => 1, - 28 => 1, - 30 => 1, - 45 => 1, - 53 => 1, - 55 => 1, - 59 => 1, - 61 => 1, - ]; + case 'GitMergeConflictUnitTest.1.inc': + return [ + 26 => 1, + 28 => 1, + 30 => 1, + 45 => 1, + 53 => 1, + 55 => 1, + 59 => 1, + 61 => 1, + ]; - case 'GitMergeConflictUnitTest.2.inc': - return [ - 4 => 1, - 6 => 1, - 8 => 1, - 14 => 1, - 20 => 1, - 22 => 1, - 26 => 1, - 28 => 1, - 30 => 1, - ]; + case 'GitMergeConflictUnitTest.2.inc': + return [ + 4 => 1, + 6 => 1, + 8 => 1, + 14 => 1, + 20 => 1, + 22 => 1, + 26 => 1, + 28 => 1, + 30 => 1, + ]; - case 'GitMergeConflictUnitTest.3.inc': - return [ - 3 => 1, - 5 => 1, - 7 => 1, - 12 => 1, - 14 => 1, - 16 => 1, - 22 => 1, - 24 => 1, - 26 => 1, - 38 => 1, - 40 => 1, - 42 => 1, - ]; + case 'GitMergeConflictUnitTest.3.inc': + return [ + 3 => 1, + 5 => 1, + 7 => 1, + 12 => 1, + 14 => 1, + 16 => 1, + 22 => 1, + 24 => 1, + 26 => 1, + 38 => 1, + 40 => 1, + 42 => 1, + ]; - case 'GitMergeConflictUnitTest.4.inc': - return [ - 6 => 1, - 8 => 1, - 10 => 1, - 18 => 1, - 22 => 1, - 25 => 1, - 29 => 1, - 34 => 1, - 39 => 1, - 53 => 1, - 55 => 1, - 57 => 1, - 64 => 1, - 68 => 1, - 71 => 1, - ]; - case 'GitMergeConflictUnitTest.5.inc': - case 'GitMergeConflictUnitTest.6.inc': - return [ - 6 => 1, - 8 => 1, - 10 => 1, - 15 => 1, - 28 => 1, - 30 => 1, - 32 => 1, - ]; + case 'GitMergeConflictUnitTest.4.inc': + return [ + 6 => 1, + 8 => 1, + 10 => 1, + 18 => 1, + 22 => 1, + 25 => 1, + 29 => 1, + 34 => 1, + 39 => 1, + 53 => 1, + 55 => 1, + 57 => 1, + 64 => 1, + 68 => 1, + 71 => 1, + ]; + case 'GitMergeConflictUnitTest.5.inc': + case 'GitMergeConflictUnitTest.6.inc': + return [ + 6 => 1, + 8 => 1, + 10 => 1, + 15 => 1, + 28 => 1, + 30 => 1, + 32 => 1, + ]; - case 'GitMergeConflictUnitTest.7.inc': - return [ - 3 => 1, - 5 => 1, - 7 => 1, - 12 => 1, - 14 => 1, - 16 => 1, - ]; + case 'GitMergeConflictUnitTest.7.inc': + return [ + 3 => 1, + 5 => 1, + 7 => 1, + 12 => 1, + 14 => 1, + 16 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.php b/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.php index 18744489a4..5a0dcb750d 100644 --- a/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.php +++ b/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.php @@ -33,45 +33,45 @@ final class ArbitraryParenthesesSpacingUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ArbitraryParenthesesSpacingUnitTest.1.inc': - return [ - 64 => 4, - 66 => 1, - 68 => 1, - 69 => 1, - 72 => 2, - 73 => 2, - 77 => 2, - 81 => 4, - 90 => 4, - 94 => 1, - 95 => 1, - 97 => 1, - 100 => 2, - 101 => 2, - 104 => 2, - 107 => 2, - 109 => 4, - 111 => 4, - 113 => 2, - 115 => 2, - 123 => 1, - 125 => 2, - 127 => 1, - 131 => 1, - 133 => 1, - 137 => 1, - 139 => 2, - 141 => 1, - 144 => 1, - 146 => 1, - 163 => 1, - 164 => 1, - 165 => 1, - ]; + case 'ArbitraryParenthesesSpacingUnitTest.1.inc': + return [ + 64 => 4, + 66 => 1, + 68 => 1, + 69 => 1, + 72 => 2, + 73 => 2, + 77 => 2, + 81 => 4, + 90 => 4, + 94 => 1, + 95 => 1, + 97 => 1, + 100 => 2, + 101 => 2, + 104 => 2, + 107 => 2, + 109 => 4, + 111 => 4, + 113 => 2, + 115 => 2, + 123 => 1, + 125 => 2, + 127 => 1, + 131 => 1, + 133 => 1, + 137 => 1, + 139 => 2, + 141 => 1, + 144 => 1, + 146 => 1, + 163 => 1, + 164 => 1, + 165 => 1, + ]; - default: - return []; + default: + return []; } } @@ -89,14 +89,14 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'ArbitraryParenthesesSpacingUnitTest.1.inc': - return [ - 55 => 1, - 56 => 1, - ]; + case 'ArbitraryParenthesesSpacingUnitTest.1.inc': + return [ + 55 => 1, + 56 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.php b/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.php index fc5f06685d..6bc10a6d1d 100644 --- a/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.php +++ b/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.php @@ -52,70 +52,70 @@ public function setCliValues(string $testFile, Config $config) public function getErrorList($testFile = '') { switch ($testFile) { - case 'DisallowSpaceIndentUnitTest.1.inc': - case 'DisallowSpaceIndentUnitTest.2.inc': - return [ - 5 => 1, - 9 => 1, - 15 => 1, - 22 => 1, - 24 => 1, - 30 => 1, - 35 => 1, - 50 => 1, - 55 => 1, - 57 => 1, - 58 => 1, - 59 => 1, - 60 => 1, - 65 => 1, - 66 => 1, - 67 => 1, - 68 => 1, - 69 => 1, - 70 => 1, - 73 => 1, - 77 => 1, - 81 => 1, - 104 => 1, - 105 => 1, - 106 => 1, - 107 => 1, - 108 => 1, - 110 => 1, - 111 => 1, - 112 => 1, - 114 => 1, - 115 => 1, - 117 => 1, - 118 => 1, - 123 => 1, - ]; - - case 'DisallowSpaceIndentUnitTest.3.inc': - return [ - 2 => 1, - 5 => 1, - 10 => 1, - 12 => 1, - 13 => 1, - 14 => 1, - 15 => 1, - ]; + case 'DisallowSpaceIndentUnitTest.1.inc': + case 'DisallowSpaceIndentUnitTest.2.inc': + return [ + 5 => 1, + 9 => 1, + 15 => 1, + 22 => 1, + 24 => 1, + 30 => 1, + 35 => 1, + 50 => 1, + 55 => 1, + 57 => 1, + 58 => 1, + 59 => 1, + 60 => 1, + 65 => 1, + 66 => 1, + 67 => 1, + 68 => 1, + 69 => 1, + 70 => 1, + 73 => 1, + 77 => 1, + 81 => 1, + 104 => 1, + 105 => 1, + 106 => 1, + 107 => 1, + 108 => 1, + 110 => 1, + 111 => 1, + 112 => 1, + 114 => 1, + 115 => 1, + 117 => 1, + 118 => 1, + 123 => 1, + ]; - case 'DisallowSpaceIndentUnitTest.4.inc': - if (PHP_VERSION_ID >= 70300) { + case 'DisallowSpaceIndentUnitTest.3.inc': return [ - 7 => 1, + 2 => 1, + 5 => 1, + 10 => 1, + 12 => 1, 13 => 1, + 14 => 1, + 15 => 1, ]; - } - // PHP 7.2 or lower: PHP version which doesn't support flexible heredocs/nowdocs yet. - return []; + case 'DisallowSpaceIndentUnitTest.4.inc': + if (PHP_VERSION_ID >= 70300) { + return [ + 7 => 1, + 13 => 1, + ]; + } + + // PHP 7.2 or lower: PHP version which doesn't support flexible heredocs/nowdocs yet. + return []; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.php b/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.php index 01a99e8e88..55199b6689 100644 --- a/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.php +++ b/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.php @@ -48,75 +48,75 @@ public function setCliValues(string $testFile, Config $config) public function getErrorList($testFile = '') { switch ($testFile) { - case 'DisallowTabIndentUnitTest.1.inc': - return [ - 5 => 2, - 9 => 1, - 15 => 1, - 20 => 2, - 21 => 1, - 22 => 2, - 23 => 1, - 24 => 2, - 31 => 1, - 32 => 2, - 33 => 2, - 41 => 1, - 42 => 1, - 43 => 1, - 44 => 1, - 45 => 1, - 46 => 1, - 47 => 1, - 48 => 1, - 54 => 1, - 55 => 1, - 56 => 1, - 57 => 1, - 58 => 1, - 59 => 1, - 79 => 1, - 80 => 1, - 81 => 1, - 82 => 1, - 83 => 1, - 85 => 1, - 86 => 1, - 87 => 1, - 89 => 1, - 90 => 1, - 92 => 1, - 93 => 1, - 97 => 1, - 100 => 1, - ]; - - case 'DisallowTabIndentUnitTest.2.inc': - return [ - 6 => 1, - 7 => 1, - 8 => 1, - 9 => 1, - 10 => 1, - 11 => 1, - 12 => 1, - 13 => 1, - 19 => 1, - ]; + case 'DisallowTabIndentUnitTest.1.inc': + return [ + 5 => 2, + 9 => 1, + 15 => 1, + 20 => 2, + 21 => 1, + 22 => 2, + 23 => 1, + 24 => 2, + 31 => 1, + 32 => 2, + 33 => 2, + 41 => 1, + 42 => 1, + 43 => 1, + 44 => 1, + 45 => 1, + 46 => 1, + 47 => 1, + 48 => 1, + 54 => 1, + 55 => 1, + 56 => 1, + 57 => 1, + 58 => 1, + 59 => 1, + 79 => 1, + 80 => 1, + 81 => 1, + 82 => 1, + 83 => 1, + 85 => 1, + 86 => 1, + 87 => 1, + 89 => 1, + 90 => 1, + 92 => 1, + 93 => 1, + 97 => 1, + 100 => 1, + ]; - case 'DisallowTabIndentUnitTest.3.inc': - if (PHP_VERSION_ID >= 70300) { + case 'DisallowTabIndentUnitTest.2.inc': return [ + 6 => 1, 7 => 1, + 8 => 1, + 9 => 1, + 10 => 1, + 11 => 1, + 12 => 1, 13 => 1, + 19 => 1, ]; - } - // PHP 7.2 or lower: PHP version which doesn't support flexible heredocs/nowdocs yet. - return []; + case 'DisallowTabIndentUnitTest.3.inc': + if (PHP_VERSION_ID >= 70300) { + return [ + 7 => 1, + 13 => 1, + ]; + } + + // PHP 7.2 or lower: PHP version which doesn't support flexible heredocs/nowdocs yet. + return []; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.php b/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.php index d311dc7341..121f340573 100644 --- a/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.php +++ b/src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.php @@ -33,52 +33,52 @@ final class LanguageConstructSpacingUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'LanguageConstructSpacingUnitTest.1.inc': - return [ - 3 => 1, - 5 => 1, - 8 => 1, - 10 => 1, - 13 => 1, - 15 => 1, - 18 => 1, - 20 => 1, - 23 => 1, - 25 => 1, - 28 => 1, - 30 => 1, - 33 => 1, - 36 => 1, - 39 => 1, - 40 => 1, - 43 => 1, - 44 => 1, - 45 => 1, - 46 => 1, - 48 => 1, - 52 => 1, - 55 => 1, - 56 => 1, - 57 => 2, - 60 => 1, - 63 => 1, - 65 => 1, - 73 => 1, - 75 => 1, - 77 => 1, - 81 => 1, - 83 => 1, - 85 => 1, - 86 => 1, - 90 => 1, - 94 => 1, - 95 => 1, - 98 => 1, - 107 => 1, - ]; + case 'LanguageConstructSpacingUnitTest.1.inc': + return [ + 3 => 1, + 5 => 1, + 8 => 1, + 10 => 1, + 13 => 1, + 15 => 1, + 18 => 1, + 20 => 1, + 23 => 1, + 25 => 1, + 28 => 1, + 30 => 1, + 33 => 1, + 36 => 1, + 39 => 1, + 40 => 1, + 43 => 1, + 44 => 1, + 45 => 1, + 46 => 1, + 48 => 1, + 52 => 1, + 55 => 1, + 56 => 1, + 57 => 2, + 60 => 1, + 63 => 1, + 65 => 1, + 73 => 1, + 75 => 1, + 77 => 1, + 81 => 1, + 83 => 1, + 85 => 1, + 86 => 1, + 90 => 1, + 94 => 1, + 95 => 1, + 98 => 1, + 107 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Generic/Tests/WhiteSpace/SpreadOperatorSpacingAfterUnitTest.php b/src/Standards/Generic/Tests/WhiteSpace/SpreadOperatorSpacingAfterUnitTest.php index ffa5b9b0e4..51ac0683f1 100644 --- a/src/Standards/Generic/Tests/WhiteSpace/SpreadOperatorSpacingAfterUnitTest.php +++ b/src/Standards/Generic/Tests/WhiteSpace/SpreadOperatorSpacingAfterUnitTest.php @@ -33,22 +33,22 @@ final class SpreadOperatorSpacingAfterUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'SpreadOperatorSpacingAfterUnitTest.1.inc': - return [ - 12 => 1, - 13 => 1, - 20 => 2, - 40 => 1, - 41 => 1, - 46 => 2, - 60 => 1, - 61 => 1, - 66 => 2, - 78 => 1, - ]; + case 'SpreadOperatorSpacingAfterUnitTest.1.inc': + return [ + 12 => 1, + 13 => 1, + 20 => 2, + 40 => 1, + 41 => 1, + 46 => 2, + 60 => 1, + 61 => 1, + 66 => 2, + 78 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php b/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php index 5cc6c8f2aa..d2ab0aa423 100644 --- a/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php +++ b/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php @@ -52,25 +52,25 @@ public function setCliValues(string $testFile, Config $config) public function getErrorList($testFile = '') { switch ($testFile) { - case 'ClassDeclarationUnitTest.1.inc': - return [ - 21 => 1, - 22 => 1, - 23 => 1, - 27 => 1, - 33 => 1, - 38 => 1, - 49 => 1, - 84 => 1, - 94 => 1, - 99 => 1, - 104 => 1, - 110 => 1, - 114 => 1, - ]; + case 'ClassDeclarationUnitTest.1.inc': + return [ + 21 => 1, + 22 => 1, + 23 => 1, + 27 => 1, + 33 => 1, + 38 => 1, + 49 => 1, + 84 => 1, + 94 => 1, + 99 => 1, + 104 => 1, + 110 => 1, + 114 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php b/src/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php index c858eecc00..58e97e01e9 100644 --- a/src/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php +++ b/src/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php @@ -33,38 +33,38 @@ final class ClassCommentUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ClassCommentUnitTest.1.inc': - return [ - 4 => 1, - 15 => 1, - 51 => 1, - 63 => 1, - 65 => 2, - 66 => 1, - 68 => 1, - 70 => 1, - 71 => 1, - 72 => 1, - 74 => 2, - 75 => 1, - 76 => 1, - 77 => 1, - 85 => 1, - 96 => 5, - 106 => 5, - 116 => 5, - 126 => 5, - 161 => 1, - 163 => 1, - ]; + case 'ClassCommentUnitTest.1.inc': + return [ + 4 => 1, + 15 => 1, + 51 => 1, + 63 => 1, + 65 => 2, + 66 => 1, + 68 => 1, + 70 => 1, + 71 => 1, + 72 => 1, + 74 => 2, + 75 => 1, + 76 => 1, + 77 => 1, + 85 => 1, + 96 => 5, + 106 => 5, + 116 => 5, + 126 => 5, + 161 => 1, + 163 => 1, + ]; - case 'ClassCommentUnitTest.2.inc': - return [ - 7 => 1, - ]; + case 'ClassCommentUnitTest.2.inc': + return [ + 7 => 1, + ]; - default: - return []; + default: + return []; } } @@ -82,14 +82,14 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'ClassCommentUnitTest.1.inc': - return [ - 71 => 1, - 73 => 1, - ]; + case 'ClassCommentUnitTest.1.inc': + return [ + 71 => 1, + 73 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/PEAR/Tests/Commenting/FileCommentUnitTest.php b/src/Standards/PEAR/Tests/Commenting/FileCommentUnitTest.php index 3f38f50882..dac2a9dea5 100644 --- a/src/Standards/PEAR/Tests/Commenting/FileCommentUnitTest.php +++ b/src/Standards/PEAR/Tests/Commenting/FileCommentUnitTest.php @@ -33,32 +33,32 @@ final class FileCommentUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FileCommentUnitTest.1.inc': - return [ - 21 => 1, - 23 => 2, - 24 => 1, - 26 => 1, - 28 => 1, - 29 => 1, - 30 => 1, - 31 => 1, - 32 => 2, - 33 => 1, - 34 => 1, - 35 => 1, - 40 => 2, - 41 => 2, - 43 => 1, - ]; + case 'FileCommentUnitTest.1.inc': + return [ + 21 => 1, + 23 => 2, + 24 => 1, + 26 => 1, + 28 => 1, + 29 => 1, + 30 => 1, + 31 => 1, + 32 => 2, + 33 => 1, + 34 => 1, + 35 => 1, + 40 => 2, + 41 => 2, + 43 => 1, + ]; - case 'FileCommentUnitTest.2.inc': - case 'FileCommentUnitTest.3.inc': - case 'FileCommentUnitTest.4.inc': - return [1 => 1]; + case 'FileCommentUnitTest.2.inc': + case 'FileCommentUnitTest.3.inc': + case 'FileCommentUnitTest.4.inc': + return [1 => 1]; - default: - return []; + default: + return []; } } @@ -76,16 +76,16 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'FileCommentUnitTest.1.inc': - return [ - 29 => 1, - 30 => 1, - 34 => 1, - 43 => 1, - ]; + case 'FileCommentUnitTest.1.inc': + return [ + 29 => 1, + 30 => 1, + 34 => 1, + 43 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php b/src/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php index d745c4a08f..051f92e02f 100644 --- a/src/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php +++ b/src/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php @@ -33,76 +33,76 @@ final class FunctionCommentUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FunctionCommentUnitTest.1.inc': - return [ - 5 => 1, - 10 => 1, - 12 => 1, - 13 => 1, - 14 => 1, - 15 => 1, - 28 => 1, - 76 => 1, - 87 => 1, - 103 => 1, - 109 => 1, - 112 => 1, - 122 => 1, - 123 => 2, - 124 => 2, - 125 => 1, - 126 => 1, - 137 => 1, - 138 => 1, - 139 => 1, - 152 => 1, - 155 => 1, - 165 => 1, - 172 => 1, - 183 => 1, - 190 => 2, - 206 => 1, - 234 => 1, - 272 => 1, - 313 => 1, - 317 => 1, - 327 => 1, - 329 => 1, - 332 => 1, - 344 => 1, - 343 => 1, - 345 => 1, - 346 => 1, - 360 => 1, - 361 => 1, - 363 => 1, - 364 => 1, - 406 => 1, - 417 => 1, - 456 => 1, - 466 => 1, - 474 => 1, - 476 => 1, - 486 => 1, - 502 => 1, - 521 => 1, - 523 => 1, - 533 => 1, - 545 => 1, - ]; + case 'FunctionCommentUnitTest.1.inc': + return [ + 5 => 1, + 10 => 1, + 12 => 1, + 13 => 1, + 14 => 1, + 15 => 1, + 28 => 1, + 76 => 1, + 87 => 1, + 103 => 1, + 109 => 1, + 112 => 1, + 122 => 1, + 123 => 2, + 124 => 2, + 125 => 1, + 126 => 1, + 137 => 1, + 138 => 1, + 139 => 1, + 152 => 1, + 155 => 1, + 165 => 1, + 172 => 1, + 183 => 1, + 190 => 2, + 206 => 1, + 234 => 1, + 272 => 1, + 313 => 1, + 317 => 1, + 327 => 1, + 329 => 1, + 332 => 1, + 344 => 1, + 343 => 1, + 345 => 1, + 346 => 1, + 360 => 1, + 361 => 1, + 363 => 1, + 364 => 1, + 406 => 1, + 417 => 1, + 456 => 1, + 466 => 1, + 474 => 1, + 476 => 1, + 486 => 1, + 502 => 1, + 521 => 1, + 523 => 1, + 533 => 1, + 545 => 1, + ]; - case 'FunctionCommentUnitTest.2.inc': - return [ - 7 => 1, - ]; + case 'FunctionCommentUnitTest.2.inc': + return [ + 7 => 1, + ]; - case 'FunctionCommentUnitTest.3.inc': - return [ - 10 => 1, - ]; + case 'FunctionCommentUnitTest.3.inc': + return [ + 10 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.php b/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.php index 8316a2653a..28c8f9bc94 100644 --- a/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.php +++ b/src/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.php @@ -33,90 +33,90 @@ final class FunctionDeclarationUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FunctionDeclarationUnitTest.1.inc': - return [ - 3 => 1, - 4 => 1, - 5 => 1, - 9 => 1, - 10 => 1, - 11 => 1, - 14 => 1, - 17 => 1, - 44 => 1, - 52 => 1, - 61 => 2, - 98 => 1, - 110 => 2, - 120 => 3, - 121 => 1, - 140 => 1, - 145 => 1, - 161 => 2, - 162 => 2, - 164 => 2, - 167 => 2, - 171 => 1, - 173 => 1, - 201 => 1, - 206 => 1, - 208 => 1, - 216 => 1, - 223 => 1, - 230 => 1, - 237 => 1, - 243 => 1, - 247 => 1, - 251 => 2, - 253 => 2, - 257 => 2, - 259 => 1, - 263 => 1, - 265 => 1, - 269 => 1, - 273 => 1, - 277 => 1, - 278 => 1, - 283 => 1, - 287 => 2, - 289 => 2, - 293 => 2, - 295 => 1, - 299 => 1, - 301 => 1, - 305 => 1, - 309 => 1, - 313 => 1, - 314 => 1, - 350 => 1, - 351 => 1, - 352 => 1, - 353 => 1, - 361 => 1, - 362 => 1, - 363 => 1, - 364 => 1, - 365 => 1, - 366 => 1, - 367 => 1, - 368 => 1, - 369 => 1, - 370 => 1, - 371 => 1, - 402 => 1, - 406 => 1, - 475 => 1, - 483 => 1, - 490 => 2, - ]; + case 'FunctionDeclarationUnitTest.1.inc': + return [ + 3 => 1, + 4 => 1, + 5 => 1, + 9 => 1, + 10 => 1, + 11 => 1, + 14 => 1, + 17 => 1, + 44 => 1, + 52 => 1, + 61 => 2, + 98 => 1, + 110 => 2, + 120 => 3, + 121 => 1, + 140 => 1, + 145 => 1, + 161 => 2, + 162 => 2, + 164 => 2, + 167 => 2, + 171 => 1, + 173 => 1, + 201 => 1, + 206 => 1, + 208 => 1, + 216 => 1, + 223 => 1, + 230 => 1, + 237 => 1, + 243 => 1, + 247 => 1, + 251 => 2, + 253 => 2, + 257 => 2, + 259 => 1, + 263 => 1, + 265 => 1, + 269 => 1, + 273 => 1, + 277 => 1, + 278 => 1, + 283 => 1, + 287 => 2, + 289 => 2, + 293 => 2, + 295 => 1, + 299 => 1, + 301 => 1, + 305 => 1, + 309 => 1, + 313 => 1, + 314 => 1, + 350 => 1, + 351 => 1, + 352 => 1, + 353 => 1, + 361 => 1, + 362 => 1, + 363 => 1, + 364 => 1, + 365 => 1, + 366 => 1, + 367 => 1, + 368 => 1, + 369 => 1, + 370 => 1, + 371 => 1, + 402 => 1, + 406 => 1, + 475 => 1, + 483 => 1, + 490 => 2, + ]; - case 'FunctionDeclarationUnitTest.4.inc': - return [ - 7 => 1, - ]; + case 'FunctionDeclarationUnitTest.4.inc': + return [ + 7 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php b/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php index 13551b5cb7..8de477c960 100644 --- a/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php +++ b/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php @@ -33,24 +33,24 @@ final class ValidDefaultValueUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ValidDefaultValueUnitTest.1.inc': - return [ - 29 => 1, - 34 => 1, - 39 => 1, - 71 => 1, - 76 => 1, - 81 => 1, - 91 => 1, - 99 => 1, - 101 => 1, - 106 => 1, - 114 => 1, - 120 => 1, - ]; + case 'ValidDefaultValueUnitTest.1.inc': + return [ + 29 => 1, + 34 => 1, + 39 => 1, + 71 => 1, + 76 => 1, + 81 => 1, + 91 => 1, + 99 => 1, + 101 => 1, + 106 => 1, + 114 => 1, + 120 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.php b/src/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.php index d00e3033ca..4af12e50e8 100644 --- a/src/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.php +++ b/src/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.php @@ -33,112 +33,112 @@ final class ValidFunctionNameUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ValidFunctionNameUnitTest.1.inc': - return [ - 11 => 1, - 12 => 1, - 13 => 1, - 14 => 1, - 15 => 1, - 16 => 1, - 17 => 2, - 18 => 2, - 19 => 2, - 20 => 2, - 24 => 1, - 25 => 1, - 26 => 1, - 27 => 1, - 28 => 1, - 29 => 1, - 30 => 2, - 31 => 2, - 32 => 2, - 33 => 2, - 35 => 1, - 36 => 1, - 37 => 2, - 38 => 2, - 39 => 2, - 40 => 2, - 43 => 1, - 44 => 1, - 45 => 1, - 46 => 1, - 50 => 1, - 51 => 1, - 52 => 1, - 53 => 1, - 56 => 1, - 57 => 1, - 58 => 1, - 59 => 1, - 67 => 1, - 68 => 1, - 69 => 1, - 70 => 1, - 71 => 1, - 72 => 1, - 73 => 2, - 74 => 2, - 75 => 2, - 76 => 2, - 80 => 1, - 81 => 1, - 82 => 1, - 83 => 1, - 86 => 1, - 87 => 1, - 88 => 1, - 89 => 1, - 95 => 1, - 96 => 1, - 97 => 1, - 98 => 1, - 99 => 1, - 100 => 1, - 101 => 2, - 102 => 2, - 103 => 2, - 104 => 2, - 123 => 1, - 125 => 1, - 126 => 2, - 129 => 1, - 130 => 1, - 131 => 1, - 132 => 1, - 133 => 1, - 134 => 1, - 135 => 1, - 136 => 1, - 137 => 1, - 138 => 1, - 139 => 1, - 140 => 3, - 141 => 1, - 143 => 1, - 144 => 1, - 145 => 3, - 147 => 2, - 148 => 1, - 149 => 1, - 181 => 1, - 201 => 1, - 203 => 1, - 204 => 2, - 207 => 2, - 212 => 1, - 213 => 1, - 214 => 1, - 235 => 1, - 236 => 2, - 239 => 1, - 242 => 1, - ]; + case 'ValidFunctionNameUnitTest.1.inc': + return [ + 11 => 1, + 12 => 1, + 13 => 1, + 14 => 1, + 15 => 1, + 16 => 1, + 17 => 2, + 18 => 2, + 19 => 2, + 20 => 2, + 24 => 1, + 25 => 1, + 26 => 1, + 27 => 1, + 28 => 1, + 29 => 1, + 30 => 2, + 31 => 2, + 32 => 2, + 33 => 2, + 35 => 1, + 36 => 1, + 37 => 2, + 38 => 2, + 39 => 2, + 40 => 2, + 43 => 1, + 44 => 1, + 45 => 1, + 46 => 1, + 50 => 1, + 51 => 1, + 52 => 1, + 53 => 1, + 56 => 1, + 57 => 1, + 58 => 1, + 59 => 1, + 67 => 1, + 68 => 1, + 69 => 1, + 70 => 1, + 71 => 1, + 72 => 1, + 73 => 2, + 74 => 2, + 75 => 2, + 76 => 2, + 80 => 1, + 81 => 1, + 82 => 1, + 83 => 1, + 86 => 1, + 87 => 1, + 88 => 1, + 89 => 1, + 95 => 1, + 96 => 1, + 97 => 1, + 98 => 1, + 99 => 1, + 100 => 1, + 101 => 2, + 102 => 2, + 103 => 2, + 104 => 2, + 123 => 1, + 125 => 1, + 126 => 2, + 129 => 1, + 130 => 1, + 131 => 1, + 132 => 1, + 133 => 1, + 134 => 1, + 135 => 1, + 136 => 1, + 137 => 1, + 138 => 1, + 139 => 1, + 140 => 3, + 141 => 1, + 143 => 1, + 144 => 1, + 145 => 3, + 147 => 2, + 148 => 1, + 149 => 1, + 181 => 1, + 201 => 1, + 203 => 1, + 204 => 2, + 207 => 2, + 212 => 1, + 213 => 1, + 214 => 1, + 235 => 1, + 236 => 2, + 239 => 1, + 242 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/PEAR/Tests/NamingConventions/ValidVariableNameUnitTest.php b/src/Standards/PEAR/Tests/NamingConventions/ValidVariableNameUnitTest.php index 00b69b5b4e..59df85a23f 100644 --- a/src/Standards/PEAR/Tests/NamingConventions/ValidVariableNameUnitTest.php +++ b/src/Standards/PEAR/Tests/NamingConventions/ValidVariableNameUnitTest.php @@ -33,23 +33,23 @@ final class ValidVariableNameUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ValidVariableNameUnitTest.1.inc': - return [ - 12 => 1, - 17 => 1, - 22 => 1, - 92 => 1, - 93 => 1, - 94 => 1, - 99 => 1, - 105 => 1, - 111 => 1, - 114 => 1, - 119 => 1, - ]; + case 'ValidVariableNameUnitTest.1.inc': + return [ + 12 => 1, + 17 => 1, + 22 => 1, + 92 => 1, + 93 => 1, + 94 => 1, + 99 => 1, + 105 => 1, + 111 => 1, + 114 => 1, + 119 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/PSR1/Tests/Files/SideEffectsUnitTest.php b/src/Standards/PSR1/Tests/Files/SideEffectsUnitTest.php index 0668f5c522..4f5c5045e0 100644 --- a/src/Standards/PSR1/Tests/Files/SideEffectsUnitTest.php +++ b/src/Standards/PSR1/Tests/Files/SideEffectsUnitTest.php @@ -66,16 +66,16 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'SideEffectsUnitTest.3.inc': - case 'SideEffectsUnitTest.4.inc': - case 'SideEffectsUnitTest.5.inc': - case 'SideEffectsUnitTest.10.inc': - case 'SideEffectsUnitTest.12.inc': - case 'SideEffectsUnitTest.15.inc': - case 'SideEffectsUnitTest.16.inc': - return [1 => 1]; - default: - return []; + case 'SideEffectsUnitTest.3.inc': + case 'SideEffectsUnitTest.4.inc': + case 'SideEffectsUnitTest.5.inc': + case 'SideEffectsUnitTest.10.inc': + case 'SideEffectsUnitTest.12.inc': + case 'SideEffectsUnitTest.15.inc': + case 'SideEffectsUnitTest.16.inc': + return [1 => 1]; + default: + return []; } } } diff --git a/src/Standards/PSR1/Tests/Methods/CamelCapsMethodNameUnitTest.php b/src/Standards/PSR1/Tests/Methods/CamelCapsMethodNameUnitTest.php index 4653512cea..17bc6949d7 100644 --- a/src/Standards/PSR1/Tests/Methods/CamelCapsMethodNameUnitTest.php +++ b/src/Standards/PSR1/Tests/Methods/CamelCapsMethodNameUnitTest.php @@ -33,22 +33,22 @@ final class CamelCapsMethodNameUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'CamelCapsMethodNameUnitTest.1.inc': - return [ - 6 => 1, - 7 => 1, - 11 => 1, - 12 => 1, - 13 => 1, - 17 => 1, - 21 => 1, - 25 => 1, - 26 => 1, - 77 => 1, - ]; + case 'CamelCapsMethodNameUnitTest.1.inc': + return [ + 6 => 1, + 7 => 1, + 11 => 1, + 12 => 1, + 13 => 1, + 17 => 1, + 21 => 1, + 25 => 1, + 26 => 1, + 77 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/PSR12/Sniffs/ControlStructures/BooleanOperatorPlacementSniff.php b/src/Standards/PSR12/Sniffs/ControlStructures/BooleanOperatorPlacementSniff.php index 53381ac0b1..8c862c7189 100644 --- a/src/Standards/PSR12/Sniffs/ControlStructures/BooleanOperatorPlacementSniff.php +++ b/src/Standards/PSR12/Sniffs/ControlStructures/BooleanOperatorPlacementSniff.php @@ -160,14 +160,14 @@ public function process(File $phpcsFile, int $stackPtr) } switch ($this->allowOnly) { - case 'first': - $error = 'Boolean operators between conditions must be at the beginning of the line'; - break; - case 'last': - $error = 'Boolean operators between conditions must be at the end of the line'; - break; - default: - $error = 'Boolean operators between conditions must be at the beginning or end of the line, but not both'; + case 'first': + $error = 'Boolean operators between conditions must be at the beginning of the line'; + break; + case 'last': + $error = 'Boolean operators between conditions must be at the end of the line'; + break; + default: + $error = 'Boolean operators between conditions must be at the beginning or end of the line, but not both'; } $fix = $phpcsFile->addFixableError($error, $stackPtr, 'FoundMixed'); diff --git a/src/Standards/PSR12/Sniffs/Files/FileHeaderSniff.php b/src/Standards/PSR12/Sniffs/Files/FileHeaderSniff.php index 2748c3b124..852fadde2a 100644 --- a/src/Standards/PSR12/Sniffs/Files/FileHeaderSniff.php +++ b/src/Standards/PSR12/Sniffs/Files/FileHeaderSniff.php @@ -157,114 +157,114 @@ public function getHeaderLines(File $phpcsFile, int $stackPtr) do { switch ($tokens[$next]['code']) { - case T_DOC_COMMENT_OPEN_TAG: - if ($foundDocblock === true) { - // Found a second docblock, so start of code. - break(2); - } - - // Make sure this is not a code-level docblock. - $end = $tokens[$next]['comment_closer']; - for ($docToken = ($end + 1); $docToken < $phpcsFile->numTokens; $docToken++) { - if (isset(Tokens::EMPTY_TOKENS[$tokens[$docToken]['code']]) === true) { - continue; - } - - if ($tokens[$docToken]['code'] === T_ATTRIBUTE - && isset($tokens[$docToken]['attribute_closer']) === true - ) { - $docToken = $tokens[$docToken]['attribute_closer']; - continue; + case T_DOC_COMMENT_OPEN_TAG: + if ($foundDocblock === true) { + // Found a second docblock, so start of code. + break(2); } - break; - } - - if ($docToken === $phpcsFile->numTokens) { - $docToken--; - } + // Make sure this is not a code-level docblock. + $end = $tokens[$next]['comment_closer']; + for ($docToken = ($end + 1); $docToken < $phpcsFile->numTokens; $docToken++) { + if (isset(Tokens::EMPTY_TOKENS[$tokens[$docToken]['code']]) === true) { + continue; + } - if (isset($commentOpeners[$tokens[$docToken]['code']]) === false - && isset(Tokens::METHOD_MODIFIERS[$tokens[$docToken]['code']]) === false - && $tokens[$docToken]['code'] !== T_READONLY - ) { - // Check for an @var annotation. - $annotation = false; - for ($i = $next; $i < $end; $i++) { - if ($tokens[$i]['code'] === T_DOC_COMMENT_TAG - && strtolower($tokens[$i]['content']) === '@var' + if ($tokens[$docToken]['code'] === T_ATTRIBUTE + && isset($tokens[$docToken]['attribute_closer']) === true ) { - $annotation = true; - break; + $docToken = $tokens[$docToken]['attribute_closer']; + continue; } - } - if ($annotation === false) { - $foundDocblock = true; - $headerLines[] = [ - 'type' => 'docblock', - 'start' => $next, - 'end' => $end, - ]; + break; } - } - $next = $end; - break; - case T_DECLARE: - case T_NAMESPACE: - if (isset($tokens[$next]['scope_opener']) === true) { - // If this statement is using bracketed syntax, it doesn't - // apply to the entire files and so is not part of header. - // The header has now ended and the main code block begins. - break(2); - } + if ($docToken === $phpcsFile->numTokens) { + $docToken--; + } - $end = $phpcsFile->findEndOfStatement($next); + if (isset($commentOpeners[$tokens[$docToken]['code']]) === false + && isset(Tokens::METHOD_MODIFIERS[$tokens[$docToken]['code']]) === false + && $tokens[$docToken]['code'] !== T_READONLY + ) { + // Check for an @var annotation. + $annotation = false; + for ($i = $next; $i < $end; $i++) { + if ($tokens[$i]['code'] === T_DOC_COMMENT_TAG + && strtolower($tokens[$i]['content']) === '@var' + ) { + $annotation = true; + break; + } + } - $headerLines[] = [ - 'type' => substr(strtolower($tokens[$next]['type']), 2), - 'start' => $next, - 'end' => $end, - ]; + if ($annotation === false) { + $foundDocblock = true; + $headerLines[] = [ + 'type' => 'docblock', + 'start' => $next, + 'end' => $end, + ]; + } + } - $next = $end; - break; - case T_USE: - $type = 'use'; - $useType = $phpcsFile->findNext(Tokens::EMPTY_TOKENS, ($next + 1), null, true); - if ($useType !== false && $tokens[$useType]['code'] === T_STRING) { - $content = strtolower($tokens[$useType]['content']); - if ($content === 'function' || $content === 'const') { - $type .= ' ' . $content; + $next = $end; + break; + case T_DECLARE: + case T_NAMESPACE: + if (isset($tokens[$next]['scope_opener']) === true) { + // If this statement is using bracketed syntax, it doesn't + // apply to the entire files and so is not part of header. + // The header has now ended and the main code block begins. + break(2); } - } - $end = $phpcsFile->findEndOfStatement($next); + $end = $phpcsFile->findEndOfStatement($next); - $headerLines[] = [ - 'type' => $type, - 'start' => $next, - 'end' => $end, - ]; + $headerLines[] = [ + 'type' => substr(strtolower($tokens[$next]['type']), 2), + 'start' => $next, + 'end' => $end, + ]; - $next = $end; - break; - default: - // Skip comments as PSR-12 doesn't say if these are allowed or not. - if (isset(Tokens::COMMENT_TOKENS[$tokens[$next]['code']]) === true) { - $next = $phpcsFile->findNext(Tokens::COMMENT_TOKENS, ($next + 1), null, true); - if ($next === false) { - // We reached the end of the file. - break(2); + $next = $end; + break; + case T_USE: + $type = 'use'; + $useType = $phpcsFile->findNext(Tokens::EMPTY_TOKENS, ($next + 1), null, true); + if ($useType !== false && $tokens[$useType]['code'] === T_STRING) { + $content = strtolower($tokens[$useType]['content']); + if ($content === 'function' || $content === 'const') { + $type .= ' ' . $content; + } } - $next--; + $end = $phpcsFile->findEndOfStatement($next); + + $headerLines[] = [ + 'type' => $type, + 'start' => $next, + 'end' => $end, + ]; + + $next = $end; break; - } + default: + // Skip comments as PSR-12 doesn't say if these are allowed or not. + if (isset(Tokens::COMMENT_TOKENS[$tokens[$next]['code']]) === true) { + $next = $phpcsFile->findNext(Tokens::COMMENT_TOKENS, ($next + 1), null, true); + if ($next === false) { + // We reached the end of the file. + break(2); + } - // We found the start of the main code block. - break(2); + $next--; + break; + } + + // We found the start of the main code block. + break(2); } $next = $phpcsFile->findNext(T_WHITESPACE, ($next + 1), null, true); diff --git a/src/Standards/PSR12/Tests/Files/DeclareStatementUnitTest.php b/src/Standards/PSR12/Tests/Files/DeclareStatementUnitTest.php index f05556d5a0..28e7b6f7c7 100644 --- a/src/Standards/PSR12/Tests/Files/DeclareStatementUnitTest.php +++ b/src/Standards/PSR12/Tests/Files/DeclareStatementUnitTest.php @@ -33,34 +33,34 @@ final class DeclareStatementUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'DeclareStatementUnitTest.1.inc': - return [ - 2 => 1, - 3 => 1, - 4 => 1, - 5 => 2, - 6 => 1, - 7 => 1, - 9 => 2, - 10 => 1, - 11 => 3, - 12 => 2, - 13 => 1, - 14 => 2, - 16 => 3, - 19 => 3, - 22 => 1, - 24 => 1, - 26 => 3, - 28 => 3, - 34 => 2, - 43 => 1, - 46 => 1, - 47 => 1, - 49 => 1, - ]; - default: - return []; + case 'DeclareStatementUnitTest.1.inc': + return [ + 2 => 1, + 3 => 1, + 4 => 1, + 5 => 2, + 6 => 1, + 7 => 1, + 9 => 2, + 10 => 1, + 11 => 3, + 12 => 2, + 13 => 1, + 14 => 2, + 16 => 3, + 19 => 3, + 22 => 1, + 24 => 1, + 26 => 3, + 28 => 3, + 34 => 2, + 43 => 1, + 46 => 1, + 47 => 1, + 49 => 1, + ]; + default: + return []; } } diff --git a/src/Standards/PSR12/Tests/Files/FileHeaderUnitTest.php b/src/Standards/PSR12/Tests/Files/FileHeaderUnitTest.php index 1683367cfd..c038a4a84f 100644 --- a/src/Standards/PSR12/Tests/Files/FileHeaderUnitTest.php +++ b/src/Standards/PSR12/Tests/Files/FileHeaderUnitTest.php @@ -33,37 +33,37 @@ final class FileHeaderUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FileHeaderUnitTest.2.inc': - return [ - 1 => 1, - 6 => 1, - 7 => 1, - 18 => 1, - 20 => 1, - 24 => 1, - ]; - case 'FileHeaderUnitTest.3.inc': - return [ - 9 => 1, - 18 => 1, - ]; - case 'FileHeaderUnitTest.4.inc': - return [ - 1 => 1, - 2 => 1, - 3 => 1, - 7 => 1, - ]; - case 'FileHeaderUnitTest.5.inc': - return [4 => 1]; - case 'FileHeaderUnitTest.7.inc': - case 'FileHeaderUnitTest.10.inc': - case 'FileHeaderUnitTest.11.inc': - return [1 => 1]; - case 'FileHeaderUnitTest.12.inc': - return [4 => 2]; - default: - return []; + case 'FileHeaderUnitTest.2.inc': + return [ + 1 => 1, + 6 => 1, + 7 => 1, + 18 => 1, + 20 => 1, + 24 => 1, + ]; + case 'FileHeaderUnitTest.3.inc': + return [ + 9 => 1, + 18 => 1, + ]; + case 'FileHeaderUnitTest.4.inc': + return [ + 1 => 1, + 2 => 1, + 3 => 1, + 7 => 1, + ]; + case 'FileHeaderUnitTest.5.inc': + return [4 => 1]; + case 'FileHeaderUnitTest.7.inc': + case 'FileHeaderUnitTest.10.inc': + case 'FileHeaderUnitTest.11.inc': + return [1 => 1]; + case 'FileHeaderUnitTest.12.inc': + return [4 => 2]; + default: + return []; } } diff --git a/src/Standards/PSR12/Tests/Files/OpenTagUnitTest.php b/src/Standards/PSR12/Tests/Files/OpenTagUnitTest.php index aac0c20b12..a033ad8b60 100644 --- a/src/Standards/PSR12/Tests/Files/OpenTagUnitTest.php +++ b/src/Standards/PSR12/Tests/Files/OpenTagUnitTest.php @@ -33,10 +33,10 @@ final class OpenTagUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'OpenTagUnitTest.2.inc': - return [1 => 1]; - default: - return []; + case 'OpenTagUnitTest.2.inc': + return [1 => 1]; + default: + return []; } } diff --git a/src/Standards/PSR12/Tests/Operators/OperatorSpacingUnitTest.php b/src/Standards/PSR12/Tests/Operators/OperatorSpacingUnitTest.php index 29a88becfa..8409d4a157 100644 --- a/src/Standards/PSR12/Tests/Operators/OperatorSpacingUnitTest.php +++ b/src/Standards/PSR12/Tests/Operators/OperatorSpacingUnitTest.php @@ -33,31 +33,31 @@ final class OperatorSpacingUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'OperatorSpacingUnitTest.1.inc': - return [ - 2 => 1, - 3 => 2, - 4 => 1, - 5 => 2, - 6 => 4, - 9 => 3, - 10 => 2, - 11 => 3, - 13 => 3, - 14 => 2, - 18 => 1, - 20 => 1, - 22 => 2, - 23 => 2, - 26 => 1, - 37 => 4, - 39 => 1, - 40 => 1, - 44 => 2, - 47 => 2, - ]; - default: - return []; + case 'OperatorSpacingUnitTest.1.inc': + return [ + 2 => 1, + 3 => 2, + 4 => 1, + 5 => 2, + 6 => 4, + 9 => 3, + 10 => 2, + 11 => 3, + 13 => 3, + 14 => 2, + 18 => 1, + 20 => 1, + 22 => 2, + 23 => 2, + 26 => 1, + 37 => 4, + 39 => 1, + 40 => 1, + 44 => 2, + 47 => 2, + ]; + default: + return []; } } diff --git a/src/Standards/PSR12/Tests/Properties/ConstantVisibilityUnitTest.php b/src/Standards/PSR12/Tests/Properties/ConstantVisibilityUnitTest.php index 20a8d92426..c403153e1c 100644 --- a/src/Standards/PSR12/Tests/Properties/ConstantVisibilityUnitTest.php +++ b/src/Standards/PSR12/Tests/Properties/ConstantVisibilityUnitTest.php @@ -47,20 +47,20 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'ConstantVisibilityUnitTest.1.inc': - return [ - 4 => 1, - 12 => 1, - 21 => 1, - ]; + case 'ConstantVisibilityUnitTest.1.inc': + return [ + 4 => 1, + 12 => 1, + 21 => 1, + ]; - case 'ConstantVisibilityUnitTest.2.inc': - return [ - 6 => 1, - ]; + case 'ConstantVisibilityUnitTest.2.inc': + return [ + 6 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/PSR2/Sniffs/Methods/MethodDeclarationSniff.php b/src/Standards/PSR2/Sniffs/Methods/MethodDeclarationSniff.php index 45ad86432b..20db30d8e7 100644 --- a/src/Standards/PSR2/Sniffs/Methods/MethodDeclarationSniff.php +++ b/src/Standards/PSR2/Sniffs/Methods/MethodDeclarationSniff.php @@ -70,18 +70,18 @@ protected function processTokenWithinScope(File $phpcsFile, int $stackPtr, int $ $prefix = $stackPtr; while (($prefix = $phpcsFile->findPrevious(Tokens::METHOD_MODIFIERS, ($prefix - 1), $prev)) !== false) { switch ($tokens[$prefix]['code']) { - case T_STATIC: - $static = $prefix; - break; - case T_ABSTRACT: - $abstract = $prefix; - break; - case T_FINAL: - $final = $prefix; - break; - default: - $visibility = $prefix; - break; + case T_STATIC: + $static = $prefix; + break; + case T_ABSTRACT: + $abstract = $prefix; + break; + case T_FINAL: + $final = $prefix; + break; + default: + $visibility = $prefix; + break; } } diff --git a/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php b/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php index 9f4015fab7..3c7eabce1f 100644 --- a/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php +++ b/src/Standards/PSR2/Sniffs/Namespaces/UseDeclarationSniff.php @@ -66,14 +66,14 @@ public function process(File $phpcsFile, int $stackPtr) $fix = $phpcsFile->addFixableError($error, $stackPtr, 'MultipleDeclarations'); if ($fix === true) { switch ($tokens[($stackPtr + 2)]['content']) { - case 'const': - $baseUse = 'use const'; - break; - case 'function': - $baseUse = 'use function'; - break; - default: - $baseUse = 'use'; + case 'const': + $baseUse = 'use const'; + break; + case 'function': + $baseUse = 'use function'; + break; + default: + $baseUse = 'use'; } if ($tokens[($next + 1)]['code'] !== T_WHITESPACE) { diff --git a/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php b/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php index 4a87a6e66f..e6f39e0c03 100644 --- a/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php +++ b/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php @@ -33,61 +33,61 @@ final class PropertyDeclarationUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'PropertyDeclarationUnitTest.1.inc': - return [ - 7 => 1, - 9 => 2, - 10 => 1, - 11 => 1, - 17 => 1, - 18 => 1, - 23 => 1, - 38 => 1, - 41 => 1, - 42 => 1, - 50 => 2, - 51 => 1, - 55 => 1, - 56 => 1, - 61 => 1, - 62 => 1, - 68 => 1, - 69 => 1, - 71 => 1, - 72 => 1, - 76 => 1, - 80 => 1, - 82 => 1, - 84 => 1, - 86 => 1, - 90 => 1, - 94 => 1, - 95 => 1, - 96 => 1, - 97 => 2, - 106 => 1, - 110 => 1, - 114 => 1, - 116 => 1, - 120 => 3, - 121 => 3, - 122 => 2, - 123 => 3, - 125 => 1, - 126 => 1, - 127 => 2, - 128 => 2, - 130 => 1, - 131 => 1, - 132 => 2, - 137 => 1, - 138 => 1, - 139 => 1, - 140 => 1, - ]; + case 'PropertyDeclarationUnitTest.1.inc': + return [ + 7 => 1, + 9 => 2, + 10 => 1, + 11 => 1, + 17 => 1, + 18 => 1, + 23 => 1, + 38 => 1, + 41 => 1, + 42 => 1, + 50 => 2, + 51 => 1, + 55 => 1, + 56 => 1, + 61 => 1, + 62 => 1, + 68 => 1, + 69 => 1, + 71 => 1, + 72 => 1, + 76 => 1, + 80 => 1, + 82 => 1, + 84 => 1, + 86 => 1, + 90 => 1, + 94 => 1, + 95 => 1, + 96 => 1, + 97 => 2, + 106 => 1, + 110 => 1, + 114 => 1, + 116 => 1, + 120 => 3, + 121 => 3, + 122 => 2, + 123 => 3, + 125 => 1, + 126 => 1, + 127 => 2, + 128 => 2, + 130 => 1, + 131 => 1, + 132 => 2, + 137 => 1, + 138 => 1, + 139 => 1, + 140 => 1, + ]; - default: - return []; + default: + return []; } } @@ -105,17 +105,17 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'PropertyDeclarationUnitTest.1.inc': - return [ - 13 => 1, - 14 => 1, - 15 => 1, - 53 => 1, - 102 => 1, - ]; + case 'PropertyDeclarationUnitTest.1.inc': + return [ + 13 => 1, + 14 => 1, + 15 => 1, + 53 => 1, + 102 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/PSR2/Tests/Files/ClosingTagUnitTest.php b/src/Standards/PSR2/Tests/Files/ClosingTagUnitTest.php index 1ca2a2b004..565e00eddd 100644 --- a/src/Standards/PSR2/Tests/Files/ClosingTagUnitTest.php +++ b/src/Standards/PSR2/Tests/Files/ClosingTagUnitTest.php @@ -33,19 +33,19 @@ final class ClosingTagUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ClosingTagUnitTest.1.inc': - return [11 => 1]; + case 'ClosingTagUnitTest.1.inc': + return [11 => 1]; - case 'ClosingTagUnitTest.4.inc': - case 'ClosingTagUnitTest.5.inc': - return [1 => 1]; + case 'ClosingTagUnitTest.4.inc': + case 'ClosingTagUnitTest.5.inc': + return [1 => 1]; - case 'ClosingTagUnitTest.6.inc': - case 'ClosingTagUnitTest.7.inc': - return [5 => 1]; + case 'ClosingTagUnitTest.6.inc': + case 'ClosingTagUnitTest.7.inc': + return [5 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/PSR2/Tests/Files/EndFileNewlineUnitTest.php b/src/Standards/PSR2/Tests/Files/EndFileNewlineUnitTest.php index fa0851c48c..7a24bd5369 100644 --- a/src/Standards/PSR2/Tests/Files/EndFileNewlineUnitTest.php +++ b/src/Standards/PSR2/Tests/Files/EndFileNewlineUnitTest.php @@ -33,19 +33,19 @@ final class EndFileNewlineUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'EndFileNewlineUnitTest.1.inc': - case 'EndFileNewlineUnitTest.3.inc': - case 'EndFileNewlineUnitTest.6.inc': - case 'EndFileNewlineUnitTest.7.inc': - case 'EndFileNewlineUnitTest.9.inc': - case 'EndFileNewlineUnitTest.10.inc': - return [2 => 1]; - case 'EndFileNewlineUnitTest.11.inc': - case 'EndFileNewlineUnitTest.12.inc': - case 'EndFileNewlineUnitTest.13.inc': - return [1 => 1]; - default: - return []; + case 'EndFileNewlineUnitTest.1.inc': + case 'EndFileNewlineUnitTest.3.inc': + case 'EndFileNewlineUnitTest.6.inc': + case 'EndFileNewlineUnitTest.7.inc': + case 'EndFileNewlineUnitTest.9.inc': + case 'EndFileNewlineUnitTest.10.inc': + return [2 => 1]; + case 'EndFileNewlineUnitTest.11.inc': + case 'EndFileNewlineUnitTest.12.inc': + case 'EndFileNewlineUnitTest.13.inc': + return [1 => 1]; + default: + return []; } } diff --git a/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.php b/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.php index ad8e589f69..7b5a6a9ce9 100644 --- a/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.php +++ b/src/Standards/PSR2/Tests/Methods/MethodDeclarationUnitTest.php @@ -33,27 +33,27 @@ final class MethodDeclarationUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'MethodDeclarationUnitTest.1.inc': - return [ - 9 => 1, - 11 => 1, - 13 => 1, - 15 => 3, - 24 => 1, - 34 => 1, - 36 => 1, - 38 => 1, - 40 => 3, - 50 => 1, - 52 => 1, - 54 => 1, - 56 => 3, - 63 => 2, - 73 => 1, - ]; + case 'MethodDeclarationUnitTest.1.inc': + return [ + 9 => 1, + 11 => 1, + 13 => 1, + 15 => 3, + 24 => 1, + 34 => 1, + 36 => 1, + 38 => 1, + 40 => 3, + 50 => 1, + 52 => 1, + 54 => 1, + 56 => 3, + 63 => 2, + 73 => 1, + ]; - default: - return []; + default: + return []; } } @@ -71,18 +71,18 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'MethodDeclarationUnitTest.1.inc': - return [ - 5 => 1, - 21 => 1, - 30 => 1, - 46 => 1, - 63 => 1, - 70 => 1, - ]; + case 'MethodDeclarationUnitTest.1.inc': + return [ + 5 => 1, + 21 => 1, + 30 => 1, + 46 => 1, + 63 => 1, + 70 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/PSR2/Tests/Namespaces/UseDeclarationUnitTest.php b/src/Standards/PSR2/Tests/Namespaces/UseDeclarationUnitTest.php index 55a6826c9c..99b196bfcf 100644 --- a/src/Standards/PSR2/Tests/Namespaces/UseDeclarationUnitTest.php +++ b/src/Standards/PSR2/Tests/Namespaces/UseDeclarationUnitTest.php @@ -33,52 +33,52 @@ final class UseDeclarationUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'UseDeclarationUnitTest.2.inc': - return [ - 4 => 1, - 5 => 1, - 6 => 1, - 7 => 1, - 9 => 1, - 10 => 1, - 11 => 1, - 16 => 1, - ]; - case 'UseDeclarationUnitTest.3.inc': - return [ - 4 => 1, - 6 => 1, - ]; - case 'UseDeclarationUnitTest.5.inc': - return [ - 5 => 1, - 6 => 1, - 8 => 1, - 14 => 1, - 17 => 1, - 18 => 1, - 19 => 1, - 21 => 1, - 28 => 1, - 30 => 1, - 35 => 1, - ]; - case 'UseDeclarationUnitTest.10.inc': - case 'UseDeclarationUnitTest.11.inc': - case 'UseDeclarationUnitTest.12.inc': - case 'UseDeclarationUnitTest.13.inc': - case 'UseDeclarationUnitTest.14.inc': - case 'UseDeclarationUnitTest.16.inc': - case 'UseDeclarationUnitTest.17.inc': - return [2 => 1]; - case 'UseDeclarationUnitTest.15.inc': - return [ - 3 => 1, - 4 => 1, - 5 => 1, - ]; - default: - return []; + case 'UseDeclarationUnitTest.2.inc': + return [ + 4 => 1, + 5 => 1, + 6 => 1, + 7 => 1, + 9 => 1, + 10 => 1, + 11 => 1, + 16 => 1, + ]; + case 'UseDeclarationUnitTest.3.inc': + return [ + 4 => 1, + 6 => 1, + ]; + case 'UseDeclarationUnitTest.5.inc': + return [ + 5 => 1, + 6 => 1, + 8 => 1, + 14 => 1, + 17 => 1, + 18 => 1, + 19 => 1, + 21 => 1, + 28 => 1, + 30 => 1, + 35 => 1, + ]; + case 'UseDeclarationUnitTest.10.inc': + case 'UseDeclarationUnitTest.11.inc': + case 'UseDeclarationUnitTest.12.inc': + case 'UseDeclarationUnitTest.13.inc': + case 'UseDeclarationUnitTest.14.inc': + case 'UseDeclarationUnitTest.16.inc': + case 'UseDeclarationUnitTest.17.inc': + return [2 => 1]; + case 'UseDeclarationUnitTest.15.inc': + return [ + 3 => 1, + 4 => 1, + 5 => 1, + ]; + default: + return []; } } diff --git a/src/Standards/Squiz/Sniffs/Classes/SelfMemberReferenceSniff.php b/src/Standards/Squiz/Sniffs/Classes/SelfMemberReferenceSniff.php index 18d502e3f0..358b53376a 100644 --- a/src/Standards/Squiz/Sniffs/Classes/SelfMemberReferenceSniff.php +++ b/src/Standards/Squiz/Sniffs/Classes/SelfMemberReferenceSniff.php @@ -86,18 +86,18 @@ protected function processTokenWithinScope(File $phpcsFile, int $stackPtr, int $ $inlineName = ''; switch ($tokens[$calledClassName]['code']) { - case T_NAME_FULLY_QUALIFIED: - $inlineName = $tokens[$calledClassName]['content']; - break; - - case T_NAME_QUALIFIED: - case T_STRING: - $inlineName = $namespaceName . '\\' . $tokens[$calledClassName]['content']; - break; - - case T_NAME_RELATIVE: - $inlineName = $namespaceName . substr($tokens[$calledClassName]['content'], 9); - break; + case T_NAME_FULLY_QUALIFIED: + $inlineName = $tokens[$calledClassName]['content']; + break; + + case T_NAME_QUALIFIED: + case T_STRING: + $inlineName = $namespaceName . '\\' . $tokens[$calledClassName]['content']; + break; + + case T_NAME_RELATIVE: + $inlineName = $namespaceName . substr($tokens[$calledClassName]['content'], 9); + break; } if ($declarationName === $inlineName) { diff --git a/src/Standards/Squiz/Tests/Arrays/ArrayDeclarationUnitTest.php b/src/Standards/Squiz/Tests/Arrays/ArrayDeclarationUnitTest.php index 0742574146..48c6adc341 100644 --- a/src/Standards/Squiz/Tests/Arrays/ArrayDeclarationUnitTest.php +++ b/src/Standards/Squiz/Tests/Arrays/ArrayDeclarationUnitTest.php @@ -33,212 +33,212 @@ final class ArrayDeclarationUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ArrayDeclarationUnitTest.1.inc': - return [ - 2 => 1, - 8 => 2, - 10 => 2, - 22 => 1, - 23 => 2, - 24 => 2, - 25 => 1, - 31 => 2, - 35 => 1, - 36 => 2, - 41 => 1, - 46 => 1, - 47 => 1, - 50 => 1, - 51 => 1, - 53 => 1, - 56 => 1, - 58 => 1, - 61 => 1, - 62 => 1, - 63 => 1, - 64 => 1, - 65 => 1, - 66 => 3, - 70 => 1, - 76 => 2, - 77 => 1, - 78 => 7, - 79 => 2, - 81 => 2, - 82 => 4, - 87 => 1, - 88 => 1, - 92 => 1, - 97 => 1, - 100 => 1, - 101 => 1, - 102 => 1, - 105 => 1, - 106 => 1, - 107 => 1, - 125 => 1, - 126 => 1, - 141 => 1, - 144 => 1, - 146 => 1, - 148 => 1, - 151 => 1, - 157 => 1, - 173 => 1, - 174 => 3, - 179 => 1, - 182 => 1, - 188 => 1, - 207 => 1, - 212 => 2, - 214 => 1, - 218 => 2, - 219 => 2, - 223 => 1, - 255 => 1, - 294 => 1, - 295 => 1, - 296 => 1, - 311 => 1, - 317 => 1, - 339 => 2, - 348 => 2, - 352 => 2, - 355 => 3, - 358 => 3, - 359 => 2, - 360 => 1, - 362 => 1, - 363 => 2, - 364 => 1, - 365 => 2, - 366 => 2, - 367 => 2, - 368 => 2, - 369 => 1, - 370 => 1, - 383 => 1, - 394 => 1, - 400 => 1, - 406 => 1, - 441 => 1, - 444 => 2, - 445 => 2, - 447 => 2, - 448 => 3, - 467 => 1, - 471 => 1, - 472 => 1, - 510 => 1, - 516 => 1, - 523 => 1, - 530 => 1, - 537 => 1, - 540 => 1, - 547 => 2, - 552 => 1, - 557 => 1, - ]; - case 'ArrayDeclarationUnitTest.2.inc': - return [ - 2 => 1, - 10 => 1, - 23 => 2, - 24 => 2, - 25 => 1, - 31 => 2, - 36 => 2, - 41 => 1, - 46 => 1, - 47 => 1, - 51 => 1, - 53 => 1, - 56 => 1, - 61 => 1, - 63 => 1, - 64 => 1, - 65 => 1, - 66 => 2, - 70 => 1, - 76 => 1, - 77 => 1, - 78 => 7, - 79 => 2, - 81 => 2, - 82 => 4, - 87 => 1, - 88 => 1, - 92 => 1, - 97 => 1, - 100 => 1, - 101 => 1, - 102 => 1, - 105 => 1, - 106 => 1, - 107 => 1, - 125 => 1, - 126 => 1, - 141 => 1, - 144 => 1, - 146 => 1, - 148 => 1, - 151 => 1, - 157 => 1, - 173 => 1, - 174 => 3, - 179 => 1, - 190 => 1, - 191 => 1, - 192 => 1, - 207 => 1, - 210 => 1, - 211 => 1, - 215 => 1, - 247 => 1, - 286 => 1, - 287 => 1, - 288 => 1, - 303 => 1, - 309 => 1, - 331 => 2, - 345 => 3, - 348 => 3, - 349 => 2, - 350 => 1, - 352 => 2, - 353 => 2, - 354 => 2, - 355 => 2, - 356 => 2, - 357 => 1, - 358 => 1, - 372 => 1, - 383 => 1, - 389 => 1, - 395 => 1, - 430 => 1, - 433 => 2, - 434 => 2, - 436 => 2, - 437 => 3, - 456 => 1, - 460 => 1, - 461 => 1, - 499 => 1, - 505 => 1, - 512 => 1, - 519 => 1, - 526 => 1, - 529 => 1, - 536 => 2, - 541 => 1, - 546 => 1, - 555 => 2, - ]; - case 'ArrayDeclarationUnitTest.4.inc': - return [8 => 1]; - default: - return []; + case 'ArrayDeclarationUnitTest.1.inc': + return [ + 2 => 1, + 8 => 2, + 10 => 2, + 22 => 1, + 23 => 2, + 24 => 2, + 25 => 1, + 31 => 2, + 35 => 1, + 36 => 2, + 41 => 1, + 46 => 1, + 47 => 1, + 50 => 1, + 51 => 1, + 53 => 1, + 56 => 1, + 58 => 1, + 61 => 1, + 62 => 1, + 63 => 1, + 64 => 1, + 65 => 1, + 66 => 3, + 70 => 1, + 76 => 2, + 77 => 1, + 78 => 7, + 79 => 2, + 81 => 2, + 82 => 4, + 87 => 1, + 88 => 1, + 92 => 1, + 97 => 1, + 100 => 1, + 101 => 1, + 102 => 1, + 105 => 1, + 106 => 1, + 107 => 1, + 125 => 1, + 126 => 1, + 141 => 1, + 144 => 1, + 146 => 1, + 148 => 1, + 151 => 1, + 157 => 1, + 173 => 1, + 174 => 3, + 179 => 1, + 182 => 1, + 188 => 1, + 207 => 1, + 212 => 2, + 214 => 1, + 218 => 2, + 219 => 2, + 223 => 1, + 255 => 1, + 294 => 1, + 295 => 1, + 296 => 1, + 311 => 1, + 317 => 1, + 339 => 2, + 348 => 2, + 352 => 2, + 355 => 3, + 358 => 3, + 359 => 2, + 360 => 1, + 362 => 1, + 363 => 2, + 364 => 1, + 365 => 2, + 366 => 2, + 367 => 2, + 368 => 2, + 369 => 1, + 370 => 1, + 383 => 1, + 394 => 1, + 400 => 1, + 406 => 1, + 441 => 1, + 444 => 2, + 445 => 2, + 447 => 2, + 448 => 3, + 467 => 1, + 471 => 1, + 472 => 1, + 510 => 1, + 516 => 1, + 523 => 1, + 530 => 1, + 537 => 1, + 540 => 1, + 547 => 2, + 552 => 1, + 557 => 1, + ]; + case 'ArrayDeclarationUnitTest.2.inc': + return [ + 2 => 1, + 10 => 1, + 23 => 2, + 24 => 2, + 25 => 1, + 31 => 2, + 36 => 2, + 41 => 1, + 46 => 1, + 47 => 1, + 51 => 1, + 53 => 1, + 56 => 1, + 61 => 1, + 63 => 1, + 64 => 1, + 65 => 1, + 66 => 2, + 70 => 1, + 76 => 1, + 77 => 1, + 78 => 7, + 79 => 2, + 81 => 2, + 82 => 4, + 87 => 1, + 88 => 1, + 92 => 1, + 97 => 1, + 100 => 1, + 101 => 1, + 102 => 1, + 105 => 1, + 106 => 1, + 107 => 1, + 125 => 1, + 126 => 1, + 141 => 1, + 144 => 1, + 146 => 1, + 148 => 1, + 151 => 1, + 157 => 1, + 173 => 1, + 174 => 3, + 179 => 1, + 190 => 1, + 191 => 1, + 192 => 1, + 207 => 1, + 210 => 1, + 211 => 1, + 215 => 1, + 247 => 1, + 286 => 1, + 287 => 1, + 288 => 1, + 303 => 1, + 309 => 1, + 331 => 2, + 345 => 3, + 348 => 3, + 349 => 2, + 350 => 1, + 352 => 2, + 353 => 2, + 354 => 2, + 355 => 2, + 356 => 2, + 357 => 1, + 358 => 1, + 372 => 1, + 383 => 1, + 389 => 1, + 395 => 1, + 430 => 1, + 433 => 2, + 434 => 2, + 436 => 2, + 437 => 3, + 456 => 1, + 460 => 1, + 461 => 1, + 499 => 1, + 505 => 1, + 512 => 1, + 519 => 1, + 526 => 1, + 529 => 1, + 536 => 2, + 541 => 1, + 546 => 1, + 555 => 2, + ]; + case 'ArrayDeclarationUnitTest.4.inc': + return [8 => 1]; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.php b/src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.php index b4a5bf7962..0a7f9f562a 100644 --- a/src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.php +++ b/src/Standards/Squiz/Tests/Classes/ClassFileNameUnitTest.php @@ -73,55 +73,55 @@ protected function getTestFiles(string $testFileBase) public function getErrorList($testFile = '') { switch ($testFile) { - case 'ClassFileNameUnitTest.inc': - return [ - 12 => 1, - 13 => 1, - 14 => 1, - 15 => 1, - 16 => 1, - 17 => 1, - 18 => 1, - 19 => 1, - 20 => 1, - 21 => 1, - 22 => 1, - 23 => 1, - 27 => 1, - 28 => 1, - 29 => 1, - 30 => 1, - 31 => 1, - 32 => 1, - 33 => 1, - 34 => 1, - 35 => 1, - 36 => 1, - 37 => 1, - 38 => 1, - 39 => 1, - 40 => 1, - 41 => 1, - 42 => 1, - ]; - - case 'ClassFileNameLiveCodingFailUnitTest.inc': - return [ - 6 => 1, - ]; - - case 'ClassFileName Spaces In FilenameUnitTest.inc': - return [ - 7 => 1, - ]; - - case 'ClassFileName-Dashes-In-FilenameUnitTest.inc': - return [ - 7 => 1, - ]; - - default: - return []; + case 'ClassFileNameUnitTest.inc': + return [ + 12 => 1, + 13 => 1, + 14 => 1, + 15 => 1, + 16 => 1, + 17 => 1, + 18 => 1, + 19 => 1, + 20 => 1, + 21 => 1, + 22 => 1, + 23 => 1, + 27 => 1, + 28 => 1, + 29 => 1, + 30 => 1, + 31 => 1, + 32 => 1, + 33 => 1, + 34 => 1, + 35 => 1, + 36 => 1, + 37 => 1, + 38 => 1, + 39 => 1, + 40 => 1, + 41 => 1, + 42 => 1, + ]; + + case 'ClassFileNameLiveCodingFailUnitTest.inc': + return [ + 6 => 1, + ]; + + case 'ClassFileName Spaces In FilenameUnitTest.inc': + return [ + 7 => 1, + ]; + + case 'ClassFileName-Dashes-In-FilenameUnitTest.inc': + return [ + 7 => 1, + ]; + + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Commenting/ClassCommentUnitTest.php b/src/Standards/Squiz/Tests/Commenting/ClassCommentUnitTest.php index 0f6e76abc5..a543a38078 100644 --- a/src/Standards/Squiz/Tests/Commenting/ClassCommentUnitTest.php +++ b/src/Standards/Squiz/Tests/Commenting/ClassCommentUnitTest.php @@ -33,23 +33,23 @@ final class ClassCommentUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ClassCommentUnitTest.1.inc': - return [ - 2 => 1, - 15 => 1, - 31 => 1, - 54 => 1, - 143 => 1, - 145 => 1, - ]; + case 'ClassCommentUnitTest.1.inc': + return [ + 2 => 1, + 15 => 1, + 31 => 1, + 54 => 1, + 143 => 1, + 145 => 1, + ]; - case 'ClassCommentUnitTest.2.inc': - return [ - 7 => 1, - ]; + case 'ClassCommentUnitTest.2.inc': + return [ + 7 => 1, + ]; - default: - return []; + default: + return []; } } @@ -67,17 +67,17 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'ClassCommentUnitTest.1.inc': - return [ - 29 => 1, - 30 => 1, - 50 => 1, - 66 => 1, - 67 => 1, - ]; + case 'ClassCommentUnitTest.1.inc': + return [ + 29 => 1, + 30 => 1, + 50 => 1, + 66 => 1, + 67 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.php b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.php index 8aee10cc88..4f7b73df6e 100644 --- a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.php +++ b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.php @@ -33,34 +33,34 @@ final class ClosingDeclarationCommentUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ClosingDeclarationCommentUnitTest.1.inc': - return [ - 13 => 1, - 17 => 1, - 31 => 1, - 41 => 1, - 59 => 1, - 63 => 1, - 67 => 1, - 79 => 1, - 83 => 1, - 89 => 1, - 92 => 1, - 98 => 1, - 101 => 1, - 106 => 1, - 110 => 1, - 124 => 1, - ]; + case 'ClosingDeclarationCommentUnitTest.1.inc': + return [ + 13 => 1, + 17 => 1, + 31 => 1, + 41 => 1, + 59 => 1, + 63 => 1, + 67 => 1, + 79 => 1, + 83 => 1, + 89 => 1, + 92 => 1, + 98 => 1, + 101 => 1, + 106 => 1, + 110 => 1, + 124 => 1, + ]; - case 'ClosingDeclarationCommentUnitTest.4.inc': - return [8 => 1]; + case 'ClosingDeclarationCommentUnitTest.4.inc': + return [8 => 1]; - case 'ClosingDeclarationCommentUnitTest.5.inc': - return [11 => 1]; + case 'ClosingDeclarationCommentUnitTest.5.inc': + return [11 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.php b/src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.php index 0e241d8043..1f3c02b681 100644 --- a/src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.php +++ b/src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.php @@ -33,31 +33,31 @@ final class FileCommentUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FileCommentUnitTest.1.inc': - return [ - 1 => 1, - 22 => 2, - 23 => 1, - 24 => 2, - 25 => 2, - 26 => 1, - 27 => 2, - 28 => 2, - 32 => 2, - ]; + case 'FileCommentUnitTest.1.inc': + return [ + 1 => 1, + 22 => 2, + 23 => 1, + 24 => 2, + 25 => 2, + 26 => 1, + 27 => 2, + 28 => 2, + 32 => 2, + ]; - case 'FileCommentUnitTest.4.inc': - case 'FileCommentUnitTest.6.inc': - case 'FileCommentUnitTest.7.inc': - case 'FileCommentUnitTest.9.inc': - case 'FileCommentUnitTest.10.inc': - return [1 => 1]; + case 'FileCommentUnitTest.4.inc': + case 'FileCommentUnitTest.6.inc': + case 'FileCommentUnitTest.7.inc': + case 'FileCommentUnitTest.9.inc': + case 'FileCommentUnitTest.10.inc': + return [1 => 1]; - case 'FileCommentUnitTest.5.inc': - return [2 => 1]; + case 'FileCommentUnitTest.5.inc': + return [2 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php b/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php index 146da86859..094f090f21 100644 --- a/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php +++ b/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php @@ -33,155 +33,155 @@ final class FunctionCommentUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FunctionCommentUnitTest.1.inc': - $errors = [ - 5 => 1, - 10 => 3, - 12 => 2, - 13 => 2, - 14 => 1, - 15 => 1, - 17 => 3, - 28 => 1, - 43 => 1, - 76 => 1, - 87 => 1, - 103 => 1, - 109 => 1, - 112 => 1, - 122 => 1, - 123 => 3, - 124 => 2, - 125 => 1, - 126 => 1, - 128 => 1, - 137 => 4, - 138 => 4, - 139 => 4, - 143 => 3, - 155 => 1, - 159 => 1, - 161 => 2, - 166 => 1, - 173 => 1, - 183 => 1, - 190 => 2, - 193 => 2, - 196 => 1, - 199 => 2, - 201 => 1, - 210 => 1, - 211 => 1, - 222 => 1, - 223 => 1, - 224 => 1, - 225 => 1, - 226 => 1, - 227 => 1, - 230 => 2, - 232 => 7, - 246 => 1, - 248 => 4, - 261 => 1, - 263 => 1, - 276 => 1, - 277 => 1, - 278 => 1, - 279 => 1, - 280 => 1, - 281 => 1, - 284 => 1, - 286 => 7, - 294 => 1, - 302 => 1, - 312 => 1, - 358 => 1, - 359 => 2, - 363 => 3, - 372 => 1, - 373 => 1, - 377 => 1, - 387 => 1, - 407 => 1, - 441 => 1, - 500 => 1, - 526 => 1, - 548 => 1, - 575 => 2, - 627 => 2, - 641 => 1, - 669 => 1, - 688 => 1, - 744 => 1, - 748 => 1, - 767 => 1, - 789 => 1, - 792 => 1, - 794 => 1, - 797 => 1, - 828 => 1, - 840 => 1, - 852 => 1, - 864 => 1, - 886 => 1, - 888 => 1, - 890 => 1, - 978 => 1, - 997 => 1, - 1002 => 1, - 1004 => 2, - 1006 => 1, - 1029 => 1, - 1053 => 1, - 1058 => 2, - 1069 => 1, - 1070 => 1, - 1071 => 1, - 1075 => 6, - 1080 => 2, - 1083 => 1, - 1084 => 1, - 1085 => 1, - 1089 => 3, - 1093 => 4, - 1100 => 1, - 1101 => 1, - 1102 => 1, - 1103 => 1, - 1107 => 8, - 1123 => 1, - 1124 => 1, - 1125 => 1, - 1129 => 3, - 1138 => 1, - 1139 => 1, - 1144 => 1, - 1145 => 1, - 1151 => 1, - 1154 => 1, - 1160 => 1, - 1174 => 1, - 1183 => 1, - 1192 => 1, - ]; + case 'FunctionCommentUnitTest.1.inc': + $errors = [ + 5 => 1, + 10 => 3, + 12 => 2, + 13 => 2, + 14 => 1, + 15 => 1, + 17 => 3, + 28 => 1, + 43 => 1, + 76 => 1, + 87 => 1, + 103 => 1, + 109 => 1, + 112 => 1, + 122 => 1, + 123 => 3, + 124 => 2, + 125 => 1, + 126 => 1, + 128 => 1, + 137 => 4, + 138 => 4, + 139 => 4, + 143 => 3, + 155 => 1, + 159 => 1, + 161 => 2, + 166 => 1, + 173 => 1, + 183 => 1, + 190 => 2, + 193 => 2, + 196 => 1, + 199 => 2, + 201 => 1, + 210 => 1, + 211 => 1, + 222 => 1, + 223 => 1, + 224 => 1, + 225 => 1, + 226 => 1, + 227 => 1, + 230 => 2, + 232 => 7, + 246 => 1, + 248 => 4, + 261 => 1, + 263 => 1, + 276 => 1, + 277 => 1, + 278 => 1, + 279 => 1, + 280 => 1, + 281 => 1, + 284 => 1, + 286 => 7, + 294 => 1, + 302 => 1, + 312 => 1, + 358 => 1, + 359 => 2, + 363 => 3, + 372 => 1, + 373 => 1, + 377 => 1, + 387 => 1, + 407 => 1, + 441 => 1, + 500 => 1, + 526 => 1, + 548 => 1, + 575 => 2, + 627 => 2, + 641 => 1, + 669 => 1, + 688 => 1, + 744 => 1, + 748 => 1, + 767 => 1, + 789 => 1, + 792 => 1, + 794 => 1, + 797 => 1, + 828 => 1, + 840 => 1, + 852 => 1, + 864 => 1, + 886 => 1, + 888 => 1, + 890 => 1, + 978 => 1, + 997 => 1, + 1002 => 1, + 1004 => 2, + 1006 => 1, + 1029 => 1, + 1053 => 1, + 1058 => 2, + 1069 => 1, + 1070 => 1, + 1071 => 1, + 1075 => 6, + 1080 => 2, + 1083 => 1, + 1084 => 1, + 1085 => 1, + 1089 => 3, + 1093 => 4, + 1100 => 1, + 1101 => 1, + 1102 => 1, + 1103 => 1, + 1107 => 8, + 1123 => 1, + 1124 => 1, + 1125 => 1, + 1129 => 3, + 1138 => 1, + 1139 => 1, + 1144 => 1, + 1145 => 1, + 1151 => 1, + 1154 => 1, + 1160 => 1, + 1174 => 1, + 1183 => 1, + 1192 => 1, + ]; - // Mixed type hints only work from PHP 8.0 onwards. - if (PHP_VERSION_ID >= 80000) { - $errors[265] = 1; - $errors[459] = 1; - $errors[893] = 3; - } else { - $errors[1023] = 1; - } - return $errors; + // Mixed type hints only work from PHP 8.0 onwards. + if (PHP_VERSION_ID >= 80000) { + $errors[265] = 1; + $errors[459] = 1; + $errors[893] = 3; + } else { + $errors[1023] = 1; + } + return $errors; - case 'FunctionCommentUnitTest.2.inc': - return [ - 8 => 1, - ]; + case 'FunctionCommentUnitTest.2.inc': + return [ + 8 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/ControlStructures/ControlSignatureUnitTest.php b/src/Standards/Squiz/Tests/ControlStructures/ControlSignatureUnitTest.php index ca83e0b232..e9a1f4b5d9 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ControlSignatureUnitTest.php +++ b/src/Standards/Squiz/Tests/ControlStructures/ControlSignatureUnitTest.php @@ -34,60 +34,60 @@ public function getErrorList($testFile = '') { switch ($testFile) { - case 'ControlSignatureUnitTest.1.inc': - return [ - 7 => 1, - 12 => 1, - 15 => 1, - 18 => 1, - 20 => 1, - 22 => 2, - 28 => 2, - 32 => 1, - 38 => 2, - 42 => 1, - 48 => 2, - 52 => 1, - 62 => 2, - 66 => 2, - 76 => 4, - 80 => 2, - 94 => 1, - 99 => 1, - 108 => 1, - 112 => 1, - 122 => 1, - 130 => 2, - 134 => 1, - 150 => 1, - 153 => 1, - 158 => 1, - 165 => 1, - 170 => 2, - 185 => 1, - 190 => 2, - 191 => 2, - 195 => 1, - 227 => 1, - 234 => 1, - 239 => 2, - 243 => 2, - 244 => 2, - 248 => 1, - 259 => 1, - 262 => 1, - 267 => 1, - 269 => 1, - 276 => 1, - 279 => 1, - 283 => 1, - 306 => 3, - 309 => 1, - 315 => 1, - ]; + case 'ControlSignatureUnitTest.1.inc': + return [ + 7 => 1, + 12 => 1, + 15 => 1, + 18 => 1, + 20 => 1, + 22 => 2, + 28 => 2, + 32 => 1, + 38 => 2, + 42 => 1, + 48 => 2, + 52 => 1, + 62 => 2, + 66 => 2, + 76 => 4, + 80 => 2, + 94 => 1, + 99 => 1, + 108 => 1, + 112 => 1, + 122 => 1, + 130 => 2, + 134 => 1, + 150 => 1, + 153 => 1, + 158 => 1, + 165 => 1, + 170 => 2, + 185 => 1, + 190 => 2, + 191 => 2, + 195 => 1, + 227 => 1, + 234 => 1, + 239 => 2, + 243 => 2, + 244 => 2, + 248 => 1, + 259 => 1, + 262 => 1, + 267 => 1, + 269 => 1, + 276 => 1, + 279 => 1, + 283 => 1, + 306 => 3, + 309 => 1, + 315 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php index eb26c3d894..d28c30dde0 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php @@ -33,42 +33,42 @@ final class ForLoopDeclarationUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ForLoopDeclarationUnitTest.1.inc': - return [ - 8 => 2, - 11 => 2, - 14 => 2, - 17 => 2, - 21 => 6, - 27 => 1, - 30 => 1, - 37 => 2, - 39 => 2, - 43 => 1, - 49 => 1, - 50 => 1, - 53 => 1, - 54 => 1, - 59 => 4, - 62 => 1, - 63 => 1, - 64 => 1, - 66 => 1, - 69 => 1, - 74 => 1, - 77 => 1, - 82 => 2, - 86 => 2, - 91 => 1, - 95 => 1, - 101 => 2, - 105 => 2, - 110 => 1, - 116 => 2, - ]; + case 'ForLoopDeclarationUnitTest.1.inc': + return [ + 8 => 2, + 11 => 2, + 14 => 2, + 17 => 2, + 21 => 6, + 27 => 1, + 30 => 1, + 37 => 2, + 39 => 2, + 43 => 1, + 49 => 1, + 50 => 1, + 53 => 1, + 54 => 1, + 59 => 4, + 62 => 1, + 63 => 1, + 64 => 1, + 66 => 1, + 69 => 1, + 74 => 1, + 77 => 1, + 82 => 2, + 86 => 2, + 91 => 1, + 95 => 1, + 101 => 2, + 105 => 2, + 110 => 1, + 116 => 2, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Files/FileExtensionUnitTest.php b/src/Standards/Squiz/Tests/Files/FileExtensionUnitTest.php index 29a2363a95..986da09c46 100644 --- a/src/Standards/Squiz/Tests/Files/FileExtensionUnitTest.php +++ b/src/Standards/Squiz/Tests/Files/FileExtensionUnitTest.php @@ -33,10 +33,10 @@ final class FileExtensionUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FileExtensionUnitTest.1.inc': - return [1 => 1]; - default: - return []; + case 'FileExtensionUnitTest.1.inc': + return [1 => 1]; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.php b/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.php index 746ab5c661..01d09ce383 100644 --- a/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.php +++ b/src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.php @@ -33,54 +33,54 @@ final class OperatorBracketUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'OperatorBracketUnitTest.1.inc': - return [ - 3 => 1, - 6 => 1, - 9 => 1, - 12 => 1, - 15 => 1, - 18 => 2, - 20 => 1, - 25 => 1, - 28 => 1, - 31 => 1, - 34 => 1, - 37 => 1, - 40 => 1, - 43 => 2, - 45 => 1, - 47 => 5, - 48 => 1, - 50 => 2, - 55 => 2, - 56 => 1, - 63 => 2, - 64 => 1, - 67 => 1, - 86 => 1, - 90 => 1, - 109 => 1, - 130 => 1, - 134 => 1, - 135 => 2, - 137 => 1, - 139 => 1, - 150 => 1, - 161 => 1, - 163 => 2, - 165 => 2, - 169 => 1, - 174 => 1, - 176 => 1, - 185 => 1, - 189 => 1, - 193 => 1, - 194 => 2, - ]; + case 'OperatorBracketUnitTest.1.inc': + return [ + 3 => 1, + 6 => 1, + 9 => 1, + 12 => 1, + 15 => 1, + 18 => 2, + 20 => 1, + 25 => 1, + 28 => 1, + 31 => 1, + 34 => 1, + 37 => 1, + 40 => 1, + 43 => 2, + 45 => 1, + 47 => 5, + 48 => 1, + 50 => 2, + 55 => 2, + 56 => 1, + 63 => 2, + 64 => 1, + 67 => 1, + 86 => 1, + 90 => 1, + 109 => 1, + 130 => 1, + 134 => 1, + 135 => 2, + 137 => 1, + 139 => 1, + 150 => 1, + 161 => 1, + 163 => 2, + 165 => 2, + 169 => 1, + 174 => 1, + 176 => 1, + 185 => 1, + 189 => 1, + 193 => 1, + 194 => 2, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.php b/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.php index 680f8df4e9..f9dc9b1a00 100644 --- a/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.php +++ b/src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.php @@ -33,78 +33,78 @@ final class FunctionDeclarationArgumentSpacingUnitTest extends AbstractSniffTest public function getErrorList($testFile = '') { switch ($testFile) { - case 'FunctionDeclarationArgumentSpacingUnitTest.1.inc': - return [ - 3 => 1, - 5 => 2, - 7 => 2, - 8 => 2, - 9 => 2, - 11 => 2, - 13 => 7, - 14 => 2, - 15 => 2, - 16 => 4, - 18 => 2, - 35 => 2, - 36 => 2, - 44 => 2, - 45 => 1, - 46 => 1, - 51 => 2, - 53 => 2, - 55 => 1, - 56 => 1, - 58 => 1, - 73 => 7, - 76 => 1, - 77 => 1, - 81 => 1, - 89 => 2, - 92 => 1, - 93 => 1, - 94 => 1, - 95 => 1, - 99 => 11, - 100 => 2, - 101 => 2, - 102 => 2, - 103 => 1, - 106 => 1, - 107 => 2, - 111 => 3, - 113 => 1, - 117 => 1, - 123 => 1, - 129 => 1, - 135 => 1, - 141 => 1, - 149 => 2, - 155 => 2, - 163 => 2, - 174 => 2, - 182 => 1, - 185 => 1, - 191 => 1, - 193 => 1, - 195 => 1, - 196 => 1, - 200 => 2, - 205 => 1, - 206 => 1, - 207 => 2, - 208 => 1, - 209 => 1, - 215 => 2, - 220 => 1, - 221 => 1, - 222 => 2, - 223 => 1, - 224 => 1, - ]; + case 'FunctionDeclarationArgumentSpacingUnitTest.1.inc': + return [ + 3 => 1, + 5 => 2, + 7 => 2, + 8 => 2, + 9 => 2, + 11 => 2, + 13 => 7, + 14 => 2, + 15 => 2, + 16 => 4, + 18 => 2, + 35 => 2, + 36 => 2, + 44 => 2, + 45 => 1, + 46 => 1, + 51 => 2, + 53 => 2, + 55 => 1, + 56 => 1, + 58 => 1, + 73 => 7, + 76 => 1, + 77 => 1, + 81 => 1, + 89 => 2, + 92 => 1, + 93 => 1, + 94 => 1, + 95 => 1, + 99 => 11, + 100 => 2, + 101 => 2, + 102 => 2, + 103 => 1, + 106 => 1, + 107 => 2, + 111 => 3, + 113 => 1, + 117 => 1, + 123 => 1, + 129 => 1, + 135 => 1, + 141 => 1, + 149 => 2, + 155 => 2, + 163 => 2, + 174 => 2, + 182 => 1, + 185 => 1, + 191 => 1, + 193 => 1, + 195 => 1, + 196 => 1, + 200 => 2, + 205 => 1, + 206 => 1, + 207 => 2, + 208 => 1, + 209 => 1, + 215 => 2, + 220 => 1, + 221 => 1, + 222 => 2, + 223 => 1, + 224 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Functions/FunctionDeclarationUnitTest.php b/src/Standards/Squiz/Tests/Functions/FunctionDeclarationUnitTest.php index 075290bdc2..63c8e01795 100644 --- a/src/Standards/Squiz/Tests/Functions/FunctionDeclarationUnitTest.php +++ b/src/Standards/Squiz/Tests/Functions/FunctionDeclarationUnitTest.php @@ -33,14 +33,14 @@ final class FunctionDeclarationUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FunctionDeclarationUnitTest.1.inc': - return [ - 55 => 1, - 68 => 1, - ]; - - default: - return []; + case 'FunctionDeclarationUnitTest.1.inc': + return [ + 55 => 1, + 68 => 1, + ]; + + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Functions/GlobalFunctionUnitTest.php b/src/Standards/Squiz/Tests/Functions/GlobalFunctionUnitTest.php index b6d3b0db10..9662d95d57 100644 --- a/src/Standards/Squiz/Tests/Functions/GlobalFunctionUnitTest.php +++ b/src/Standards/Squiz/Tests/Functions/GlobalFunctionUnitTest.php @@ -47,11 +47,11 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'GlobalFunctionUnitTest.1.inc': - return [2 => 1]; + case 'GlobalFunctionUnitTest.1.inc': + return [2 => 1]; - default: - return []; + default: + return []; } } } diff --git a/src/Standards/Squiz/Tests/NamingConventions/ValidFunctionNameUnitTest.php b/src/Standards/Squiz/Tests/NamingConventions/ValidFunctionNameUnitTest.php index a62598012c..4121a826cb 100644 --- a/src/Standards/Squiz/Tests/NamingConventions/ValidFunctionNameUnitTest.php +++ b/src/Standards/Squiz/Tests/NamingConventions/ValidFunctionNameUnitTest.php @@ -33,22 +33,22 @@ final class ValidFunctionNameUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ValidFunctionNameUnitTest.1.inc': - return [ - 4 => 1, - 5 => 1, - 6 => 1, - 7 => 1, - 8 => 1, - 9 => 1, - 11 => 1, - 12 => 1, - 13 => 1, - 14 => 2, - ]; + case 'ValidFunctionNameUnitTest.1.inc': + return [ + 4 => 1, + 5 => 1, + 6 => 1, + 7 => 1, + 8 => 1, + 9 => 1, + 11 => 1, + 12 => 1, + 13 => 1, + 14 => 2, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/NamingConventions/ValidVariableNameUnitTest.php b/src/Standards/Squiz/Tests/NamingConventions/ValidVariableNameUnitTest.php index 5c216bfb28..ca5b424797 100644 --- a/src/Standards/Squiz/Tests/NamingConventions/ValidVariableNameUnitTest.php +++ b/src/Standards/Squiz/Tests/NamingConventions/ValidVariableNameUnitTest.php @@ -33,53 +33,53 @@ final class ValidVariableNameUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ValidVariableNameUnitTest.1.inc': - return [ - 3 => 1, - 5 => 1, - 10 => 1, - 12 => 1, - 15 => 1, - 17 => 1, - 20 => 1, - 22 => 1, - 25 => 1, - 27 => 1, - 31 => 1, - 33 => 1, - 36 => 1, - 37 => 1, - 39 => 1, - 42 => 1, - 44 => 1, - 53 => 1, - 58 => 1, - 62 => 1, - 63 => 1, - 64 => 1, - 67 => 1, - 81 => 1, - 106 => 1, - 107 => 2, - 108 => 1, - 111 => 1, - 112 => 1, - 113 => 1, - 114 => 1, - 123 => 1, - 138 => 1, - 141 => 1, - 146 => 1, - 152 => 1, - 155 => 1, - 161 => 1, - 167 => 1, - 170 => 1, - 175 => 1, - ]; + case 'ValidVariableNameUnitTest.1.inc': + return [ + 3 => 1, + 5 => 1, + 10 => 1, + 12 => 1, + 15 => 1, + 17 => 1, + 20 => 1, + 22 => 1, + 25 => 1, + 27 => 1, + 31 => 1, + 33 => 1, + 36 => 1, + 37 => 1, + 39 => 1, + 42 => 1, + 44 => 1, + 53 => 1, + 58 => 1, + 62 => 1, + 63 => 1, + 64 => 1, + 67 => 1, + 81 => 1, + 106 => 1, + 107 => 2, + 108 => 1, + 111 => 1, + 112 => 1, + 113 => 1, + 114 => 1, + 123 => 1, + 138 => 1, + 141 => 1, + 146 => 1, + 152 => 1, + 155 => 1, + 161 => 1, + 167 => 1, + 170 => 1, + 175 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/PHP/DisallowMultipleAssignmentsUnitTest.php b/src/Standards/Squiz/Tests/PHP/DisallowMultipleAssignmentsUnitTest.php index f43f035a9d..149bf8f3be 100644 --- a/src/Standards/Squiz/Tests/PHP/DisallowMultipleAssignmentsUnitTest.php +++ b/src/Standards/Squiz/Tests/PHP/DisallowMultipleAssignmentsUnitTest.php @@ -33,21 +33,21 @@ final class DisallowMultipleAssignmentsUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'DisallowMultipleAssignmentsUnitTest.1.inc': - return [ - 4 => 1, - 5 => 2, - 7 => 1, - 9 => 1, - 12 => 1, - 14 => 1, - 15 => 1, - 79 => 1, - 85 => 1, - ]; + case 'DisallowMultipleAssignmentsUnitTest.1.inc': + return [ + 4 => 1, + 5 => 2, + 7 => 1, + 9 => 1, + 12 => 1, + 14 => 1, + 15 => 1, + 79 => 1, + 85 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/PHP/EmbeddedPhpUnitTest.php b/src/Standards/Squiz/Tests/PHP/EmbeddedPhpUnitTest.php index da2938fe7e..736c18fe0a 100644 --- a/src/Standards/Squiz/Tests/PHP/EmbeddedPhpUnitTest.php +++ b/src/Standards/Squiz/Tests/PHP/EmbeddedPhpUnitTest.php @@ -33,191 +33,191 @@ final class EmbeddedPhpUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'EmbeddedPhpUnitTest.1.inc': - return [ - 7 => 1, - 12 => 1, - 18 => 1, - 19 => 2, - 20 => 1, - 21 => 1, - 22 => 3, - 24 => 1, - 26 => 1, - 29 => 1, - 30 => 1, - 31 => 1, - 34 => 1, - 36 => 1, - 40 => 1, - 41 => 1, - 44 => 1, - 45 => 1, - 49 => 1, - 59 => 1, - 63 => 1, - 93 => 1, - 94 => 2, - 100 => 1, - 102 => 1, - 112 => 1, - 113 => 1, - 116 => 1, - 117 => 1, - 120 => 1, - 121 => 1, - 128 => 1, - 129 => 1, - 132 => 1, - 134 => 1, - 136 => 1, - 138 => 1, - 142 => 1, - 145 => 1, - 151 => 1, - 158 => 1, - 165 => 1, - 169 => 1, - 175 => 1, - 176 => 2, - 178 => 2, - 179 => 1, - 180 => 2, - 181 => 1, - 189 => 1, - 212 => 1, - 214 => 2, - 219 => 1, - 223 => 1, - 225 => 1, - 226 => 1, - 227 => 2, - 228 => 1, - 235 => 1, - 241 => 1, - 248 => 1, - 253 => 1, - 258 => 1, - 263 => 1, - 264 => 1, - 270 => 1, - 272 => 1, - 276 => 1, - 279 => 2, - 282 => 2, - ]; - - case 'EmbeddedPhpUnitTest.2.inc': - case 'EmbeddedPhpUnitTest.4.inc': - return [ - 5 => 2, - 6 => 2, - 7 => 2, - ]; - - case 'EmbeddedPhpUnitTest.3.inc': - return [ - 10 => 1, - 15 => 1, - 21 => 1, - 22 => 2, - 23 => 1, - 24 => 1, - 25 => 3, - 28 => 1, - 29 => 1, - 30 => 1, - 33 => 1, - 35 => 1, - 39 => 1, - 40 => 1, - 43 => 1, - 44 => 1, - 48 => 1, - 53 => 1, - 55 => 1, - 61 => 1, - 62 => 1, - 65 => 2, - 66 => 2, - 69 => 1, - 70 => 1, - 75 => 1, - 82 => 1, - 89 => 1, - 93 => 1, - 98 => 2, - 99 => 1, - 103 => 2, - 105 => 1, - 111 => 1, - 112 => 2, - 114 => 2, - 115 => 1, - 116 => 2, - 117 => 1, - ]; - - case 'EmbeddedPhpUnitTest.5.inc': - return [ - 16 => 1, - 18 => 1, - 25 => 1, - 26 => 1, - 29 => 1, - 31 => 1, - 33 => 1, - 35 => 1, - 39 => 1, - 42 => 1, - ]; - - case 'EmbeddedPhpUnitTest.12.inc': - case 'EmbeddedPhpUnitTest.13.inc': - return [ - 10 => 1, - 12 => 1, - ]; - - case 'EmbeddedPhpUnitTest.18.inc': - return [11 => 1]; - - case 'EmbeddedPhpUnitTest.19.inc': - return [13 => 1]; - - case 'EmbeddedPhpUnitTest.20.inc': - case 'EmbeddedPhpUnitTest.21.inc': - return [12 => 2]; - - case 'EmbeddedPhpUnitTest.22.inc': - return [ - 14 => 1, - 22 => 1, - ]; - - case 'EmbeddedPhpUnitTest.24.inc': - $shortOpenTagDirective = (bool) ini_get('short_open_tag'); - if ($shortOpenTagDirective === true) { + case 'EmbeddedPhpUnitTest.1.inc': return [ + 7 => 1, + 12 => 1, + 18 => 1, + 19 => 2, + 20 => 1, + 21 => 1, + 22 => 3, + 24 => 1, + 26 => 1, + 29 => 1, + 30 => 1, + 31 => 1, + 34 => 1, + 36 => 1, + 40 => 1, + 41 => 1, + 44 => 1, + 45 => 1, + 49 => 1, + 59 => 1, + 63 => 1, + 93 => 1, + 94 => 2, + 100 => 1, + 102 => 1, + 112 => 1, + 113 => 1, + 116 => 1, + 117 => 1, + 120 => 1, + 121 => 1, + 128 => 1, + 129 => 1, + 132 => 1, + 134 => 1, + 136 => 1, + 138 => 1, + 142 => 1, + 145 => 1, + 151 => 1, + 158 => 1, + 165 => 1, + 169 => 1, + 175 => 1, + 176 => 2, + 178 => 2, + 179 => 1, + 180 => 2, + 181 => 1, + 189 => 1, + 212 => 1, + 214 => 2, + 219 => 1, + 223 => 1, + 225 => 1, + 226 => 1, + 227 => 2, + 228 => 1, + 235 => 1, + 241 => 1, + 248 => 1, + 253 => 1, + 258 => 1, + 263 => 1, + 264 => 1, + 270 => 1, + 272 => 1, + 276 => 1, + 279 => 2, + 282 => 2, + ]; + + case 'EmbeddedPhpUnitTest.2.inc': + case 'EmbeddedPhpUnitTest.4.inc': + return [ + 5 => 2, + 6 => 2, + 7 => 2, + ]; + + case 'EmbeddedPhpUnitTest.3.inc': + return [ + 10 => 1, + 15 => 1, + 21 => 1, + 22 => 2, + 23 => 1, + 24 => 1, + 25 => 3, + 28 => 1, + 29 => 1, + 30 => 1, + 33 => 1, + 35 => 1, + 39 => 1, + 40 => 1, + 43 => 1, + 44 => 1, + 48 => 1, + 53 => 1, + 55 => 1, + 61 => 1, + 62 => 1, + 65 => 2, + 66 => 2, + 69 => 1, + 70 => 1, + 75 => 1, + 82 => 1, + 89 => 1, + 93 => 1, + 98 => 2, + 99 => 1, + 103 => 2, + 105 => 1, + 111 => 1, + 112 => 2, + 114 => 2, + 115 => 1, + 116 => 2, + 117 => 1, + ]; + + case 'EmbeddedPhpUnitTest.5.inc': + return [ + 16 => 1, 18 => 1, - 20 => 1, + 25 => 1, + 26 => 1, + 29 => 1, + 31 => 1, + 33 => 1, + 35 => 1, + 39 => 1, + 42 => 1, ]; - } - return []; - case 'EmbeddedPhpUnitTest.25.inc': - if (PHP_VERSION_ID >= 70300) { + case 'EmbeddedPhpUnitTest.12.inc': + case 'EmbeddedPhpUnitTest.13.inc': return [ - 12 => 2, - 14 => 2, + 10 => 1, + 12 => 1, ]; - } - // PHP 7.2 or lower: PHP version which doesn't support flexible heredocs/nowdocs yet. - return []; + case 'EmbeddedPhpUnitTest.18.inc': + return [11 => 1]; + + case 'EmbeddedPhpUnitTest.19.inc': + return [13 => 1]; + + case 'EmbeddedPhpUnitTest.20.inc': + case 'EmbeddedPhpUnitTest.21.inc': + return [12 => 2]; + + case 'EmbeddedPhpUnitTest.22.inc': + return [ + 14 => 1, + 22 => 1, + ]; - default: - return []; + case 'EmbeddedPhpUnitTest.24.inc': + $shortOpenTagDirective = (bool) ini_get('short_open_tag'); + if ($shortOpenTagDirective === true) { + return [ + 18 => 1, + 20 => 1, + ]; + } + return []; + + case 'EmbeddedPhpUnitTest.25.inc': + if (PHP_VERSION_ID >= 70300) { + return [ + 12 => 2, + 14 => 2, + ]; + } + + // PHP 7.2 or lower: PHP version which doesn't support flexible heredocs/nowdocs yet. + return []; + + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.php b/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.php index 07989ccb15..a3601d1ac6 100644 --- a/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.php +++ b/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.php @@ -33,14 +33,14 @@ final class HeredocUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'HeredocUnitTest.1.inc': - return [ - 2 => 1, - 8 => 1, - ]; - - default: - return []; + case 'HeredocUnitTest.1.inc': + return [ + 2 => 1, + 8 => 1, + ]; + + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php b/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php index bdc16e1aa5..c7df692722 100644 --- a/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php +++ b/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php @@ -47,76 +47,76 @@ public function getErrorList() public function getWarningList($testFile = '') { switch ($testFile) { - case 'NonExecutableCodeUnitTest.1.inc': - return [ - 5 => 1, - 11 => 1, - 17 => 1, - 18 => 1, - 19 => 2, - 28 => 1, - 32 => 1, - 33 => 2, - 34 => 2, - 42 => 1, - 45 => 1, - 54 => 1, - 58 => 1, - 73 => 1, - 83 => 1, - 95 => 1, - 105 => 1, - 123 => 1, - 147 => 1, - 150 => 1, - 153 => 1, - 166 => 1, - 180 => 1, - 232 => 1, - 240 => 1, - 246 => 1, - 252 => 1, - 253 => 1, - 254 => 2, - 303 => 1, - 308 => 1, - 370 => 1, - 376 => 1, - 381 => 1, - 386 => 1, - 391 => 1, - 396 => 1, - 406 => 1, - 412 => 1, - 419 => 1, - 425 => 1, - 431 => 1, - ]; + case 'NonExecutableCodeUnitTest.1.inc': + return [ + 5 => 1, + 11 => 1, + 17 => 1, + 18 => 1, + 19 => 2, + 28 => 1, + 32 => 1, + 33 => 2, + 34 => 2, + 42 => 1, + 45 => 1, + 54 => 1, + 58 => 1, + 73 => 1, + 83 => 1, + 95 => 1, + 105 => 1, + 123 => 1, + 147 => 1, + 150 => 1, + 153 => 1, + 166 => 1, + 180 => 1, + 232 => 1, + 240 => 1, + 246 => 1, + 252 => 1, + 253 => 1, + 254 => 2, + 303 => 1, + 308 => 1, + 370 => 1, + 376 => 1, + 381 => 1, + 386 => 1, + 391 => 1, + 396 => 1, + 406 => 1, + 412 => 1, + 419 => 1, + 425 => 1, + 431 => 1, + ]; - case 'NonExecutableCodeUnitTest.2.inc': - return [ - 7 => 1, - 8 => 1, - 9 => 1, - 10 => 2, - 14 => 1, - 54 => 2, - 65 => 2, - 69 => 2, - 70 => 2, - 71 => 2, - ]; + case 'NonExecutableCodeUnitTest.2.inc': + return [ + 7 => 1, + 8 => 1, + 9 => 1, + 10 => 2, + 14 => 1, + 54 => 2, + 65 => 2, + 69 => 2, + 70 => 2, + 71 => 2, + ]; - case 'NonExecutableCodeUnitTest.3.inc': - return [ - 27 => 1, - 36 => 1, - 45 => 1, - 54 => 1, - 62 => 1, - ]; - default: - return []; + case 'NonExecutableCodeUnitTest.3.inc': + return [ + 27 => 1, + 36 => 1, + 45 => 1, + 54 => 1, + 62 => 1, + ]; + default: + return []; } } } diff --git a/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php b/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php index eca007101b..d00b37c09c 100644 --- a/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php +++ b/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php @@ -33,26 +33,26 @@ final class MemberVarScopeUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'MemberVarScopeUnitTest.1.inc': - return [ - 7 => 1, - 25 => 1, - 29 => 1, - 33 => 1, - 39 => 1, - 41 => 1, - 66 => 2, - 67 => 1, - 71 => 1, - 75 => 1, - 80 => 1, - 81 => 1, - 82 => 1, - 90 => 1, - ]; + case 'MemberVarScopeUnitTest.1.inc': + return [ + 7 => 1, + 25 => 1, + 29 => 1, + 33 => 1, + 39 => 1, + 41 => 1, + 66 => 2, + 67 => 1, + 71 => 1, + 75 => 1, + 80 => 1, + 81 => 1, + 82 => 1, + 90 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.php b/src/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.php index 7d93b9024e..f163f8bbfc 100644 --- a/src/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.php +++ b/src/Standards/Squiz/Tests/Scope/MethodScopeUnitTest.php @@ -33,16 +33,16 @@ final class MethodScopeUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'MethodScopeUnitTest.1.inc': - return [ - 6 => 1, - 30 => 1, - 39 => 1, - 46 => 1, - ]; - - default: - return []; + case 'MethodScopeUnitTest.1.inc': + return [ + 6 => 1, + 30 => 1, + 39 => 1, + 46 => 1, + ]; + + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/WhiteSpace/FunctionSpacingUnitTest.php b/src/Standards/Squiz/Tests/WhiteSpace/FunctionSpacingUnitTest.php index 9a64cc7fee..fbf0a6aa6d 100644 --- a/src/Standards/Squiz/Tests/WhiteSpace/FunctionSpacingUnitTest.php +++ b/src/Standards/Squiz/Tests/WhiteSpace/FunctionSpacingUnitTest.php @@ -33,100 +33,100 @@ final class FunctionSpacingUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'FunctionSpacingUnitTest.1.inc': - return [ - 26 => 1, - 35 => 1, - 44 => 1, - 51 => 1, - 55 => 1, - 61 => 1, - 64 => 1, - 66 => 1, - 81 => 1, - 100 => 1, - 111 => 1, - 113 => 1, - 119 => 2, - 141 => 1, - 160 => 1, - 173 => 2, - 190 => 1, - 224 => 2, - 281 => 1, - 282 => 1, - 295 => 1, - 297 => 1, - 303 => 1, - 327 => 1, - 329 => 1, - 338 => 1, - 344 => 1, - 345 => 1, - 354 => 2, - 355 => 1, - 356 => 1, - 360 => 2, - 361 => 1, - 362 => 1, - 385 => 1, - 399 => 1, - 411 => 2, - 418 => 2, - 426 => 2, - 432 => 1, - 437 => 1, - 438 => 1, - 442 => 2, - 444 => 1, - 449 => 1, - 458 => 2, - 459 => 1, - 460 => 1, - 465 => 2, - 466 => 1, - 467 => 1, - 471 => 1, - 473 => 2, - 475 => 1, - 478 => 2, - 479 => 1, - 483 => 2, - 495 => 1, - 529 => 1, - 539 => 1, - 547 => 2, - 551 => 1, - 553 => 1, - 560 => 1, - 566 => 1, - 580 => 2, - 583 => 4, - 591 => 1, - 627 => 1, - 641 => 1, - 672 => 1, - 686 => 1, - 714 => 1, - 717 => 1, - 727 => 1, - 749 => 1, - ]; + case 'FunctionSpacingUnitTest.1.inc': + return [ + 26 => 1, + 35 => 1, + 44 => 1, + 51 => 1, + 55 => 1, + 61 => 1, + 64 => 1, + 66 => 1, + 81 => 1, + 100 => 1, + 111 => 1, + 113 => 1, + 119 => 2, + 141 => 1, + 160 => 1, + 173 => 2, + 190 => 1, + 224 => 2, + 281 => 1, + 282 => 1, + 295 => 1, + 297 => 1, + 303 => 1, + 327 => 1, + 329 => 1, + 338 => 1, + 344 => 1, + 345 => 1, + 354 => 2, + 355 => 1, + 356 => 1, + 360 => 2, + 361 => 1, + 362 => 1, + 385 => 1, + 399 => 1, + 411 => 2, + 418 => 2, + 426 => 2, + 432 => 1, + 437 => 1, + 438 => 1, + 442 => 2, + 444 => 1, + 449 => 1, + 458 => 2, + 459 => 1, + 460 => 1, + 465 => 2, + 466 => 1, + 467 => 1, + 471 => 1, + 473 => 2, + 475 => 1, + 478 => 2, + 479 => 1, + 483 => 2, + 495 => 1, + 529 => 1, + 539 => 1, + 547 => 2, + 551 => 1, + 553 => 1, + 560 => 1, + 566 => 1, + 580 => 2, + 583 => 4, + 591 => 1, + 627 => 1, + 641 => 1, + 672 => 1, + 686 => 1, + 714 => 1, + 717 => 1, + 727 => 1, + 749 => 1, + ]; - case 'FunctionSpacingUnitTest.2.inc': - return [2 => 1]; + case 'FunctionSpacingUnitTest.2.inc': + return [2 => 1]; - case 'FunctionSpacingUnitTest.3.inc': - return [7 => 1]; + case 'FunctionSpacingUnitTest.3.inc': + return [7 => 1]; - case 'FunctionSpacingUnitTest.5.inc': - return [5 => 1]; + case 'FunctionSpacingUnitTest.5.inc': + return [5 => 1]; - case 'FunctionSpacingUnitTest.6.inc': - return [10 => 1]; + case 'FunctionSpacingUnitTest.6.inc': + return [10 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.php b/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.php index db2bf4d415..f0743019f5 100644 --- a/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.php +++ b/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.php @@ -33,70 +33,70 @@ final class MemberVarSpacingUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'MemberVarSpacingUnitTest.1.inc': - return [ - 4 => 1, - 7 => 1, - 20 => 1, - 30 => 1, - 35 => 1, - 44 => 1, - 50 => 1, - 73 => 1, - 86 => 1, - 107 => 1, - 115 => 1, - 151 => 1, - 160 => 1, - 165 => 1, - 177 => 1, - 186 => 1, - 200 => 1, - 209 => 1, - 211 => 1, - 224 => 1, - 229 => 1, - 241 => 1, - 246 => 1, - 252 => 1, - 254 => 1, - 261 => 1, - 275 => 1, - 276 => 1, - 288 => 1, - 292 => 1, - 333 => 1, - 343 => 1, - 345 => 1, - 346 => 1, - 355 => 1, - 357 => 1, - 366 => 1, - 377 => 1, - 378 => 1, - 379 => 1, - 380 => 1, - 384 => 1, - 394 => 1, - 396 => 1, - 403 => 1, - 412 => 1, - 415 => 1, - 416 => 1, - 420 => 1, - 427 => 1, - 437 => 1, - 445 => 1, - 449 => 1, - 456 => 1, - 457 => 1, - 460 => 1, - 464 => 1, - 471 => 1, - ]; + case 'MemberVarSpacingUnitTest.1.inc': + return [ + 4 => 1, + 7 => 1, + 20 => 1, + 30 => 1, + 35 => 1, + 44 => 1, + 50 => 1, + 73 => 1, + 86 => 1, + 107 => 1, + 115 => 1, + 151 => 1, + 160 => 1, + 165 => 1, + 177 => 1, + 186 => 1, + 200 => 1, + 209 => 1, + 211 => 1, + 224 => 1, + 229 => 1, + 241 => 1, + 246 => 1, + 252 => 1, + 254 => 1, + 261 => 1, + 275 => 1, + 276 => 1, + 288 => 1, + 292 => 1, + 333 => 1, + 343 => 1, + 345 => 1, + 346 => 1, + 355 => 1, + 357 => 1, + 366 => 1, + 377 => 1, + 378 => 1, + 379 => 1, + 380 => 1, + 384 => 1, + 394 => 1, + 396 => 1, + 403 => 1, + 412 => 1, + 415 => 1, + 416 => 1, + 420 => 1, + 427 => 1, + 437 => 1, + 445 => 1, + 449 => 1, + 456 => 1, + 457 => 1, + 460 => 1, + 464 => 1, + 471 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php b/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php index c9e0b70a6c..cd6f0cb315 100644 --- a/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php +++ b/src/Standards/Squiz/Tests/WhiteSpace/OperatorSpacingUnitTest.php @@ -33,87 +33,87 @@ final class OperatorSpacingUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'OperatorSpacingUnitTest.1.inc': - return [ - 4 => 1, - 5 => 2, - 6 => 1, - 7 => 1, - 8 => 2, - 11 => 1, - 12 => 2, - 13 => 1, - 14 => 1, - 15 => 2, - 18 => 1, - 19 => 2, - 20 => 1, - 21 => 1, - 22 => 2, - 25 => 1, - 26 => 2, - 27 => 1, - 28 => 1, - 29 => 2, - 32 => 1, - 33 => 2, - 34 => 1, - 35 => 1, - 36 => 2, - 40 => 2, - 42 => 2, - 44 => 2, - 45 => 1, - 46 => 2, - 53 => 4, - 54 => 3, - 59 => 10, - 64 => 1, - 77 => 4, - 78 => 1, - 79 => 1, - 80 => 2, - 81 => 1, - 84 => 6, - 85 => 6, - 87 => 4, - 88 => 5, - 90 => 4, - 91 => 5, - 128 => 4, - 132 => 1, - 133 => 1, - 135 => 1, - 136 => 1, - 140 => 1, - 141 => 1, - 174 => 1, - 177 => 1, - 178 => 1, - 179 => 1, - 185 => 2, - 191 => 4, - 194 => 1, - 195 => 1, - 196 => 2, - 199 => 1, - 200 => 1, - 201 => 2, - 239 => 1, - 246 => 1, - 265 => 2, - 266 => 2, - 271 => 2, - 487 => 1, - 488 => 1, - 493 => 1, - 494 => 1, - 499 => 1, - 504 => 1, - ]; + case 'OperatorSpacingUnitTest.1.inc': + return [ + 4 => 1, + 5 => 2, + 6 => 1, + 7 => 1, + 8 => 2, + 11 => 1, + 12 => 2, + 13 => 1, + 14 => 1, + 15 => 2, + 18 => 1, + 19 => 2, + 20 => 1, + 21 => 1, + 22 => 2, + 25 => 1, + 26 => 2, + 27 => 1, + 28 => 1, + 29 => 2, + 32 => 1, + 33 => 2, + 34 => 1, + 35 => 1, + 36 => 2, + 40 => 2, + 42 => 2, + 44 => 2, + 45 => 1, + 46 => 2, + 53 => 4, + 54 => 3, + 59 => 10, + 64 => 1, + 77 => 4, + 78 => 1, + 79 => 1, + 80 => 2, + 81 => 1, + 84 => 6, + 85 => 6, + 87 => 4, + 88 => 5, + 90 => 4, + 91 => 5, + 128 => 4, + 132 => 1, + 133 => 1, + 135 => 1, + 136 => 1, + 140 => 1, + 141 => 1, + 174 => 1, + 177 => 1, + 178 => 1, + 179 => 1, + 185 => 2, + 191 => 4, + 194 => 1, + 195 => 1, + 196 => 2, + 199 => 1, + 200 => 1, + 201 => 2, + 239 => 1, + 246 => 1, + 265 => 2, + 266 => 2, + 271 => 2, + 487 => 1, + 488 => 1, + 493 => 1, + 494 => 1, + 499 => 1, + 504 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.php b/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.php index 440d654515..54def1da59 100644 --- a/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.php +++ b/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.php @@ -33,54 +33,54 @@ final class ScopeKeywordSpacingUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ScopeKeywordSpacingUnitTest.1.inc': - return [ - 7 => 2, - 8 => 1, - 13 => 1, - 14 => 1, - 15 => 1, - 17 => 2, - 26 => 1, - 28 => 1, - 29 => 1, - 64 => 1, - 67 => 1, - 71 => 1, - 103 => 1, - 106 => 1, - 111 => 1, - 119 => 1, - 121 => 1, - 127 => 2, - 134 => 2, - 138 => 2, - 140 => 3, - 145 => 1, - 149 => 1, - 152 => 1, - 155 => 1, - 158 => 1, - 162 => 1, - 163 => 1, - 166 => 1, - 167 => 1, - 179 => 1, - 186 => 1, - 187 => 1, - 188 => 1, - 193 => 2, - 197 => 1, - 198 => 3, - 199 => 2, - 208 => 2, - ]; + case 'ScopeKeywordSpacingUnitTest.1.inc': + return [ + 7 => 2, + 8 => 1, + 13 => 1, + 14 => 1, + 15 => 1, + 17 => 2, + 26 => 1, + 28 => 1, + 29 => 1, + 64 => 1, + 67 => 1, + 71 => 1, + 103 => 1, + 106 => 1, + 111 => 1, + 119 => 1, + 121 => 1, + 127 => 2, + 134 => 2, + 138 => 2, + 140 => 3, + 145 => 1, + 149 => 1, + 152 => 1, + 155 => 1, + 158 => 1, + 162 => 1, + 163 => 1, + 166 => 1, + 167 => 1, + 179 => 1, + 186 => 1, + 187 => 1, + 188 => 1, + 193 => 2, + 197 => 1, + 198 => 3, + 199 => 2, + 208 => 2, + ]; - case 'ScopeKeywordSpacingUnitTest.3.inc': - return [6 => 1]; + case 'ScopeKeywordSpacingUnitTest.3.inc': + return [6 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Squiz/Tests/WhiteSpace/SuperfluousWhitespaceUnitTest.php b/src/Standards/Squiz/Tests/WhiteSpace/SuperfluousWhitespaceUnitTest.php index 51636508bc..43b369b175 100644 --- a/src/Standards/Squiz/Tests/WhiteSpace/SuperfluousWhitespaceUnitTest.php +++ b/src/Standards/Squiz/Tests/WhiteSpace/SuperfluousWhitespaceUnitTest.php @@ -33,44 +33,44 @@ final class SuperfluousWhitespaceUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'SuperfluousWhitespaceUnitTest.1.inc': - return [ - 2 => 1, - 4 => 1, - 5 => 1, - 6 => 1, - 7 => 1, - 16 => 1, - 23 => 1, - 28 => 1, - 33 => 1, - 49 => 1, - 62 => 1, - 65 => 1, - 73 => 1, - ]; + case 'SuperfluousWhitespaceUnitTest.1.inc': + return [ + 2 => 1, + 4 => 1, + 5 => 1, + 6 => 1, + 7 => 1, + 16 => 1, + 23 => 1, + 28 => 1, + 33 => 1, + 49 => 1, + 62 => 1, + 65 => 1, + 73 => 1, + ]; - case 'SuperfluousWhitespaceUnitTest.2.inc': - return [ - 2 => 1, - 8 => 1, - ]; + case 'SuperfluousWhitespaceUnitTest.2.inc': + return [ + 2 => 1, + 8 => 1, + ]; - case 'SuperfluousWhitespaceUnitTest.3.inc': - return [ - 6 => 1, - 10 => 1, - ]; + case 'SuperfluousWhitespaceUnitTest.3.inc': + return [ + 6 => 1, + 10 => 1, + ]; - case 'SuperfluousWhitespaceUnitTest.4.inc': - case 'SuperfluousWhitespaceUnitTest.5.inc': - return [ - 1 => 1, - 4 => 1, - ]; + case 'SuperfluousWhitespaceUnitTest.4.inc': + case 'SuperfluousWhitespaceUnitTest.5.inc': + return [ + 1 => 1, + 4 => 1, + ]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Zend/Tests/Files/ClosingTagUnitTest.php b/src/Standards/Zend/Tests/Files/ClosingTagUnitTest.php index 60c9be4e30..89866311d9 100644 --- a/src/Standards/Zend/Tests/Files/ClosingTagUnitTest.php +++ b/src/Standards/Zend/Tests/Files/ClosingTagUnitTest.php @@ -33,20 +33,20 @@ final class ClosingTagUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ClosingTagUnitTest.1.inc': - return [11 => 1]; + case 'ClosingTagUnitTest.1.inc': + return [11 => 1]; - case 'ClosingTagUnitTest.3.inc': - case 'ClosingTagUnitTest.4.inc': - case 'ClosingTagUnitTest.5.inc': - case 'ClosingTagUnitTest.7.inc': - return [1 => 1]; + case 'ClosingTagUnitTest.3.inc': + case 'ClosingTagUnitTest.4.inc': + case 'ClosingTagUnitTest.5.inc': + case 'ClosingTagUnitTest.7.inc': + return [1 => 1]; - case 'ClosingTagUnitTest.6.inc': - return [3 => 1]; + case 'ClosingTagUnitTest.6.inc': + return [3 => 1]; - default: - return []; + default: + return []; } } diff --git a/src/Standards/Zend/Tests/NamingConventions/ValidVariableNameUnitTest.php b/src/Standards/Zend/Tests/NamingConventions/ValidVariableNameUnitTest.php index 8393f305fc..2683cb1ff7 100644 --- a/src/Standards/Zend/Tests/NamingConventions/ValidVariableNameUnitTest.php +++ b/src/Standards/Zend/Tests/NamingConventions/ValidVariableNameUnitTest.php @@ -33,48 +33,48 @@ final class ValidVariableNameUnitTest extends AbstractSniffTestCase public function getErrorList($testFile = '') { switch ($testFile) { - case 'ValidVariableNameUnitTest.1.inc': - return [ - 3 => 1, - 5 => 1, - 11 => 1, - 13 => 1, - 17 => 1, - 19 => 1, - 23 => 1, - 25 => 1, - 29 => 1, - 31 => 1, - 36 => 1, - 38 => 1, - 42 => 1, - 44 => 1, - 48 => 1, - 50 => 1, - 61 => 1, - 67 => 1, - 72 => 1, - 74 => 1, - 75 => 1, - 76 => 1, - 79 => 1, - 96 => 1, - 99 => 1, - 107 => 1, - 113 => 1, - 116 => 1, - 121 => 1, - 126 => 1, - 129 => 1, - 135 => 1, - 141 => 1, - 144 => 1, - 148 => 1, - 149 => 1, - ]; + case 'ValidVariableNameUnitTest.1.inc': + return [ + 3 => 1, + 5 => 1, + 11 => 1, + 13 => 1, + 17 => 1, + 19 => 1, + 23 => 1, + 25 => 1, + 29 => 1, + 31 => 1, + 36 => 1, + 38 => 1, + 42 => 1, + 44 => 1, + 48 => 1, + 50 => 1, + 61 => 1, + 67 => 1, + 72 => 1, + 74 => 1, + 75 => 1, + 76 => 1, + 79 => 1, + 96 => 1, + 99 => 1, + 107 => 1, + 113 => 1, + 116 => 1, + 121 => 1, + 126 => 1, + 129 => 1, + 135 => 1, + 141 => 1, + 144 => 1, + 148 => 1, + 149 => 1, + ]; - default: - return []; + default: + return []; } } @@ -92,27 +92,27 @@ public function getErrorList($testFile = '') public function getWarningList($testFile = '') { switch ($testFile) { - case 'ValidVariableNameUnitTest.1.inc': - return [ - 6 => 1, - 14 => 1, - 20 => 1, - 26 => 1, - 32 => 1, - 39 => 1, - 45 => 1, - 51 => 1, - 64 => 1, - 70 => 1, - 73 => 1, - 76 => 1, - 79 => 1, - 82 => 1, - 94 => 1, - ]; + case 'ValidVariableNameUnitTest.1.inc': + return [ + 6 => 1, + 14 => 1, + 20 => 1, + 26 => 1, + 32 => 1, + 39 => 1, + 45 => 1, + 51 => 1, + 64 => 1, + 70 => 1, + 73 => 1, + 76 => 1, + 79 => 1, + 82 => 1, + 94 => 1, + ]; - default: - return []; + default: + return []; } } } diff --git a/src/Tokenizers/PHP.php b/src/Tokenizers/PHP.php index a8741c3ef8..d067afaad1 100644 --- a/src/Tokenizers/PHP.php +++ b/src/Tokenizers/PHP.php @@ -1421,34 +1421,34 @@ protected function tokenize(string $code) $newToken['content'] = $token[1]; switch ($token[0]) { - case T_STRING: - $newToken['code'] = T_NAME_QUALIFIED; - $newToken['type'] = 'T_NAME_QUALIFIED'; - break; - case T_NAMESPACE: - $newToken['code'] = T_NAME_RELATIVE; - $newToken['type'] = 'T_NAME_RELATIVE'; - break; - case T_NS_SEPARATOR: - $newToken['code'] = T_NAME_FULLY_QUALIFIED; - $newToken['type'] = 'T_NAME_FULLY_QUALIFIED'; - - if (is_array($tokens[($i - 1)]) === true - && isset(Tokens::EMPTY_TOKENS[$tokens[($i - 1)][0]]) === false - && preg_match(self::PHP_LABEL_REGEX, $tokens[($i - 1)][1]) === 1 - ) { - // The namespaced name starts with a reserved keyword. Move one token back. - $newToken['code'] = T_NAME_QUALIFIED; - $newToken['type'] = 'T_NAME_QUALIFIED'; - $newToken['content'] = $tokens[($i - 1)][1]; - --$nameStart; - --$i; + case T_STRING: + $newToken['code'] = T_NAME_QUALIFIED; + $newToken['type'] = 'T_NAME_QUALIFIED'; break; - } + case T_NAMESPACE: + $newToken['code'] = T_NAME_RELATIVE; + $newToken['type'] = 'T_NAME_RELATIVE'; + break; + case T_NS_SEPARATOR: + $newToken['code'] = T_NAME_FULLY_QUALIFIED; + $newToken['type'] = 'T_NAME_FULLY_QUALIFIED'; - ++$i; - $newToken['content'] .= $tokens[$i][1]; - break; + if (is_array($tokens[($i - 1)]) === true + && isset(Tokens::EMPTY_TOKENS[$tokens[($i - 1)][0]]) === false + && preg_match(self::PHP_LABEL_REGEX, $tokens[($i - 1)][1]) === 1 + ) { + // The namespaced name starts with a reserved keyword. Move one token back. + $newToken['code'] = T_NAME_QUALIFIED; + $newToken['type'] = 'T_NAME_QUALIFIED'; + $newToken['content'] = $tokens[($i - 1)][1]; + --$nameStart; + --$i; + break; + } + + ++$i; + $newToken['content'] .= $tokens[$i][1]; + break; } while (isset($tokens[($i + 1)], $tokens[($i + 2)]) === true @@ -3791,24 +3791,24 @@ public static function standardiseToken($token) if ($token[0] === T_STRING) { switch ($cacheKey) { - case 'false': - $newToken['type'] = 'T_FALSE'; - break; - case 'true': - $newToken['type'] = 'T_TRUE'; - break; - case 'null': - $newToken['type'] = 'T_NULL'; - break; - case 'self': - $newToken['type'] = 'T_SELF'; - break; - case 'parent': - $newToken['type'] = 'T_PARENT'; - break; - default: - $newToken['type'] = 'T_STRING'; - break; + case 'false': + $newToken['type'] = 'T_FALSE'; + break; + case 'true': + $newToken['type'] = 'T_TRUE'; + break; + case 'null': + $newToken['type'] = 'T_NULL'; + break; + case 'self': + $newToken['type'] = 'T_SELF'; + break; + case 'parent': + $newToken['type'] = 'T_PARENT'; + break; + default: + $newToken['type'] = 'T_STRING'; + break; } $newToken['code'] = constant($newToken['type']); @@ -3849,87 +3849,87 @@ public static function resolveSimpleToken(string $token) $newToken = []; switch ($token) { - case '{': - $newToken['type'] = 'T_OPEN_CURLY_BRACKET'; - break; - case '}': - $newToken['type'] = 'T_CLOSE_CURLY_BRACKET'; - break; - case '[': - $newToken['type'] = 'T_OPEN_SQUARE_BRACKET'; - break; - case ']': - $newToken['type'] = 'T_CLOSE_SQUARE_BRACKET'; - break; - case '(': - $newToken['type'] = 'T_OPEN_PARENTHESIS'; - break; - case ')': - $newToken['type'] = 'T_CLOSE_PARENTHESIS'; - break; - case ':': - $newToken['type'] = 'T_COLON'; - break; - case '.': - $newToken['type'] = 'T_STRING_CONCAT'; - break; - case ';': - $newToken['type'] = 'T_SEMICOLON'; - break; - case '=': - $newToken['type'] = 'T_EQUAL'; - break; - case '*': - $newToken['type'] = 'T_MULTIPLY'; - break; - case '/': - $newToken['type'] = 'T_DIVIDE'; - break; - case '+': - $newToken['type'] = 'T_PLUS'; - break; - case '-': - $newToken['type'] = 'T_MINUS'; - break; - case '%': - $newToken['type'] = 'T_MODULUS'; - break; - case '^': - $newToken['type'] = 'T_BITWISE_XOR'; - break; - case '&': - $newToken['type'] = 'T_BITWISE_AND'; - break; - case '|': - $newToken['type'] = 'T_BITWISE_OR'; - break; - case '~': - $newToken['type'] = 'T_BITWISE_NOT'; - break; - case '<': - $newToken['type'] = 'T_LESS_THAN'; - break; - case '>': - $newToken['type'] = 'T_GREATER_THAN'; - break; - case '!': - $newToken['type'] = 'T_BOOLEAN_NOT'; - break; - case ',': - $newToken['type'] = 'T_COMMA'; - break; - case '@': - $newToken['type'] = 'T_ASPERAND'; - break; - case '$': - $newToken['type'] = 'T_DOLLAR'; - break; - case '`': - $newToken['type'] = 'T_BACKTICK'; - break; - default: - $newToken['type'] = 'T_NONE'; - break; + case '{': + $newToken['type'] = 'T_OPEN_CURLY_BRACKET'; + break; + case '}': + $newToken['type'] = 'T_CLOSE_CURLY_BRACKET'; + break; + case '[': + $newToken['type'] = 'T_OPEN_SQUARE_BRACKET'; + break; + case ']': + $newToken['type'] = 'T_CLOSE_SQUARE_BRACKET'; + break; + case '(': + $newToken['type'] = 'T_OPEN_PARENTHESIS'; + break; + case ')': + $newToken['type'] = 'T_CLOSE_PARENTHESIS'; + break; + case ':': + $newToken['type'] = 'T_COLON'; + break; + case '.': + $newToken['type'] = 'T_STRING_CONCAT'; + break; + case ';': + $newToken['type'] = 'T_SEMICOLON'; + break; + case '=': + $newToken['type'] = 'T_EQUAL'; + break; + case '*': + $newToken['type'] = 'T_MULTIPLY'; + break; + case '/': + $newToken['type'] = 'T_DIVIDE'; + break; + case '+': + $newToken['type'] = 'T_PLUS'; + break; + case '-': + $newToken['type'] = 'T_MINUS'; + break; + case '%': + $newToken['type'] = 'T_MODULUS'; + break; + case '^': + $newToken['type'] = 'T_BITWISE_XOR'; + break; + case '&': + $newToken['type'] = 'T_BITWISE_AND'; + break; + case '|': + $newToken['type'] = 'T_BITWISE_OR'; + break; + case '~': + $newToken['type'] = 'T_BITWISE_NOT'; + break; + case '<': + $newToken['type'] = 'T_LESS_THAN'; + break; + case '>': + $newToken['type'] = 'T_GREATER_THAN'; + break; + case '!': + $newToken['type'] = 'T_BOOLEAN_NOT'; + break; + case ',': + $newToken['type'] = 'T_COMMA'; + break; + case '@': + $newToken['type'] = 'T_ASPERAND'; + break; + case '$': + $newToken['type'] = 'T_DOLLAR'; + break; + case '`': + $newToken['type'] = 'T_BACKTICK'; + break; + default: + $newToken['type'] = 'T_NONE'; + break; } $newToken['code'] = constant($newToken['type']); diff --git a/src/Tokenizers/Tokenizer.php b/src/Tokenizers/Tokenizer.php index acfb9c4f90..778a8ab346 100644 --- a/src/Tokenizers/Tokenizer.php +++ b/src/Tokenizers/Tokenizer.php @@ -685,52 +685,52 @@ private function createTokenMap() */ switch ($this->tokens[$i]['code']) { - case T_OPEN_SQUARE_BRACKET: - $squareOpeners[] = $i; - - if (PHP_CODESNIFFER_VERBOSITY > 1) { - StatusWriter::write("=> Found square bracket opener at $i", (count($squareOpeners) + count($curlyOpeners))); - } - break; - case T_OPEN_CURLY_BRACKET: - if (isset($this->tokens[$i]['scope_closer']) === false) { - $curlyOpeners[] = $i; + case T_OPEN_SQUARE_BRACKET: + $squareOpeners[] = $i; if (PHP_CODESNIFFER_VERBOSITY > 1) { - StatusWriter::write("=> Found curly bracket opener at $i", (count($squareOpeners) + count($curlyOpeners))); + StatusWriter::write("=> Found square bracket opener at $i", (count($squareOpeners) + count($curlyOpeners))); } - } - break; - case T_CLOSE_SQUARE_BRACKET: - if (empty($squareOpeners) === false) { - $opener = array_pop($squareOpeners); - $this->tokens[$i]['bracket_opener'] = $opener; - $this->tokens[$i]['bracket_closer'] = $i; - $this->tokens[$opener]['bracket_opener'] = $opener; - $this->tokens[$opener]['bracket_closer'] = $i; + break; + case T_OPEN_CURLY_BRACKET: + if (isset($this->tokens[$i]['scope_closer']) === false) { + $curlyOpeners[] = $i; - if (PHP_CODESNIFFER_VERBOSITY > 1) { - StatusWriter::write("=> Found square bracket closer at $i for $opener", (count($squareOpeners) + count($curlyOpeners) + 1)); + if (PHP_CODESNIFFER_VERBOSITY > 1) { + StatusWriter::write("=> Found curly bracket opener at $i", (count($squareOpeners) + count($curlyOpeners))); + } } - } - break; - case T_CLOSE_CURLY_BRACKET: - if (empty($curlyOpeners) === false - && isset($this->tokens[$i]['scope_opener']) === false - ) { - $opener = array_pop($curlyOpeners); - $this->tokens[$i]['bracket_opener'] = $opener; - $this->tokens[$i]['bracket_closer'] = $i; - $this->tokens[$opener]['bracket_opener'] = $opener; - $this->tokens[$opener]['bracket_closer'] = $i; + break; + case T_CLOSE_SQUARE_BRACKET: + if (empty($squareOpeners) === false) { + $opener = array_pop($squareOpeners); + $this->tokens[$i]['bracket_opener'] = $opener; + $this->tokens[$i]['bracket_closer'] = $i; + $this->tokens[$opener]['bracket_opener'] = $opener; + $this->tokens[$opener]['bracket_closer'] = $i; - if (PHP_CODESNIFFER_VERBOSITY > 1) { - StatusWriter::write("=> Found curly bracket closer at $i for $opener", (count($squareOpeners) + count($curlyOpeners) + 1)); + if (PHP_CODESNIFFER_VERBOSITY > 1) { + StatusWriter::write("=> Found square bracket closer at $i for $opener", (count($squareOpeners) + count($curlyOpeners) + 1)); + } } - } - break; - default: - continue 2; + break; + case T_CLOSE_CURLY_BRACKET: + if (empty($curlyOpeners) === false + && isset($this->tokens[$i]['scope_opener']) === false + ) { + $opener = array_pop($curlyOpeners); + $this->tokens[$i]['bracket_opener'] = $opener; + $this->tokens[$i]['bracket_closer'] = $i; + $this->tokens[$opener]['bracket_opener'] = $opener; + $this->tokens[$opener]['bracket_closer'] = $i; + + if (PHP_CODESNIFFER_VERBOSITY > 1) { + StatusWriter::write("=> Found curly bracket closer at $i for $opener", (count($squareOpeners) + count($curlyOpeners) + 1)); + } + } + break; + default: + continue 2; } } diff --git a/src/Util/Common.php b/src/Util/Common.php index 7632dd7989..86aec09da0 100644 --- a/src/Util/Common.php +++ b/src/Util/Common.php @@ -469,19 +469,19 @@ public static function suggestType(string $varType) } else { $lowerVarType = strtolower($varType); switch ($lowerVarType) { - case 'bool': - case 'boolean': - return 'boolean'; - case 'double': - case 'real': - case 'float': - return 'float'; - case 'int': - case 'integer': - return 'integer'; - case 'array()': - case 'array': - return 'array'; + case 'bool': + case 'boolean': + return 'boolean'; + case 'double': + case 'real': + case 'float': + return 'float'; + case 'int': + case 'integer': + return 'integer'; + case 'array()': + case 'array': + return 'array'; } if (strpos($lowerVarType, 'array(') !== false) { diff --git a/src/Util/MessageCollector.php b/src/Util/MessageCollector.php index dc5af475c0..855ea3e5c8 100644 --- a/src/Util/MessageCollector.php +++ b/src/Util/MessageCollector.php @@ -198,21 +198,21 @@ private function prefixAll(array $messages) private function prefix(string $message, int $type) { switch ($type) { - case self::ERROR: - $message = 'ERROR: ' . $message; - break; + case self::ERROR: + $message = 'ERROR: ' . $message; + break; - case self::WARNING: - $message = 'WARNING: ' . $message; - break; + case self::WARNING: + $message = 'WARNING: ' . $message; + break; - case self::DEPRECATED: - $message = 'DEPRECATED: ' . $message; - break; + case self::DEPRECATED: + $message = 'DEPRECATED: ' . $message; + break; - default: - $message = 'NOTICE: ' . $message; - break; + default: + $message = 'NOTICE: ' . $message; + break; } return $message; @@ -239,21 +239,21 @@ private function sortBySeverity(array $messages) foreach ($messages as list('message' => $message, 'type' => $type)) { switch ($type) { - case self::ERROR: - $errors[] = $message; - break; + case self::ERROR: + $errors[] = $message; + break; - case self::WARNING: - $warnings[] = $message; - break; + case self::WARNING: + $warnings[] = $message; + break; - case self::DEPRECATED: - $deprecations[] = $message; - break; + case self::DEPRECATED: + $deprecations[] = $message; + break; - default: - $notices[] = $message; - break; + default: + $notices[] = $message; + break; } } diff --git a/tests/Core/Tokenizers/PHP/DNFTypesParseError2Test.php b/tests/Core/Tokenizers/PHP/DNFTypesParseError2Test.php index 3ca281d7d6..4be2763998 100644 --- a/tests/Core/Tokenizers/PHP/DNFTypesParseError2Test.php +++ b/tests/Core/Tokenizers/PHP/DNFTypesParseError2Test.php @@ -163,29 +163,29 @@ public function testBrokenDNFTypeParensShouldAlwaysBeAPairMatchedAndUnmatched($t // Verify that type tokens have not been retokenized to `T_TYPE_*` tokens for broken type declarations. switch ($tokens[$i]['content']) { - case '|': - $this->assertSame(T_BITWISE_OR, $tokens[$i]['code'], $errorPrefix . ', not T_BITWISE_OR (code)'); - $this->assertSame('T_BITWISE_OR', $tokens[$i]['type'], $errorPrefix . ', not T_BITWISE_OR (type)'); - break; - - case '&': - $this->assertSame(T_BITWISE_AND, $tokens[$i]['code'], $errorPrefix . ', not T_BITWISE_AND (code)'); - $this->assertSame('T_BITWISE_AND', $tokens[$i]['type'], $errorPrefix . ', not T_BITWISE_AND (type)'); - break; - - case '(': - // Verify that the open parenthesis is tokenized as a normal parenthesis. - $this->assertSame(T_OPEN_PARENTHESIS, $tokens[$i]['code'], $errorPrefix . ', not T_OPEN_PARENTHESIS (code)'); - $this->assertSame('T_OPEN_PARENTHESIS', $tokens[$i]['type'], $errorPrefix . ', not T_OPEN_PARENTHESIS (type)'); - break; - - case ')': - $this->assertSame(T_CLOSE_PARENTHESIS, $tokens[$i]['code'], $errorPrefix . ', not T_CLOSE_PARENTHESIS (code)'); - $this->assertSame('T_CLOSE_PARENTHESIS', $tokens[$i]['type'], $errorPrefix . ', not T_CLOSE_PARENTHESIS (type)'); - break; - - default: - break; + case '|': + $this->assertSame(T_BITWISE_OR, $tokens[$i]['code'], $errorPrefix . ', not T_BITWISE_OR (code)'); + $this->assertSame('T_BITWISE_OR', $tokens[$i]['type'], $errorPrefix . ', not T_BITWISE_OR (type)'); + break; + + case '&': + $this->assertSame(T_BITWISE_AND, $tokens[$i]['code'], $errorPrefix . ', not T_BITWISE_AND (code)'); + $this->assertSame('T_BITWISE_AND', $tokens[$i]['type'], $errorPrefix . ', not T_BITWISE_AND (type)'); + break; + + case '(': + // Verify that the open parenthesis is tokenized as a normal parenthesis. + $this->assertSame(T_OPEN_PARENTHESIS, $tokens[$i]['code'], $errorPrefix . ', not T_OPEN_PARENTHESIS (code)'); + $this->assertSame('T_OPEN_PARENTHESIS', $tokens[$i]['type'], $errorPrefix . ', not T_OPEN_PARENTHESIS (type)'); + break; + + case ')': + $this->assertSame(T_CLOSE_PARENTHESIS, $tokens[$i]['code'], $errorPrefix . ', not T_CLOSE_PARENTHESIS (code)'); + $this->assertSame('T_CLOSE_PARENTHESIS', $tokens[$i]['type'], $errorPrefix . ', not T_CLOSE_PARENTHESIS (type)'); + break; + + default: + break; } } }