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

Symfony 4.3 / Composer: Ambiguous class resolution for symfony/contracts #64

Closed
wbrinkman opened this issue May 30, 2019 · 1 comment · Fixed by #65
Closed

Symfony 4.3 / Composer: Ambiguous class resolution for symfony/contracts #64

wbrinkman opened this issue May 30, 2019 · 1 comment · Fixed by #65

Comments

@wbrinkman
Copy link
Contributor

Using this bundle (v1.6.0) with Symfony 4.3 will have Composer generate a couple of "Warning: Ambiguous class resolution" when trying to generate an optimized autoloader.

$ composer dump-autoload --optimize

Generating optimized autoload files
Warning: Ambiguous class resolution, "Symfony\Contracts\Cache\CallbackInterface" was found in both "/var/www/vendor/symfony/cache-contracts/CallbackInterface.php" and "/var/www/vendor/symfony/contracts/Cache/CallbackInterface.php", the first will be used.
Warning: Ambiguous class resolution, "Symfony\Contracts\Cache\ItemInterface" was found in both "/var/www/vendor/symfony/cache-contracts/ItemInterface.php" and "/var/www/vendor/symfony/contracts/Cache/ItemInterface.php", the first will be used.
Warning: Ambiguous class resolution, "Symfony\Contracts\Cache\CacheInterface" was found in both "/var/www/vendor/symfony/cache-contracts/CacheInterface.php" and "/var/www/vendor/symfony/contracts/Cache/CacheInterface.php", the first will be used.
(snip)

The framework will load some traits and interfaces from /symfony/service-contracts/ while /webpack-encore-bundle/ will try to load the same from /symfony/contracts/

$ composer why symfony/contracts

symfony/webpack-encore-bundle  v1.6.0  requires  symfony/contracts (^1.0)  

$ composer why symfony/service-contracts

symfony/cache                 v4.3.0  requires  symfony/service-contracts (^1.1)    
symfony/console               v4.3.0  requires  symfony/service-contracts (^1.1)    
symfony/dependency-injection  v4.3.0  requires  symfony/service-contracts (^1.1.2)  
symfony/doctrine-bridge       v4.3.0  requires  symfony/service-contracts (^1.1)    
symfony/expression-language   v4.3.0  requires  symfony/service-contracts (^1.1)    
symfony/monolog-bridge        v4.3.0  requires  symfony/service-contracts (^1.1)    
symfony/security-core         v4.3.0  requires  symfony/service-contracts (^1.1)    
symfony/stopwatch             v4.3.0  requires  symfony/service-contracts (^1.0)   

Could this bundle bump it's requirement to symfony/service-contracts too?

@nicolas-grekas
Copy link
Member

Yes, please send a PR

weaverryan added a commit that referenced this issue Jul 3, 2019
…s (wbrinkman)

This PR was merged into the master branch.

Discussion
----------

[Contracts] Update dependency to use symfony/service-contracts

Updated requirement symfony/contracts to symfony/service-contracts so having this bundle in a Symfony 4.3 installation does not generate ambiguous classes with an optimized composer autoloader.

Fixes #64

Commits
-------

2ec86a5 Update dependency to use symfony/service-contracts to prevent autoloading clashes with Symfony 4.3
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

Successfully merging a pull request may close this issue.

2 participants