You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While scanning for attributes it runs with psr/log 1.0 loaded by composer.
If this plugin scans a file that contains a class which implements Psr\LoggerInterface with the signatures from psr/log 2.0 or 3.0
the plugin will fail with the following error
Generating autoload files
Generating attributes file
Fatal error: Declaration of MyLogger::emergency(Stringable|string $message, array $context = []): void must be compatible with Psr\Log\LoggerInterface::emergency($message, array $context = []) in vendor/psr/log/src/LoggerTrait.php on line 18
I actually just avoided using attributes in the affected class, and honestly it's quite an edge case. I just thought i'd stick it here for anyone encountering the same problem.
The text was updated successfully, but these errors were encountered:
i actually do not need to collect, i discovered it with the Override attributes and I just removed them as I dont really need them for anything other than clarity. and I dont want to add it to exclude either. It's not for a logging lib, its for a thin wrapper inside an application code and I'll just carry on without attributes on that class that's ok for me...
Anyway, I dont really think there is a true solution to this problem as long as this runs as a composer plugin.
As I understood from the discussions in composer repo, the psr/log package bundled with composer itself will not receive an update any sooner than in composer 3.0
So to close up, I dont think any further steps need to be taken here, except waiting for new major version of composer.
Unless ofc you can think of some clever way to circumvent the limitation in the current version.
I'd say keep it open till then, for anyone encountering the same problem...
Composer is using psr/log ^1.0 internally
This package is a plugin to composer.
While scanning for attributes it runs with psr/log 1.0 loaded by composer.
If this plugin scans a file that contains a class which implements Psr\LoggerInterface with the signatures from psr/log 2.0 or 3.0
the plugin will fail with the following error
This doesnt work
When there is a commented out attribute it also doesnt work
It works as long as there are no attributes used in the file
A related issue in composer:
composer/composer#11437
I actually just avoided using attributes in the affected class, and honestly it's quite an edge case. I just thought i'd stick it here for anyone encountering the same problem.
The text was updated successfully, but these errors were encountered: