如何解决外部包的composer包循环依赖?

时间:2017-11-11 10:35:25

标签: php composer-php

请参阅此问题所在的Github issue

我的套餐是phpdocumentor/reflection-docblock,它不是依赖项。

我尝试将phpdocumentor/reflection-docblock更新为较新的phpunit/phpunit依赖项,started to use the package我更新。

有新的循环依赖:

  • phpdocumentor/reflection-docblock包需要phpunit/phpunit
  • phpunit/phpunit需要phpspec/prophecy(自phpunit/phpunit 4.5)
  • phpspec/prophecy需要此phpdocumentor/reflection-docblock)套餐

抽象:

  • A需要B
  • B需要C(新的!)
  • C需要A

之前 - 工作

{
    "require-dev": {
        "phpunit/phpunit": "4.4"
    }
}

After - broken

{
    "require-dev": {
        "phpunit/phpunit": "4.5"
    }
}

当我跑步时:

composer update

作曲家冲突输出

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for phpdocumentor/reflection-docblock dev-phpunit -> satisfiable by phpdocumentor/reflection-docblock[dev-phpunit].
    - phpspec/prophecy v1.3.1 requires phpdocumentor/reflection-docblock ~2.0 -> satisfiable by phpdocumentor/reflection-docblock[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5].
    - phpunit/phpunit 4.5.0 requires phpspec/prophecy ~1.3.1 -> satisfiable by phpspec/prophecy[v1.3.1].
    - Can only install one of: phpdocumentor/reflection-docblock[2.0.0, dev-phpunit].
    - Can only install one of: phpdocumentor/reflection-docblock[2.0.1, dev-phpunit].
    - Can only install one of: phpdocumentor/reflection-docblock[2.0.2, dev-phpunit].
    - Can only install one of: phpdocumentor/reflection-docblock[2.0.3, dev-phpunit].
    - Can only install one of: phpdocumentor/reflection-docblock[2.0.4, dev-phpunit].
    - Can only install one of: phpdocumentor/reflection-docblock[2.0.5, dev-phpunit].
    - Installation request for phpunit/phpunit 4.5 -> satisfiable by phpunit/phpunit[4.5.0].

我试过了:

  • minimum-stability: dev
  • 别名"phpunit/phpunit": "4.5 as 4.4"

任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:4)

添加

In [329]: a
Out[329]: array([array([1]), array([1, 2, 3]), array([1, 2])], dtype=object)

In [330]: a[np.argsort([len(i) for i in a])[::-1]]
Out[330]: array([array([1, 2, 3]), array([1, 2]), array([1])], dtype=object)

# If you need a list of lists as output
In [341]: [i.tolist() for i in _]
Out[341]: [[1, 2, 3], [1, 2], [1]]

"extra": { "branch-alias": { "dev-master": "4.x-dev" } } 的{​​{1}}。

这将允许您使用当前版本作为满足要求的版本composer.json

下行是。在继续使用版本时,您将不得不更新此部分。