Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add/fix PHPDoc types in MockCache #8612

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -3106,36 +3106,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot unset offset string on array\\<int, int\\>\\|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,
Expand Down
10 changes: 8 additions & 2 deletions system/Test/Mock/MockCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function initialize()
*
* @param string $key Cache item name
*
* @return mixed
* @return bool|null
*/
public function get(string $key)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand All @@ -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)
{
Expand Down
Loading