Skip to content
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
php: ['8.1', '8.2', '8.3', '8.4', '8.5']

steps:
- name: Checkout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ public function teardown(): void

private static function severityToLevel(int $severity): LogLevel
{
// E_STRICT is intentionally absent: the level was removed in PHP 8.0 and
// the constant itself is deprecated since 8.4, so referencing it here
// would emit a deprecation from inside the error handler.
return match (true) {
(bool) ($severity & (E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR)) => LogLevel::CRITICAL,
(bool) ($severity & (E_WARNING | E_CORE_WARNING | E_COMPILE_WARNING | E_USER_WARNING | E_RECOVERABLE_ERROR)) => LogLevel::WARN,
(bool) ($severity & (E_NOTICE | E_USER_NOTICE | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED)) => LogLevel::INFO,
(bool) ($severity & (E_NOTICE | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED)) => LogLevel::INFO,
default => LogLevel::ERROR,
};
}
Expand Down
4 changes: 3 additions & 1 deletion packages/logtide/src/Serializer/ErrorSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ public static function serializePhpError(int $severity, string $message, string

private static function errorLevelToString(int $level): string
{
// E_STRICT is intentionally absent: the level was removed in PHP 8.0 and
// the constant itself is deprecated since 8.4, so referencing it here
// would emit a deprecation from inside the error handler.
return match ($level) {
E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR => 'E_ERROR',
E_WARNING, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING => 'E_WARNING',
E_NOTICE, E_USER_NOTICE => 'E_NOTICE',
E_STRICT => 'E_STRICT',
E_DEPRECATED, E_USER_DEPRECATED => 'E_DEPRECATED',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
default => 'E_UNKNOWN',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public function testErrorLevelMapping(): void
$this->assertSame('E_WARNING', ErrorSerializer::serializePhpError(E_WARNING, '', '', 0)['type']);
$this->assertSame('E_NOTICE', ErrorSerializer::serializePhpError(E_NOTICE, '', '', 0)['type']);
$this->assertSame('E_DEPRECATED', ErrorSerializer::serializePhpError(E_DEPRECATED, '', '', 0)['type']);
$this->assertSame('E_STRICT', ErrorSerializer::serializePhpError(E_STRICT, '', '', 0)['type']);
$this->assertSame('E_DEPRECATED', ErrorSerializer::serializePhpError(E_USER_DEPRECATED, '', '', 0)['type']);
$this->assertSame('E_RECOVERABLE_ERROR', ErrorSerializer::serializePhpError(E_RECOVERABLE_ERROR, '', '', 0)['type']);
$this->assertSame('E_UNKNOWN', ErrorSerializer::serializePhpError(0, '', '', 0)['type']);
}
}
1 change: 0 additions & 1 deletion packages/logtide/tests/Unit/State/ScopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ final class ScopeTest extends TestCase
protected function tearDown(): void
{
$ref = new \ReflectionProperty(Scope::class, 'globalEventProcessors');
$ref->setAccessible(true);
$ref->setValue(null, []);
}

Expand Down
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
colors="true"
failOnRisky="true"
failOnWarning="true"
failOnDeprecation="true"
displayDetailsOnTestsThatTriggerDeprecations="true">
<testsuites>
<testsuite name="Core">
Expand Down
Loading