diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 9665737db821..cf5e2fe76b2d 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1,6 +1,16 @@ '#^PHPDoc type array of property Config\\\\View\\:\\:\\$filters is not covariant with PHPDoc type array\\ of overridden property CodeIgniter\\\\Config\\\\View\\:\\:\\$filters\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/app/Config/View.php', +]; +$ignoreErrors[] = [ + 'message' => '#^PHPDoc type array of property Config\\\\View\\:\\:\\$plugins is not covariant with PHPDoc type array\\ of overridden property CodeIgniter\\\\Config\\\\View\\:\\:\\$plugins\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/app/Config/View.php', +]; $ignoreErrors[] = [ 'message' => '#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(CodeIgniter\\\\Autoloader\\\\Autoloader\\), \'loadClass\'\\} given\\.$#', 'count' => 1, @@ -317,67 +327,22 @@ 'path' => __DIR__ . '/system/ComposerScripts.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\BaseConfig\\:\\:registerProperties\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/BaseConfig.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\BaseService\\:\\:injectMock\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/BaseService.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\BaseService\\:\\:reset\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/BaseService.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\BaseService\\:\\:resetSingle\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/BaseService.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\Config\\:\\:injectMock\\(\\) has no return type specified\\.$#', + 'message' => '#^Property CodeIgniter\\\\Config\\\\View\\:\\:\\$coreFilters type has no signature specified for callable\\.$#', 'count' => 1, - 'path' => __DIR__ . '/system/Config/Config.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\Config\\:\\:reset\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/Config.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\DotEnv\\:\\:setVariable\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/DotEnv.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\Factories\\:\\:injectMock\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/Factories.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\Factories\\:\\:reset\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/Factories.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Config\\\\ForeignCharacters\\:\\:\\$characterList has no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Config/ForeignCharacters.php', + 'path' => __DIR__ . '/system/Config/View.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Config\\\\Publisher\\:\\:registerProperties\\(\\) has no return type specified\\.$#', + 'message' => '#^Property CodeIgniter\\\\Config\\\\View\\:\\:\\$corePlugins type has no signature specified for callable\\.$#', 'count' => 1, - 'path' => __DIR__ . '/system/Config/Publisher.php', + 'path' => __DIR__ . '/system/Config/View.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Config\\\\View\\:\\:\\$filters has no type specified\\.$#', + 'message' => '#^Property CodeIgniter\\\\Config\\\\View\\:\\:\\$filters type has no signature specified for callable\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Config/View.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Config\\\\View\\:\\:\\$plugins has no type specified\\.$#', + 'message' => '#^Property CodeIgniter\\\\Config\\\\View\\:\\:\\$plugins type has no signature specified for callable\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Config/View.php', ]; diff --git a/system/Config/BaseConfig.php b/system/Config/BaseConfig.php index 80ae268635ef..0958d7ae7f75 100644 --- a/system/Config/BaseConfig.php +++ b/system/Config/BaseConfig.php @@ -169,6 +169,8 @@ protected function getEnvValue(string $property, string $prefix, string $shortPr * Provides external libraries a simple way to register one or more * options into a config file. * + * @return void + * * @throws ReflectionException */ protected function registerProperties() diff --git a/system/Config/BaseService.php b/system/Config/BaseService.php index d517691b0c1f..e41c0c0ed06f 100644 --- a/system/Config/BaseService.php +++ b/system/Config/BaseService.php @@ -273,6 +273,8 @@ public static function serviceExists(string $name): ?string /** * Reset shared instances and mocks for testing. + * + * @return void */ public static function reset(bool $initAutoloader = true) { @@ -286,6 +288,8 @@ public static function reset(bool $initAutoloader = true) /** * Resets any mock and shared instances for a single service. + * + * @return void */ public static function resetSingle(string $name) { @@ -297,6 +301,8 @@ public static function resetSingle(string $name) * Inject mock object for testing. * * @param object $mock + * + * @return void */ public static function injectMock(string $name, $mock) { diff --git a/system/Config/Config.php b/system/Config/Config.php index d261fa4d9ae4..3008865b29fa 100644 --- a/system/Config/Config.php +++ b/system/Config/Config.php @@ -34,6 +34,8 @@ public static function get(string $name, bool $getShared = true) * Helper method for injecting mock instances while testing. * * @param object $instance + * + * @return void */ public static function injectMock(string $name, $instance) { @@ -42,6 +44,8 @@ public static function injectMock(string $name, $instance) /** * Resets the static arrays + * + * @return void */ public static function reset() { diff --git a/system/Config/DotEnv.php b/system/Config/DotEnv.php index 724524e2d590..0275b5c4b9c3 100644 --- a/system/Config/DotEnv.php +++ b/system/Config/DotEnv.php @@ -85,6 +85,8 @@ public function parse(): ?array * Sets the variable into the environment. Will parse the string * first to look for {name}={value} pattern, ensure that nested * variables are handled, and strip it of single and double quotes. + * + * @return void */ protected function setVariable(string $name, string $value = '') { diff --git a/system/Config/Factories.php b/system/Config/Factories.php index 222df063196a..f14471c5fda7 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -267,6 +267,8 @@ public static function setOptions(string $component, array $values): array * Resets the static arrays, optionally just for one component * * @param string|null $component Lowercase, plural component name + * + * @return void */ public static function reset(?string $component = null) { @@ -290,6 +292,8 @@ public static function reset(?string $component = null) * * @param string $component Lowercase, plural component name * @param string $name The name of the instance + * + * @return void */ public static function injectMock(string $component, string $name, object $instance) { diff --git a/system/Config/ForeignCharacters.php b/system/Config/ForeignCharacters.php index f2e7cc57cabf..a8569f5419c5 100644 --- a/system/Config/ForeignCharacters.php +++ b/system/Config/ForeignCharacters.php @@ -17,7 +17,9 @@ class ForeignCharacters { /** - * Without further ado, the list of foreign characters. + * The list of foreign characters. + * + * @var array */ public $characterList = [ '/ä|æ|ǽ/' => 'ae', diff --git a/system/Config/Publisher.php b/system/Config/Publisher.php index 608e87afef8e..fa04e24cd28f 100644 --- a/system/Config/Publisher.php +++ b/system/Config/Publisher.php @@ -36,7 +36,7 @@ class Publisher extends BaseConfig /** * Disables Registrars to prevent modules from altering the restrictions. */ - final protected function registerProperties() + final protected function registerProperties(): void { } } diff --git a/system/Config/View.php b/system/Config/View.php index 42d40faf879e..de4ed62b936a 100644 --- a/system/Config/View.php +++ b/system/Config/View.php @@ -33,6 +33,9 @@ class View extends BaseConfig * * To prevent potential abuse, all filters MUST be defined here * in order for them to be available for use within the Parser. + * + * @var array + * @phpstan-var array */ public $filters = []; @@ -40,13 +43,17 @@ class View extends BaseConfig * Parser Plugins provide a way to extend the functionality provided * by the core Parser by creating aliases that will be replaced with * any callable. Can be single or tag pair. + * + * @var array + * @phpstan-var array */ public $plugins = []; /** * Built-in View filters. * - * @var array + * @var array + * @phpstan-var array */ protected $coreFilters = [ 'abs' => '\abs', @@ -75,7 +82,8 @@ class View extends BaseConfig /** * Built-in View plugins. * - * @var array + * @var array + * @phpstan-var array */ protected $corePlugins = [ 'csp_script_nonce' => '\CodeIgniter\View\Plugins::cspScriptNonce',