From 33f5a154c2b53d084f6733423eea042c7a0a3246 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 28 Oct 2023 21:52:04 +0800 Subject: [PATCH] Use native PHPDocs instead of `@phpstan-` --- app/Config/App.php | 3 +- app/Config/Autoload.php | 9 ++-- app/Config/Cache.php | 3 +- app/Config/Filters.php | 8 ++-- app/Config/Kint.php | 9 ++-- app/Config/Session.php | 2 +- phpstan-baseline.php | 5 +++ system/Autoloader/Autoloader.php | 11 ++--- system/BaseModel.php | 3 +- system/Cache/Handlers/BaseHandler.php | 7 ++- system/Cache/Handlers/FileHandler.php | 3 +- system/Commands/Database/ShowTableInfo.php | 2 +- .../Utilities/Routes/AutoRouteCollector.php | 3 +- .../AutoRouterImproved/AutoRouteCollector.php | 3 +- .../ControllerMethodReader.php | 12 +++-- .../Utilities/Routes/ControllerFinder.php | 5 +-- .../Routes/ControllerMethodReader.php | 7 ++- system/Common.php | 2 +- system/Config/AutoloadConfig.php | 6 +-- system/Config/Factories.php | 13 +++--- system/Database/BaseBuilder.php | 44 +++++++------------ system/Database/Config.php | 9 ++-- system/Database/Forge.php | 4 +- system/Database/SQLite3/Table.php | 3 +- system/Database/Seeder.php | 3 +- system/Debug/Exceptions.php | 3 -- system/Debug/Iterator.php | 2 +- system/Debug/Timer.php | 4 +- system/Debug/Toolbar.php | 1 - system/Debug/Toolbar/Collectors/Database.php | 1 - system/Email/Email.php | 3 +- system/Entity/Entity.php | 3 +- system/Filters/Filters.php | 9 ++-- system/HTTP/CLIRequest.php | 2 +- system/Helpers/kint_helper.php | 2 +- system/Log/Logger.php | 3 +- system/Router/AutoRouterImproved.php | 6 +-- system/Router/DefinedRouteCollector.php | 2 +- system/Router/RouteCollection.php | 15 +++---- system/Test/CIUnitTestCase.php | 3 +- tests/system/AutoReview/FrameworkCodeTest.php | 2 +- tests/system/Autoloader/AutoloaderTest.php | 2 +- tests/system/Cache/ResponseCacheTest.php | 2 +- 43 files changed, 95 insertions(+), 149 deletions(-) diff --git a/app/Config/App.php b/app/Config/App.php index 186bfa86bb02..6ae678625e7b 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -27,8 +27,7 @@ class App extends BaseConfig * 'http://accounts.example.com/': * ['media.example.com', 'accounts.example.com'] * - * @var string[] - * @phpstan-var list + * @var list */ public array $allowedHostnames = []; diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index 22f05ecdab26..7a4602d72920 100644 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -41,8 +41,7 @@ class Autoload extends AutoloadConfig * 'App' => APPPATH * ]; * - * @var array|string> - * @phpstan-var array> + * @var array|string> */ public $psr4 = [ APP_NAMESPACE => APPPATH, // For custom app namespace @@ -81,8 +80,7 @@ class Autoload extends AutoloadConfig * '/path/to/my/file.php', * ]; * - * @var string[] - * @phpstan-var list + * @var list */ public $files = []; @@ -95,8 +93,7 @@ class Autoload extends AutoloadConfig * 'form', * ]; * - * @var string[] - * @phpstan-var list + * @var list */ public $helpers = []; } diff --git a/app/Config/Cache.php b/app/Config/Cache.php index 61cdd50de890..b5b2cdc1738f 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -158,8 +158,7 @@ class Cache extends BaseConfig * This is an array of cache engine alias' and class names. Only engines * that are listed here are allowed to be used. * - * @var array - * @phpstan-var array> + * @var array> */ public array $validHandlers = [ 'dummy' => DummyHandler::class, diff --git a/app/Config/Filters.php b/app/Config/Filters.php index 41e76267a448..ac37b414c45c 100644 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -15,9 +15,8 @@ class Filters extends BaseConfig * Configures aliases for Filter classes to * make reading things nicer and simpler. * - * @var array|string> [filter_name => classname] - * or [filter_name => [classname1, classname2, ...]] - * @phpstan-var array> + * @var array> [filter_name => classname] + * or [filter_name => [classname1, classname2, ...]] */ public array $aliases = [ 'csrf' => CSRF::class, @@ -31,8 +30,7 @@ class Filters extends BaseConfig * List of filter aliases that are always * applied before and after every request. * - * @var array>>|array> - * @phpstan-var array>|array>> + * @var array>>|array> */ public array $globals = [ 'before' => [ diff --git a/app/Config/Kint.php b/app/Config/Kint.php index cc8b54592b6b..77aeb08f1432 100644 --- a/app/Config/Kint.php +++ b/app/Config/Kint.php @@ -27,8 +27,7 @@ class Kint extends BaseConfig */ /** - * @var array - * @phpstan-var list|ConstructablePluginInterface> + * @var list|ConstructablePluginInterface> */ public $plugins; @@ -46,14 +45,12 @@ class Kint extends BaseConfig public int $richSort = AbstractRenderer::SORT_FULL; /** - * @var array - * @phpstan-var array> + * @var array> */ public $richObjectPlugins; /** - * @var array - * @phpstan-var array> + * @var array> */ public $richTabPlugins; diff --git a/app/Config/Session.php b/app/Config/Session.php index ea834805e5a6..e077df64bd46 100644 --- a/app/Config/Session.php +++ b/app/Config/Session.php @@ -19,7 +19,7 @@ class Session extends BaseConfig * - `CodeIgniter\Session\Handlers\MemcachedHandler` * - `CodeIgniter\Session\Handlers\RedisHandler` * - * @phpstan-var class-string + * @var class-string */ public string $driver = FileHandler::class; diff --git a/phpstan-baseline.php b/phpstan-baseline.php index cfde40738834..6071e62e3785 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -16,6 +16,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/Autoloader/Autoloader.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Property Config\\\\Autoload\\:\\:\\$helpers \\(array\\\\) in isset\\(\\) is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Autoloader/Autoloader.php', +]; $ignoreErrors[] = [ 'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#', 'count' => 13, diff --git a/system/Autoloader/Autoloader.php b/system/Autoloader/Autoloader.php index ecfd92b5ef8b..ca886fb535bf 100644 --- a/system/Autoloader/Autoloader.php +++ b/system/Autoloader/Autoloader.php @@ -75,8 +75,7 @@ class Autoloader /** * Stores files as a list. * - * @var string[] - * @phpstan-var list + * @var list */ protected $files = []; @@ -84,8 +83,7 @@ class Autoloader * Stores helper list. * Always load the URL helper, it should be used in most apps. * - * @var string[] - * @phpstan-var list + * @var list */ protected $helpers = ['url']; @@ -119,7 +117,7 @@ public function initialize(Autoload $config, Modules $modules) $this->files = $config->files; } - if (isset($config->helpers)) { // @phpstan-ignore-line + if (isset($config->helpers)) { $this->helpers = [...$this->helpers, ...$config->helpers]; } @@ -185,8 +183,7 @@ public function unregister(): void /** * Registers namespaces with the autoloader. * - * @param array|string>|string $namespace - * @phpstan-param array|string>|string $namespace + * @param array|string>|string $namespace * * @return $this */ diff --git a/system/BaseModel.php b/system/BaseModel.php index c27afd027423..80baaf3fb024 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -63,8 +63,7 @@ abstract class BaseModel * The Database connection group that * should be instantiated. * - * @var string|null - * @phpstan-var non-empty-string|null + * @var non-empty-string|null */ protected $DBGroup; diff --git a/system/Cache/Handlers/BaseHandler.php b/system/Cache/Handlers/BaseHandler.php index c12b330bc469..061a4a661b8a 100644 --- a/system/Cache/Handlers/BaseHandler.php +++ b/system/Cache/Handlers/BaseHandler.php @@ -76,10 +76,9 @@ public static function validateKey($key, $prefix = ''): string /** * Get an item from the cache, or execute the given Closure and store the result. * - * @param string $key Cache item name - * @param int $ttl Time to live - * @param Closure $callback Callback return value - * @phpstan-param Closure(): mixed $callback + * @param string $key Cache item name + * @param int $ttl Time to live + * @param Closure(): mixed $callback Callback return value * * @return array|bool|float|int|object|string|null */ diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index e22543d27891..54cafdc5f35b 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -222,8 +222,7 @@ public function isSupported(): bool * Does the heavy lifting of actually retrieving the file and * verifying it's age. * - * @return array|false - * @phpstan-return array{data: mixed, ttl: int, time: int}|false + * @return array{data: mixed, ttl: int, time: int}|false */ protected function getItem(string $filename) { diff --git a/system/Commands/Database/ShowTableInfo.php b/system/Commands/Database/ShowTableInfo.php index 07aa60c961ca..f955c6b27011 100644 --- a/system/Commands/Database/ShowTableInfo.php +++ b/system/Commands/Database/ShowTableInfo.php @@ -84,7 +84,7 @@ class ShowTableInfo extends BaseCommand ]; /** - * @phpstan-var list> Table Data. + * @var list> Table Data. */ private array $tbody; diff --git a/system/Commands/Utilities/Routes/AutoRouteCollector.php b/system/Commands/Utilities/Routes/AutoRouteCollector.php index ee331332291b..cc45608f21e8 100644 --- a/system/Commands/Utilities/Routes/AutoRouteCollector.php +++ b/system/Commands/Utilities/Routes/AutoRouteCollector.php @@ -37,8 +37,7 @@ public function __construct(string $namespace, string $defaultController, string } /** - * @return array> - * @phpstan-return list> + * @return list> */ public function get(): array { diff --git a/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php b/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php index 0b9089ce2ade..18a158cffa4f 100644 --- a/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php +++ b/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php @@ -62,8 +62,7 @@ public function __construct( } /** - * @return array> - * @phpstan-return list> + * @return list> */ public function get(): array { diff --git a/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php b/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php index a8b6912d4bf7..6b865226d626 100644 --- a/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php +++ b/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php @@ -27,8 +27,7 @@ final class ControllerMethodReader private string $namespace; /** - * @var array - * @phpstan-var list + * @var list */ private array $httpMethods; @@ -44,10 +43,9 @@ public function __construct(string $namespace, array $httpMethods) /** * Returns found route info in the controller. * - * @phpstan-param class-string $class + * @param class-string $class * - * @return array> - * @phpstan-return list> + * @return list> */ public function read(string $class, string $defaultController = 'Home', string $defaultMethod = 'index'): array { @@ -154,7 +152,7 @@ private function getParameters(ReflectionMethod $method): array } /** - * @phpstan-param class-string $classname + * @param class-string $classname * * @return string URI path part from the folder(s) and controller */ @@ -179,7 +177,7 @@ private function getUriByClass(string $classname): string /** * Gets a route for the default controller. * - * @phpstan-return list + * @return list */ private function getRouteForDefaultController( string $classShortname, diff --git a/system/Commands/Utilities/Routes/ControllerFinder.php b/system/Commands/Utilities/Routes/ControllerFinder.php index f801d531fa92..3982c454a78e 100644 --- a/system/Commands/Utilities/Routes/ControllerFinder.php +++ b/system/Commands/Utilities/Routes/ControllerFinder.php @@ -38,8 +38,7 @@ public function __construct(string $namespace) } /** - * @return string[] - * @phpstan-return class-string[] + * @return class-string[] */ public function find(): array { @@ -66,7 +65,7 @@ public function find(): array $classnameOrEmpty = $this->locator->getClassname($file); if ($classnameOrEmpty !== '') { - /** @phpstan-var class-string $classname */ + /** @var class-string $classname */ $classname = $classnameOrEmpty; $classes[] = $classname; diff --git a/system/Commands/Utilities/Routes/ControllerMethodReader.php b/system/Commands/Utilities/Routes/ControllerMethodReader.php index eb0152dec623..31bcde12dfb8 100644 --- a/system/Commands/Utilities/Routes/ControllerMethodReader.php +++ b/system/Commands/Utilities/Routes/ControllerMethodReader.php @@ -35,10 +35,9 @@ public function __construct(string $namespace) } /** - * @phpstan-param class-string $class + * @param class-string $class * - * @return array - * @phpstan-return list + * @return list */ public function read(string $class, string $defaultController = 'Home', string $defaultMethod = 'index'): array { @@ -128,7 +127,7 @@ private function hasRemap(ReflectionClass $class): bool } /** - * @phpstan-param class-string $classname + * @param class-string $classname * * @return string URI path part from the folder(s) and controller */ diff --git a/system/Common.php b/system/Common.php index 80dca72c74e3..9ad7fe5b842b 100644 --- a/system/Common.php +++ b/system/Common.php @@ -1139,7 +1139,7 @@ function stringify_attributes($attributes, bool $js = false): string * returns its return value if any. * Otherwise will start or stop the timer intelligently. * - * @phpstan-param (callable(): mixed)|null $callable + * @param (callable(): mixed)|null $callable * * @return Timer */ diff --git a/system/Config/AutoloadConfig.php b/system/Config/AutoloadConfig.php index da08dd6f6640..33c977cc0bb6 100644 --- a/system/Config/AutoloadConfig.php +++ b/system/Config/AutoloadConfig.php @@ -45,8 +45,7 @@ class AutoloadConfig * but this should be done prior to creating any namespaced classes, * else you will need to modify all of those classes for this to work. * - * @var array|string> - * @phpstan-var array> + * @var array|string> */ public $psr4 = []; @@ -72,8 +71,7 @@ class AutoloadConfig * that will be autoloaded. This can be useful for bootstrap operations * or for loading functions. * - * @var array - * @phpstan-var list + * @var list */ public $files = []; diff --git a/system/Config/Factories.php b/system/Config/Factories.php index 8eb68b0d3643..c86bfd95cc5d 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -62,8 +62,7 @@ class Factories * * [component => [alias => FQCN]] * - * @var array> - * @phpstan-var array> + * @var array> */ protected static $aliases = []; @@ -76,8 +75,7 @@ class Factories * * [component => [FQCN => instance]] * - * @var array> - * @phpstan-var array> + * @var array> */ protected static $instances = []; @@ -93,10 +91,9 @@ class Factories /** * Define the class to load. You can *override* the concrete class. * - * @param string $component Lowercase, plural component name - * @param string $alias Class alias. See the $aliases property. - * @param string $classname FQCN to be loaded - * @phpstan-param class-string $classname FQCN to be loaded + * @param string $component Lowercase, plural component name + * @param string $alias Class alias. See the $aliases property. + * @param class-string $classname FQCN to be loaded */ public static function define(string $component, string $alias, string $classname): void { diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 302020323577..12bd14f73ab1 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -88,8 +88,7 @@ class BaseBuilder * QB keys * list of column names. * - * @var string[] - * @phpstan-var list + * @var list */ protected $QBKeys = []; @@ -131,8 +130,7 @@ class BaseBuilder /** * QB data sets * - * @var array[]|string[] - * @phpstan-var array|list> + * @var array|list> */ protected $QBSet = []; @@ -164,7 +162,7 @@ class BaseBuilder * Holds additional options and data used to render SQL * and is reset by resetWrite() * - * @phpstan-var array{ + * @var array{ * updateFieldsAdditional?: array, * tableIdentity?: string, * updateFields?: array, @@ -173,7 +171,6 @@ class BaseBuilder * sql?: string, * alias?: string * } - * @var array */ protected $QBOptions; @@ -1967,11 +1964,9 @@ public function upsertBatch($set = null, ?bool $escape = null, int $batchSize = * * @used-by batchExecute * - * @param string $table Protected table name - * @param string[] $keys QBKeys - * @phpstan-param list $keys QBKeys - * @param array> $values QBSet - * @phpstan-param list> $values QBSet + * @param string $table Protected table name + * @param list $keys QBKeys + * @param list> $values QBSet */ protected function _upsertBatch(string $table, array $keys, array $values): string { @@ -2196,11 +2191,9 @@ public function insertBatch($set = null, ?bool $escape = null, int $batchSize = * * @used-by batchExecute * - * @param string $table Protected table name - * @param string[] $keys QBKeys - * @phpstan-param list $keys QBKeys - * @param array> $values QBSet - * @phpstan-param list> $values QBSet + * @param string $table Protected table name + * @param list $keys QBKeys + * @param list> $values QBSet */ protected function _insertBatch(string $table, array $keys, array $values): string { @@ -2566,11 +2559,9 @@ public function updateBatch($set = null, $constraints = null, int $batchSize = 1 * * @used-by batchExecute * - * @param string $table Protected table name - * @param string[] $keys QBKeys - * @phpstan-param list $keys QBKeys - * @param array[] $values QBSet - * @phpstan-param list> $values QBSet + * @param string $table Protected table name + * @param list $keys QBKeys + * @param list> $values QBSet */ protected function _updateBatch(string $table, array $keys, array $values): string { @@ -2830,11 +2821,9 @@ public function deleteBatch($set = null, $constraints = null, int $batchSize = 1 * * @used-by batchExecute * - * @param string $table Protected table name - * @param string[] $keys QBKeys - * @phpstan-param list $keys QBKeys - * @param array> $values QBSet - * @phpstan-param list> $values QBSet + * @param string $table Protected table name + * @param list $keys QBKeys + * @paramst> $values QBSet */ protected function _deleteBatch(string $table, array $keys, array $values): string { @@ -3412,8 +3401,7 @@ protected function getOperator(string $str, bool $list = false) /** * Returns the SQL string operator from where key * - * @return array|false - * @phpstan-return list|false + * @return false|list */ private function getOperatorFromWhereKey(string $whereKey) { diff --git a/system/Database/Config.php b/system/Database/Config.php index 62fa79202d26..92556c6d8fef 100644 --- a/system/Database/Config.php +++ b/system/Database/Config.php @@ -41,10 +41,9 @@ class Config extends BaseConfig /** * Returns the database connection * - * @param array|BaseConnection|string|null $group The name of the connection group to use, - * or an array of configuration settings. - * @phpstan-param array|BaseConnection|non-empty-string|null $group - * @param bool $getShared Whether to return a shared instance of the connection. + * @param array|BaseConnection|non-empty-string|null $group The name of the connection group to use, + * or an array of configuration settings. + * @param bool $getShared Whether to return a shared instance of the connection. * * @return BaseConnection */ @@ -127,7 +126,7 @@ public static function utils($group = null) /** * Returns a new instance of the Database Seeder. * - * @phpstan-param null|non-empty-string $group + * @param non-empty-string|null $group * * @return Seeder */ diff --git a/system/Database/Forge.php b/system/Database/Forge.php index ae26f6e7457d..57e43bf199fe 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -39,7 +39,7 @@ class Forge /** * List of keys. * - * @phpstan-var array{}|list + * @var list */ protected $keys = []; @@ -53,7 +53,7 @@ class Forge /** * Primary keys. * - * @phpstan-var array{}|array{fields: string[], keyName: string} + * @var array{fields?: string[], keyName?: string} */ protected $primaryKeys = []; diff --git a/system/Database/SQLite3/Table.php b/system/Database/SQLite3/Table.php index 4ed9b5152eea..879437da6f6a 100644 --- a/system/Database/SQLite3/Table.php +++ b/system/Database/SQLite3/Table.php @@ -28,8 +28,7 @@ class Table /** * All of the fields this table represents. * - * @var array - * @phpstan-var array> + * @var array> */ protected $fields = []; diff --git a/system/Database/Seeder.php b/system/Database/Seeder.php index f51fa417b4ed..749f6f34d5c7 100644 --- a/system/Database/Seeder.php +++ b/system/Database/Seeder.php @@ -25,8 +25,7 @@ class Seeder /** * The name of the database group to use. * - * @var string - * @phpstan-var non-empty-string + * @var non-empty-string */ protected $DBGroup; diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index bbcfcc8e8889..a9887fba15ce 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -117,7 +117,6 @@ public function initialize() * and fire an event that allows custom actions to be taken at this point. * * @return void - * @phpstan-return never|void */ public function exceptionHandler(Throwable $exception) { @@ -215,7 +214,6 @@ public function errorHandler(int $severity, string $message, ?string $file = nul * @codeCoverageIgnore * * @return void - * @phpstan-return never|void */ public function shutdownHandler() { @@ -280,7 +278,6 @@ protected function determineView(Throwable $exception, string $templatePath): st * Given an exception and status code will display the error to the client. * * @return void - * @phpstan-return never|void * * @deprecated 4.4.0 No longer used. Moved to BaseExceptionHandler. */ diff --git a/system/Debug/Iterator.php b/system/Debug/Iterator.php index f54335b6dd70..2163bb0b2587 100644 --- a/system/Debug/Iterator.php +++ b/system/Debug/Iterator.php @@ -38,7 +38,7 @@ class Iterator * Tests are simply closures that the user can define any sequence of * things to happen during the test. * - * @phpstan-param Closure(): mixed $closure + * @param Closure(): mixed $closure * * @return $this */ diff --git a/system/Debug/Timer.php b/system/Debug/Timer.php index d43bf1c5a32a..103094b0a641 100644 --- a/system/Debug/Timer.php +++ b/system/Debug/Timer.php @@ -133,8 +133,8 @@ public function has(string $name): bool * Executes callable and measures its time. * Returns its return value if any. * - * @param string $name The name of the timer - * @phpstan-param callable(): mixed $callable callable to be executed + * @param string $name The name of the timer + * @param callable(): mixed $callable callable to be executed * * @return array|bool|float|int|object|resource|string|null */ diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index 73c777ba7289..4a7a20632fd7 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -435,7 +435,6 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r * @codeCoverageIgnore * * @return void - * @phpstan-return never|void */ public function respond() { diff --git a/system/Debug/Toolbar/Collectors/Database.php b/system/Debug/Toolbar/Collectors/Database.php index 4b2ff96fe8b5..b527f2ed3c95 100644 --- a/system/Debug/Toolbar/Collectors/Database.php +++ b/system/Debug/Toolbar/Collectors/Database.php @@ -80,7 +80,6 @@ public function __construct() * @internal * * @return void - * @phpstan-return never|void */ public static function collect(Query $query) { diff --git a/system/Email/Email.php b/system/Email/Email.php index a6ad2d993204..0adb3e6eb5e6 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -352,8 +352,7 @@ class Email * Character sets valid for 7-bit encoding, * excluding language suffix. * - * @var array - * @phpstan-var list + * @var list */ protected $baseCharsets = [ 'us-ascii', diff --git a/system/Entity/Entity.php b/system/Entity/Entity.php index 65898c012dc9..90d3ab46a297 100644 --- a/system/Entity/Entity.php +++ b/system/Entity/Entity.php @@ -55,8 +55,7 @@ class Entity implements JsonSerializable /** * The date fields. * - * @var array - * @phpstan-var list + * @var list */ protected $dates = [ 'created_at', diff --git a/system/Filters/Filters.php b/system/Filters/Filters.php index df27e3f6cee3..18001b103844 100644 --- a/system/Filters/Filters.php +++ b/system/Filters/Filters.php @@ -87,16 +87,14 @@ class Filters /** * Any arguments to be passed to filters. * - * @var array|null> [name => params] - * @phpstan-var array|null> + * @var array|null> [name => params] */ protected $arguments = []; /** * Any arguments to be passed to filtersClass. * - * @var array [classname => arguments] - * @phpstan-var array>|null> + * @var array>|null> [classname => arguments] */ protected $argumentsClass = []; @@ -373,8 +371,7 @@ public function enableFilter(string $name, string $when = 'before') * * @param string $name filter_name or filter_name:arguments like 'role:admin,manager' * - * @return array [name, arguments] - * @phpstan-return array{0: string, 1: list} + * @return array{0: string, 1: list} [name, arguments] */ private function getCleanName(string $name): array { diff --git a/system/HTTP/CLIRequest.php b/system/HTTP/CLIRequest.php index 878e8a1d66c6..6e713983a67c 100644 --- a/system/HTTP/CLIRequest.php +++ b/system/HTTP/CLIRequest.php @@ -316,7 +316,7 @@ public function getLocale(): string * Checks this request type. * * @param string $type HTTP verb or 'json' or 'ajax' - * @phpstan-param string|'get'|'post'|'put'|'delete'|'head'|'patch'|'options'|'json'|'ajax' $type + * @phpstan-param 'get'|'post'|'put'|'delete'|'head'|'patch'|'options'|'json'|'ajax' $type */ public function is(string $type): bool { diff --git a/system/Helpers/kint_helper.php b/system/Helpers/kint_helper.php index eaa2e947bc96..4221573a2ce6 100644 --- a/system/Helpers/kint_helper.php +++ b/system/Helpers/kint_helper.php @@ -18,7 +18,7 @@ * * @param array $vars * - * @phpstan-return never + * @return never * * @codeCoverageIgnore Can't be tested ... exits */ diff --git a/system/Log/Logger.php b/system/Log/Logger.php index afd703147870..0964edc4f3bf 100644 --- a/system/Log/Logger.php +++ b/system/Log/Logger.php @@ -93,8 +93,7 @@ class Logger implements LoggerInterface * value is an associative array of configuration * items. * - * @var array - * @phpstan-var array|string|int>> + * @var array|string>> */ protected $handlerConfig = []; diff --git a/system/Router/AutoRouterImproved.php b/system/Router/AutoRouterImproved.php index 0a26fc12f865..a86e92f0161a 100644 --- a/system/Router/AutoRouterImproved.php +++ b/system/Router/AutoRouterImproved.php @@ -49,7 +49,7 @@ final class AutoRouterImproved implements AutoRouterInterface /** * An array of params to the controller method. * - * @phpstan-var list + * @var list */ private array $params = []; @@ -77,7 +77,7 @@ final class AutoRouterImproved implements AutoRouterInterface /** * The URI segments. * - * @phpstan-var list + * @var list */ private array $segments = []; @@ -286,7 +286,7 @@ public function getRoute(string $uri, string $httpVerb): array } // The first item may be a method name. - /** @phpstan-var list $params */ + /** @var list $params */ $params = $this->params; $methodParam = array_shift($params); diff --git a/system/Router/DefinedRouteCollector.php b/system/Router/DefinedRouteCollector.php index f8e245d19723..4fdbbb02597b 100644 --- a/system/Router/DefinedRouteCollector.php +++ b/system/Router/DefinedRouteCollector.php @@ -29,7 +29,7 @@ public function __construct(RouteCollection $routes) } /** - * @phpstan-return Generator + * @return Generator */ public function collect(): Generator { diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index b3bb96e9fa2b..9a51e6f89a98 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1267,8 +1267,7 @@ public function getFilterForRoute(string $search, ?string $verb = null): string * * @param string $search routeKey * - * @return array filter_name or filter_name:arguments like 'role:admin,manager' - * @phpstan-return list + * @return list filter_name or filter_name:arguments like 'role:admin,manager' */ public function getFiltersForRoute(string $search, ?string $verb = null): array { @@ -1305,8 +1304,7 @@ protected function fillRouteParams(string $from, ?array $params = null): string * Build our resulting string, inserting the $params in * the appropriate places. * - * @var array $patterns - * @phpstan-var list $patterns + * @var list $patterns */ $patterns = $matches[0]; @@ -1357,8 +1355,7 @@ protected function buildReverseRoute(string $from, array $params): string * Build our resulting string, inserting the $params in * the appropriate places. * - * @var array $placeholders - * @phpstan-var list $placeholders + * @var list $placeholders */ $placeholders = $matches[0]; @@ -1691,8 +1688,7 @@ public function resetRoutes() /** * Load routes options based on verb * - * @return array> [routeKey(or from) => [key => value]] - * @phpstan-return array< + * @return array< * string, * array{ * filter?: string|list, namespace?: string, hostname?: string, @@ -1740,8 +1736,7 @@ public function setPrioritize(bool $enabled = true) * * @param string|null $verb HTTP verb. `'*'` returns all controllers in any verb. * - * @return array controller name list - * @phpstan-return list + * @return list controller name list */ public function getRegisteredControllers(?string $verb = '*'): array { diff --git a/system/Test/CIUnitTestCase.php b/system/Test/CIUnitTestCase.php index a0c84c48f2b7..4e889b5ea1d0 100644 --- a/system/Test/CIUnitTestCase.php +++ b/system/Test/CIUnitTestCase.php @@ -135,8 +135,7 @@ abstract class CIUnitTestCase extends TestCase * The name of the database group to connect to. * If not present, will use the defaultGroup. * - * @var string - * @phpstan-var non-empty-string + * @var non-empty-string */ protected $DBGroup = 'tests'; diff --git a/tests/system/AutoReview/FrameworkCodeTest.php b/tests/system/AutoReview/FrameworkCodeTest.php index e61e0663836b..6583c9f2839e 100644 --- a/tests/system/AutoReview/FrameworkCodeTest.php +++ b/tests/system/AutoReview/FrameworkCodeTest.php @@ -41,7 +41,7 @@ final class FrameworkCodeTest extends TestCase /** * @dataProvider provideEachTestClassHasCorrectGroupAnnotation * - * @phpstan-param class-string $class + * @param class-string $class */ public function testEachTestClassHasCorrectGroupAnnotation(string $class): void { diff --git a/tests/system/Autoloader/AutoloaderTest.php b/tests/system/Autoloader/AutoloaderTest.php index 4c81537dbf09..6624c6f3cf1b 100644 --- a/tests/system/Autoloader/AutoloaderTest.php +++ b/tests/system/Autoloader/AutoloaderTest.php @@ -35,7 +35,7 @@ final class AutoloaderTest extends CIUnitTestCase private Autoloader $loader; /** - * @phpstan-var Closure(string): (false|string) + * @var Closure(string): (false|string) */ private Closure $classLoader; diff --git a/tests/system/Cache/ResponseCacheTest.php b/tests/system/Cache/ResponseCacheTest.php index a1079e63a463..12eaeb1a2d23 100644 --- a/tests/system/Cache/ResponseCacheTest.php +++ b/tests/system/Cache/ResponseCacheTest.php @@ -68,7 +68,7 @@ private function createIncomingRequest( } /** - * @phpstan-param list $params + * @param list $params */ private function createCLIRequest(array $params = [], ?AppConfig $appConfig = null): CLIRequest {