From bc31a5d6f7f74a32fac818d030ae2c86a28e8229 Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Fri, 23 Oct 2026 22:18:39 +0400 Subject: [PATCH 1/2] docs: correct the Logger override guidance in the 3.1 upgrade guide --- v3.0/upgrade-guide.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/v3.0/upgrade-guide.md b/v3.0/upgrade-guide.md index 57fa932..8294564 100644 --- a/v3.0/upgrade-guide.md +++ b/v3.0/upgrade-guide.md @@ -12,17 +12,7 @@ This guide summarizes the changes to make when you upgrade a Quantum project. It **Symfony 6.4.** `symfony/console`, `symfony/var-dumper` and `symfony/var-exporter` are on the `^6.4` line. Commands that extend `Quantum\Console\CliCommand` need no change. A class in your application that extends a Symfony class directly may need Symfony 6's stricter return types. -**`psr/log` 2 or 3.** The framework accepts both, so an application that uses `psr/log` 3 (for example through Monolog 3) can now install it. The nine PSR-3 methods of `Quantum\Logger\Logger` declare `string|Stringable $message`. A class that extends `Logger` and overrides them must declare the same type: - -```php -use Stringable; - -// before -public function info($message, array $context = []): void - -// after -public function info(string|Stringable $message, array $context = []): void -``` +**`psr/log` 2 or 3.** The framework accepts both, so an application that uses `psr/log` 3 (for example through Monolog 3) can now install it. The nine PSR-3 methods of `Quantum\Logger\Logger` declare `string|Stringable $message`. A class that extends `Logger` and overrides them needs no change when its parameter has no type or is `string|Stringable`. PHP rejects an override that narrows the type, for example to `string`, and it did before as well. **Return types.** `Quantum\HttpClient\ResponseHeaders` declares `offsetGet()`, `current()` and `key()` as `mixed`, and `Quantum\Session\Adapters\Database\DatabaseHandler::gc()` as `int|false`, because PHP 8.1 expects them. A subclass that overrides these methods must declare compatible return types. `gc()` also returns the number of deleted sessions now; it returned `0` after any successful delete. From 308452df1dd80f0b62f786e93255bc0a130438df Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Fri, 23 Oct 2026 22:19:19 +0400 Subject: [PATCH 2/2] docs: correct the Logger override guidance --- v3.0/packages/logger/contracts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v3.0/packages/logger/contracts.md b/v3.0/packages/logger/contracts.md index bc8a4d1..6adddf1 100644 --- a/v3.0/packages/logger/contracts.md +++ b/v3.0/packages/logger/contracts.md @@ -16,7 +16,7 @@ The Logger package is small, but a few runtime contracts matter when you build o - `debug()` - `log()` -Each method takes the message as `string|Stringable $message` and an optional `array $context`; `log()` takes the level first. A class that extends `Logger` and overrides these methods must declare the same parameter type. +Each method takes the message as `string|Stringable $message` and an optional `array $context`; `log()` takes the level first. A class that extends `Logger` and overrides these methods keeps working with no parameter type or with `string|Stringable`; PHP rejects an override that narrows the type, for example to `string`. But the package does not validate arbitrary custom level strings in `log()`.