【发布时间】:2017-07-11 13:00:25
【问题描述】:
我正在开发一个包库,它具有常规依赖项和一个开发依赖项。 Composer recommends to not include the composer.lock file for libraries,所以这里是composer.json
{
"name": "myself/mypackage",
"require": {
"php": ">=5.6",
"nesbot/carbon": "~1.20"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
}
}
我希望它与运行 PHP 5.6 的应用程序兼容,并且我想使用需要 PHP 7 的最新 PHPUnit 测试工具来开发它。
在 travis 持续集成测试服务器上,我有一个构建矩阵,它在 PHP > 7 上运行 PHPUnit 测试和一个 linting 脚本:
composer install
./lint-php.bash
phpunit
在 PHP
composer install --no-dev
./lint-php.bash
但是,它失败了,因为它忽略了 --no-dev 标志并尝试安装 dev 依赖项。
Your requirements could not be resolved to an installable set of packages. Problem 1 - phpunit/phpunit 6.0.7 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement. - phpunit/phpunit 6.0.6 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement. - phpunit/phpunit 6.0.5 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement. - phpunit/phpunit 6.0.4 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement. - phpunit/phpunit 6.0.3 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement. - phpunit/phpunit 6.0.2 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement. - phpunit/phpunit 6.0.1 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement. - phpunit/phpunit 6.0.0 requires php ^7.0 -> your PHP version (5.6.5) does not satisfy that requirement. - Installation request for phpunit/phpunit ^6.0 -> satisfiable by phpunit/phpunit[6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7].
为什么忽略--no-dev 标志?我只想让它安装我的常规依赖项并忽略require-dev 部分。
【问题讨论】:
标签: php composer-php