Skip to content

Commit

Permalink
docs: fix phpstan errors on TestLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Jan 29, 2024
1 parent 9200417 commit 11f792e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
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

0 comments on commit 11f792e

Please sign in to comment.