douhuang5331 2017-09-28 13:14
浏览 63

phpunit 5.6.4在php 5.6中无法通过composer进行doctrine的依赖

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": "",
            "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda"
        "dist": {
            "type": "zip",
            "url": "",
            "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
            "shasum": ""
        "require": {
            "php": "^7.1"

Why does it cause and How do we fix this dependency from php 7 to 5? As I thought, It is possible of using phpunit 5.6.4 in php 5 as show. (We use cakephp 2.10.3 depending on sebastian/exporter 1.2. So we can use only under 5.6.4 phpunit version.)

and we use docker ,so we install library following command .

docker run --rm -it -v $(pwd):/app composer:1.4.1 require --dev phpunit/phpunit:"5.6.4" --ignore-platform-reqs --update-with-dependencies 
  • 写回答

1条回答 默认 最新

  • dousi7919 2017-10-02 05:02

    This problem is caused by incompatible of doctrine version (see 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 关于#microsoft#的问题:电脑启动后不显示桌面图标和窗口,除任务栏外无法操作任何东西
  • ¥15 如何输入百度,显示本地下载的html文件页面,地址栏还显示百度的地址
  • ¥15 通过kinect制作换装程序但是服装不贴合(标签-ar)
  • ¥20 matlab如何绘制三维瀑布图
  • ¥15 关于用abap来解决动态规划的问题,但是要求输出索引值,这个是难点
  • ¥15 在ISIS中什么是IP从地址
  • ¥15 压测时,并发量过高时,响应时间出现尖刺
  • ¥15 关于vmprotect3.8.4虚拟文件一项
  • ¥15 在不用IT调试的情况下怎样能连外网
  • ¥20 C#调用虚拟键盘TabTip.exe