Skip to content

Commit 6feb1cd

Browse files
committed
fix ExceptionLogger
1 parent e79c311 commit 6feb1cd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/Loggers/ExceptionLogger.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<?php
22

3+
declare(strict_types=1);
34

45
namespace TheCodingMachine\GraphQLite\Loggers;
56

6-
7+
use Exception;
78
use Psr\Log\AbstractLogger;
89
use Psr\Log\LogLevel;
10+
use Stringable;
911
use Throwable;
12+
1013
use function in_array;
1114

1215
/**
@@ -15,16 +18,14 @@
1518
*/
1619
class ExceptionLogger extends AbstractLogger
1720
{
18-
/**
19-
* @inheritDoc
20-
*/
21-
public function log($level, $message, array $context = array())
21+
/** @inheritDoc */
22+
public function log($level, string|Stringable $message, array $context = []): void
2223
{
2324
if (in_array($level, [LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR, LogLevel::WARNING])) {
2425
if (isset($context['exception']) && $context['exception'] instanceof Throwable) {
2526
throw $context['exception'];
2627
}
27-
throw new \Exception($message);
28+
throw new Exception($message);
2829
}
2930
}
3031
}

0 commit comments

Comments
 (0)