I have a problem composer install dependencies.
We use php which is version 5.6.24.
When installing phpunit 5.6.4, we install doctrine needs php^7. This is our partial composer.lock after require and install phpunit.
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
"reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
"shasum": ""
},
"require": {
"php": "^7.1"
},
docker run --rm -it -v $(pwd):/app composer:1.4.1 require --dev phpunit/phpunit:"5.6.4" --ignore-platform-reqs --update-with-dependencies
This problem is caused by incompatible of doctrine version (see http://doctrine-project.org/2017/07/25/php-7.1-requirement-and-composer.html) and phpdocumentor/reflection-docblock and as it show. I can override invalid versions to use command composer
require (or --dev) package:$correct_version
Of course , as well as docker environment.
Composer file can have ambiguous dependencies' match setting like ^、〜 operator, therefore dependencies will be broken if library installed to be required by dependencies change requirements which has updated incompatible before. So we need implicitly definitions of their correct version in composer.json. Thanks to @TonyChiboucas's comment add your own requirement definition
. It becomes a clue to resolve my problem.