Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Declaration of Enqueue\Container\Container::has #1227

Open
FuriosoJack opened this issue Jan 6, 2022 · 3 comments
Open

[BUG] Declaration of Enqueue\Container\Container::has #1227

FuriosoJack opened this issue Jan 6, 2022 · 3 comments

Comments

@FuriosoJack
Copy link

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

@stale
Copy link

stale bot commented Apr 16, 2022

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.

@stale stale bot added the wontfix label Apr 16, 2022
@jeffersoncardoso
Copy link

I am experience this error too

@stale stale bot removed the wontfix label Apr 19, 2022
@chancezeus
Copy link

chancezeus commented Apr 26, 2022

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:

  1. update composer.json to explicitly require "psr/container": "1.0.0" and no further changes are needed
  2. update composer.json to require "psr/container": "^1.1.0" and change Enqueue\Container\Container to include the parameter typehints and optionally return typehints
  3. update composer.json to require "psr/container": "^2.0.0" and change Enqueue\Container\Container to include the parameter and return typehints
  4. keep composer.json as is and change Enqueue\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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants