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: fix phpstan errors on TestLogger #8479

Merged
merged 1 commit into from
Jan 30, 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
15 changes: 0 additions & 15 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -3491,21 +3491,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Test/PhpStreamWrapper.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Test\\\\TestLogger\\:\\:cleanup\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Test/TestLogger.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$level \\(string\\) of method CodeIgniter\\\\Test\\\\TestLogger\\:\\:log\\(\\) should be contravariant with parameter \\$level \\(mixed\\) of method Psr\\\\Log\\\\LoggerInterface\\:\\:log\\(\\)$#',
'count' => 1,
'path' => __DIR__ . '/system/Test/TestLogger.php',
];
$ignoreErrors[] = [
'message' => '#^Property CodeIgniter\\\\Test\\\\TestLogger\\:\\:\\$op_logs has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Test/TestLogger.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:__call\\(\\) should return mixed but return statement is missing\\.$#',
'count' => 1,
Expand Down
7 changes: 6 additions & 1 deletion system/Test/TestLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
*/
class TestLogger extends Logger
{
/**
* @var list<array{level: mixed, message: string, file: string|null}>
*/
protected static $op_logs = [];

/**
* The log method is overridden so that we can store log history during
* the tests to allow us to check ->assertLogged() methods.
*
* @param string $level
* @param mixed $level
* @param string $message
*/
public function log($level, $message, array $context = []): bool
Expand Down Expand Up @@ -92,6 +95,8 @@ public static function didLog(string $level, $message, bool $useExactComparison
*
* @param string $file
*
* @return string
*
* @deprecated No longer needed as underlying protected method is also deprecated.
*/
public function cleanup($file)
Expand Down
Loading