diff --git a/system/Commands/Utilities/ConfigCheck.php b/system/Commands/Utilities/ConfigCheck.php index fa84cb287caa..4583c67dae87 100644 --- a/system/Commands/Utilities/ConfigCheck.php +++ b/system/Commands/Utilities/ConfigCheck.php @@ -73,7 +73,7 @@ final class ConfigCheck extends BaseCommand protected $options = []; /** - * {@inheritDoc} + * @return int */ public function run(array $params) { diff --git a/system/Commands/Utilities/Environment.php b/system/Commands/Utilities/Environment.php index 103591209d1e..22794fe9d51d 100644 --- a/system/Commands/Utilities/Environment.php +++ b/system/Commands/Utilities/Environment.php @@ -80,7 +80,7 @@ final class Environment extends BaseCommand ]; /** - * {@inheritDoc} + * @return int */ public function run(array $params) { @@ -88,7 +88,7 @@ public function run(array $params) CLI::write(sprintf('Your environment is currently set as %s.', CLI::color($_SERVER['CI_ENVIRONMENT'] ?? ENVIRONMENT, 'green'))); CLI::newLine(); - return; + return EXIT_ERROR; } $env = strtolower(array_shift($params)); @@ -98,21 +98,21 @@ public function run(array $params) CLI::error('You will not be able to run spark under a "testing" environment.', 'light_gray', 'red'); CLI::newLine(); - return; + return EXIT_ERROR; } if (! in_array($env, self::$knownTypes, true)) { CLI::error(sprintf('Invalid environment type "%s". Expected one of "%s".', $env, implode('" and "', self::$knownTypes)), 'light_gray', 'red'); CLI::newLine(); - return; + return EXIT_ERROR; } if (! $this->writeNewEnvironmentToEnvFile($env)) { CLI::error('Error in writing new environment to .env file.', 'light_gray', 'red'); CLI::newLine(); - return; + return EXIT_ERROR; } // force DotEnv to reload the new environment @@ -124,6 +124,8 @@ public function run(array $params) CLI::write(sprintf('Environment is successfully changed to "%s".', $env), 'green'); CLI::write('The ENVIRONMENT constant will be changed in the next script execution.'); CLI::newLine(); + + return EXIT_SUCCESS; } /** diff --git a/system/Commands/Utilities/Optimize.php b/system/Commands/Utilities/Optimize.php index 11872bebafa5..1a103a1b9c52 100644 --- a/system/Commands/Utilities/Optimize.php +++ b/system/Commands/Utilities/Optimize.php @@ -55,7 +55,7 @@ final class Optimize extends BaseCommand protected $usage = 'optimize'; /** - * {@inheritDoc} + * @return int */ public function run(array $params) { @@ -63,13 +63,13 @@ public function run(array $params) $this->enableCaching(); $this->clearCache(); $this->removeDevPackages(); + + return EXIT_SUCCESS; } catch (RuntimeException) { CLI::error('The "spark optimize" failed.'); return EXIT_ERROR; } - - return EXIT_SUCCESS; } private function clearCache(): void diff --git a/system/Commands/Utilities/PhpIniCheck.php b/system/Commands/Utilities/PhpIniCheck.php index eb2192434133..f25518fb283d 100644 --- a/system/Commands/Utilities/PhpIniCheck.php +++ b/system/Commands/Utilities/PhpIniCheck.php @@ -68,7 +68,7 @@ final class PhpIniCheck extends BaseCommand protected $options = []; /** - * {@inheritDoc} + * @return int */ public function run(array $params) { diff --git a/system/Test/PhpStreamWrapper.php b/system/Test/PhpStreamWrapper.php index a6be8dd1329c..b49073c1f77b 100644 --- a/system/Test/PhpStreamWrapper.php +++ b/system/Test/PhpStreamWrapper.php @@ -52,7 +52,7 @@ public function stream_open(): bool } /** - * @return false|string + * @return string */ public function stream_read(int $count) { @@ -63,7 +63,7 @@ public function stream_read(int $count) } /** - * @return array|false + * @return array{} */ public function stream_stat() { diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index 1372386f4cae..e621c1616cf5 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 3615 errors +# total 3608 errors includes: - argument.type.neon - assign.propertyType.neon @@ -35,7 +35,6 @@ includes: - property.readOnlyByPhpDocAssignOutOfClass.neon - property.readOnlyByPhpDocDefaultValue.neon - property.unusedType.neon - - return.unusedType.neon - staticMethod.notFound.neon - ternary.shortNotAllowed.neon - varTag.type.neon diff --git a/utils/phpstan-baseline/missingType.iterableValue.neon b/utils/phpstan-baseline/missingType.iterableValue.neon index e8c7da4e7a0a..773002730217 100644 --- a/utils/phpstan-baseline/missingType.iterableValue.neon +++ b/utils/phpstan-baseline/missingType.iterableValue.neon @@ -1,4 +1,4 @@ -# total 1629 errors +# total 1628 errors parameters: ignoreErrors: @@ -5597,11 +5597,6 @@ parameters: count: 1 path: ../../system/Test/Mock/MockResult.php - - - message: '#^Method CodeIgniter\\Test\\PhpStreamWrapper\:\:stream_stat\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Test/PhpStreamWrapper.php - - message: '#^Method CodeIgniter\\Test\\TestResponse\:\:assertJSONExact\(\) has parameter \$test with no value type specified in iterable type array\.$#' count: 1 diff --git a/utils/phpstan-baseline/return.unusedType.neon b/utils/phpstan-baseline/return.unusedType.neon deleted file mode 100644 index fa3d56d30daf..000000000000 --- a/utils/phpstan-baseline/return.unusedType.neon +++ /dev/null @@ -1,33 +0,0 @@ -# total 6 errors - -parameters: - ignoreErrors: - - - message: '#^Method CodeIgniter\\Commands\\Utilities\\ConfigCheck\:\:run\(\) never returns void so it can be removed from the return type\.$#' - count: 1 - path: ../../system/Commands/Utilities/ConfigCheck.php - - - - message: '#^Method CodeIgniter\\Commands\\Utilities\\Environment\:\:run\(\) never returns int so it can be removed from the return type\.$#' - count: 1 - path: ../../system/Commands/Utilities/Environment.php - - - - message: '#^Method CodeIgniter\\Commands\\Utilities\\Optimize\:\:run\(\) never returns void so it can be removed from the return type\.$#' - count: 1 - path: ../../system/Commands/Utilities/Optimize.php - - - - message: '#^Method CodeIgniter\\Commands\\Utilities\\PhpIniCheck\:\:run\(\) never returns void so it can be removed from the return type\.$#' - count: 1 - path: ../../system/Commands/Utilities/PhpIniCheck.php - - - - message: '#^Method CodeIgniter\\Test\\PhpStreamWrapper\:\:stream_read\(\) never returns false so it can be removed from the return type\.$#' - count: 1 - path: ../../system/Test/PhpStreamWrapper.php - - - - message: '#^Method CodeIgniter\\Test\\PhpStreamWrapper\:\:stream_stat\(\) never returns false so it can be removed from the return type\.$#' - count: 1 - path: ../../system/Test/PhpStreamWrapper.php