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
This forces us to bump psr/log to v2
  • Loading branch information
greg0ire committed Aug 24, 2024
1 parent 846e766 commit 1e3bcb6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"doctrine/dbal": "^3.6 || ^4",
"doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.2 || ^2.0",
"psr/log": "^1.1.3 || ^2 || ^3",
"psr/log": "^2 || ^3",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0",
"symfony/var-exporter": "^6.2 || ^7.0"
Expand Down
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 1e3bcb6

Please sign in to comment.