Skip to content

Commit 3cda61a

Browse files
committed
fix ExceptionLogger
1 parent e79c311 commit 3cda61a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/Utils/PropertyAccessor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public static function setValue(object $instance, string $propertyName, mixed $v
9494
throw AccessPropertyException::createForUnwritableProperty($class, $propertyName);
9595
}
9696

97+
/** @param class-string $class */
9798
private static function isPublicProperty(string $class, string $propertyName): bool
9899
{
99100
if (! property_exists($class, $propertyName)) {

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, $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)