composer update issue
zhaolion opened this issue · 7 comments
My project enviroment is only in PHP7.0, i just need doctrine/common(v2.7.3) and set "doctrine/common": 2.7.3
in composer.json.
But when i run composer update doctrine/common
, the dependency of doctrine/common
upgrade to a magic version of PHP7.1 . I can't run it in my project
What's the meaning of PHP version in doctrine/common(v2.7.3) ?
2.7.3
is compatible with PHP 5.x and 7.0+, see
Line 16 in 4acb8f8
What is the actual constraint that you have on doctrine/common
?
@zhaolion make sure you are running composer with PHP7.0 version. If you run composer update outside of the environment with PHP7.1, it will update to doctrine/annotations 1.5 which requires 7.1.
Alternatively just fix doctrine/annotations to 1.4.*
Alternatively just fix doctrine/annotations to 1.4.*
No. Either do as suggested in the sentence before or use the platform
config key in composer to make sure this doesn't happen: https://getcomposer.org/doc/06-config.md#platform.
Locking a dependency is not a solution, it's a dirty hack. The package manager does exactly what you want it to do. Say 1.6 for some reason no longer requires 7.1 but works with 7.0 again, wouldn't you want it to update to that version?
Will partially agree. I can say the same about php version:
After upgrading my PHP to, say 7.2, wouldn't I want to get all the newer packages?
On a side note:
Lets you fake platform packages
Sounds much more dirtier
I agree - you also shouldn't do that, just like you shouldn't write in a PHP version that's higher than the one you are locally running. It does solve some issues (e.g. the one described above). For those narrow use cases, it works just fine.
Of course, even better would be to just run the same PHP version in development - don't ask me how people reliably test their stuff 🤷♂️
Closing here: please re-open once you can reproduce in a way that is also reproducible for us.
thanks, my coding envirment is PHP7.1. I found my mistake.