From 11f792e0981be17fa8ee86858421c6be4601bb6e Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 29 Jan 2024 23:27:02 +0800 Subject: [PATCH] docs: fix phpstan errors on TestLogger --- phpstan-baseline.php | 15 --------------- system/Test/TestLogger.php | 7 ++++++- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 22aae16b046e..47f2cce686b4 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -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, diff --git a/system/Test/TestLogger.php b/system/Test/TestLogger.php index 240f5c6d95b5..fa2f35683ecd 100644 --- a/system/Test/TestLogger.php +++ b/system/Test/TestLogger.php @@ -18,13 +18,16 @@ */ class TestLogger extends Logger { + /** + * @var list + */ 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 @@ -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)