Skip to content

Commit

Permalink
Add native type declarations for Psr\Log\LoggerInterface::log()
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Aug 24, 2024
1 parent 846e766 commit c7dadb1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Tools/Console/ConsoleLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function __construct(
*
* @param mixed[] $context
*/
public function log($level, $message, array $context = []): void
public function log(mixed $level, string|Stringable $message, array $context = []): void
{
if (! isset($this->verbosityLevelMap[$level])) {
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
Expand Down
3 changes: 2 additions & 1 deletion tests/Metadata/Storage/DebugLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Migrations\Tests\Metadata\Storage;

use Psr\Log\AbstractLogger;
use Stringable;

final class DebugLogger extends AbstractLogger
{
Expand All @@ -15,7 +16,7 @@ final class DebugLogger extends AbstractLogger
*
* @param mixed[] $context
*/
public function log($level, $message, array $context = []): void
public function log(mixed $level, string|Stringable $message, array $context = []): void
{
$this->count++;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/TestLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestLogger extends AbstractLogger
*
* @param mixed[] $context
*/
public function log($level, $message, array $context = []): void
public function log(mixed $level, string|Stringable $message, array $context = []): void
{
$this->logs[] = $this->interpolate($message, $context);
}
Expand Down

0 comments on commit c7dadb1

Please sign in to comment.