From 731e891ae835928038a76454544a00ea019682fe Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 8 Mar 2024 09:01:18 +0900 Subject: [PATCH] docs: add/fix PHPDoc types --- phpstan-baseline.php | 30 ------------------------------ system/Test/Mock/MockCache.php | 10 ++++++++-- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 843603f976b5..4e77d744241a 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -3106,36 +3106,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Cannot unset offset string on array\\\\|null\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertHas\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertHasValue\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertMissing\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Return type \\(mixed\\) of method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:get\\(\\) should be covariant with return type \\(array\\|bool\\|float\\|int\\|object\\|string\\|null\\) of method CodeIgniter\\\\Cache\\\\CacheInterface\\:\\:get\\(\\)$#', - 'count' => 2, - 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Return type \\(mixed\\) of method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:remember\\(\\) should be covariant with return type \\(array\\|bool\\|float\\|int\\|object\\|string\\|null\\) of method CodeIgniter\\\\Cache\\\\Handlers\\\\BaseHandler\\:\\:remember\\(\\)$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', -]; $ignoreErrors[] = [ 'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#', 'count' => 2, diff --git a/system/Test/Mock/MockCache.php b/system/Test/Mock/MockCache.php index 8349b741bfc3..e61fdfa5dbbd 100644 --- a/system/Test/Mock/MockCache.php +++ b/system/Test/Mock/MockCache.php @@ -54,7 +54,7 @@ public function initialize() * * @param string $key Cache item name * - * @return mixed + * @return bool|null */ public function get(string $key) { @@ -66,7 +66,7 @@ public function get(string $key) /** * Get an item from the cache, or execute the given Closure and store the result. * - * @return mixed + * @return bool|null */ public function remember(string $key, int $ttl, Closure $callback) { @@ -266,6 +266,8 @@ public function bypass(bool $bypass = true) * Asserts that the cache has an item named $key. * The value is not checked since storing false or null * values is valid. + * + * @return void */ public function assertHas(string $key) { @@ -276,6 +278,8 @@ public function assertHas(string $key) * Asserts that the cache has an item named $key with a value matching $value. * * @param mixed $value + * + * @return void */ public function assertHasValue(string $key, $value = null) { @@ -292,6 +296,8 @@ public function assertHasValue(string $key, $value = null) /** * Asserts that the cache does NOT have an item named $key. + * + * @return void */ public function assertMissing(string $key) {