symfony: Declaration of Symfony\Component\DependencyInjection\ServiceLocator::has(string $id) must be compatible with Psr\Container\ContainerInterface::has($id)

Update log for today

Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 3 updates, 0 removals
  - Upgrading symfony/cache-contracts (v2.2.0 => v2.4.0)
  - Upgrading symfony/service-contracts (v2.2.0 => v2.4.0)
  - Upgrading symfony/translation-contracts (v2.3.0 => v2.4.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 3 updates, 0 removals
  - Downloading symfony/service-contracts (v2.4.0)
  - Downloading symfony/cache-contracts (v2.4.0)
  - Downloading symfony/translation-contracts (v2.4.0)
  - Upgrading symfony/service-contracts (v2.2.0 => v2.4.0): Extracting archive
  - Upgrading symfony/cache-contracts (v2.2.0 => v2.4.0): Extracting archive
  - Upgrading symfony/translation-contracts (v2.3.0 => v2.4.0): Extracting archive
Fatal error: Declaration of Symfony\Component\DependencyInjection\ServiceLocator::has(string $id) must be compatible with Psr\Container\ContainerInterface::has($id) in vendor/symfony/dependency-injection/ServiceLocator.php on line 46

Possible Workaround Use a lower version: composer require symfony/service-contracts:2.2.0

Additional context breaks phpMyAdmin

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 22 (12 by maintainers)

Most upvoted comments

As the author of the PSR extension, I would like to apologize for the bit of trouble my extension has caused. At the time I first authored it, I expected that B/C breaks to the PSRs would be published under a new PSR in a different namespace. It appears PHP-FIG has recently amended their bylaws and allowed PSRs to be upgraded in place. This is a huge compatibility nightmare for me.

It is meant as a specialized extension and not intended to be used in general. For example, it allows the phalcon framework to use the PSR interfaces.

I will contact distributions and request they not enable it by default, unless phalcon is also enabled, when I become aware of them doing so.

@williamdes can you maybe open an issue or a PR to remove the extension from devilbox’ images?

Done: https://github.com/devilbox/docker-php-fpm/issues/201

@williamdes The package was updated to match psr/container 1.1.1 all right, but my recommendation is still to not use that extension at all. You don’t gain anything from using it but hard-to-debug problems like this one.

Closing as this is not a Symfony issue.

@williamdes can you maybe open an issue or a PR to remove the extension from devilbox’ images?

This is not the interface that your error message complains about.

ServiceLocator does not even implement that interface.