gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 19:18:35 26 4
gpt4 key购买 nike

参见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"
}
}

之后 - 损坏

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

当我运行时:

composer update

Composer 冲突输出:

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].
<小时/>

我已经尝试过:

  • 最低稳定性:dev
  • 别名"phpunit/phpunit": "4.5 as 4.4"

有什么想法可以解决这个问题吗?

最佳答案

添加

"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
}

phpdocumentor/reflection-docblockcomposer.json

这将允许您使用当前的主版本作为满足要求的4.x版本

缺点是。当继续使用版本时,您必须更新此部分。

关于php - 如何解决外部包的composer包循环依赖?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47236948/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com