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

Add native type declarations for Psr\Log\LoggerInterface::log() #1446

Merged
merged 1 commit into from
Aug 25, 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
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