Skip to content

Commit 9342e38

Browse files
authored
Merge pull request #8612 from kenjis/fix-MockCache-phpstan-errors
docs: add/fix PHPDoc types in MockCache
2 parents bcb88b4 + 731e891 commit 9342e38

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,36 +3106,6 @@
31063106
'count' => 1,
31073107
'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php',
31083108
];
3109-
$ignoreErrors[] = [
3110-
'message' => '#^Cannot unset offset string on array\\<int, int\\>\\|null\\.$#',
3111-
'count' => 2,
3112-
'path' => __DIR__ . '/system/Test/Mock/MockCache.php',
3113-
];
3114-
$ignoreErrors[] = [
3115-
'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertHas\\(\\) has no return type specified\\.$#',
3116-
'count' => 1,
3117-
'path' => __DIR__ . '/system/Test/Mock/MockCache.php',
3118-
];
3119-
$ignoreErrors[] = [
3120-
'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertHasValue\\(\\) has no return type specified\\.$#',
3121-
'count' => 1,
3122-
'path' => __DIR__ . '/system/Test/Mock/MockCache.php',
3123-
];
3124-
$ignoreErrors[] = [
3125-
'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertMissing\\(\\) has no return type specified\\.$#',
3126-
'count' => 1,
3127-
'path' => __DIR__ . '/system/Test/Mock/MockCache.php',
3128-
];
3129-
$ignoreErrors[] = [
3130-
'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\\(\\)$#',
3131-
'count' => 2,
3132-
'path' => __DIR__ . '/system/Test/Mock/MockCache.php',
3133-
];
3134-
$ignoreErrors[] = [
3135-
'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\\(\\)$#',
3136-
'count' => 1,
3137-
'path' => __DIR__ . '/system/Test/Mock/MockCache.php',
3138-
];
31393109
$ignoreErrors[] = [
31403110
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
31413111
'count' => 2,

system/Test/Mock/MockCache.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function initialize()
5454
*
5555
* @param string $key Cache item name
5656
*
57-
* @return mixed
57+
* @return bool|null
5858
*/
5959
public function get(string $key)
6060
{
@@ -66,7 +66,7 @@ public function get(string $key)
6666
/**
6767
* Get an item from the cache, or execute the given Closure and store the result.
6868
*
69-
* @return mixed
69+
* @return bool|null
7070
*/
7171
public function remember(string $key, int $ttl, Closure $callback)
7272
{
@@ -266,6 +266,8 @@ public function bypass(bool $bypass = true)
266266
* Asserts that the cache has an item named $key.
267267
* The value is not checked since storing false or null
268268
* values is valid.
269+
*
270+
* @return void
269271
*/
270272
public function assertHas(string $key)
271273
{
@@ -276,6 +278,8 @@ public function assertHas(string $key)
276278
* Asserts that the cache has an item named $key with a value matching $value.
277279
*
278280
* @param mixed $value
281+
*
282+
* @return void
279283
*/
280284
public function assertHasValue(string $key, $value = null)
281285
{
@@ -292,6 +296,8 @@ public function assertHasValue(string $key, $value = null)
292296

293297
/**
294298
* Asserts that the cache does NOT have an item named $key.
299+
*
300+
* @return void
295301
*/
296302
public function assertMissing(string $key)
297303
{

0 commit comments

Comments
 (0)