enqueue-dev
enqueue-dev copied to clipboard
[BUG] Declaration of Enqueue\Container\Container::has
Is the error with run command
PHP Fatal error: Declaration of Enqueue\Container\Container::has($id) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/wp-content/plugins/visualinmueble/vendor/enqueue/enqueue/Container/Container.php on line 28
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I am experience this error too
I just checked and every version of "psr/container" except "1.0.0" has parameter typehints and since "2.0.0" it also has return type hints.
So to solve the issue one of the following 4 options could be done:
- update
composer.json
to explicitly require"psr/container": "1.0.0"
and no further changes are needed - update
composer.json
to require"psr/container": "^1.1.0"
and changeEnqueue\Container\Container
to include the parameter typehints and optionally return typehints - update
composer.json
to require"psr/container": "^2.0.0"
and changeEnqueue\Container\Container
to include the parameter and return typehints - keep
composer.json
as is and changeEnqueue\Container\Container
to include the parameter and return typehints
Option 4 should be possible (and should also be preferred because it offers the best compatibility with other libraries/code bases) since (as far as I know) parameter typehints are required to follow the initial definition but if the original doesn't define a return typehint (as in the 1.* versions of psr/container
) then adding it shouldn't cause exceptions in all of the current php versions.