4

See Github issue, where this question originated.

My package is phpdocumentor/reflection-docblock, it's not a dependency.


I'm trying to update phpdocumentor/reflection-docblock to newer phpunit/phpunit dependency, that started to use the package I update.

There is new circular dependency:

  • (this) phpdocumentor/reflection-docblock package requires phpunit/phpunit
  • phpunit/phpunit requires phpspec/prophecy (since phpunit/phpunit 4.5)
  • phpspec/prophecy requires this phpdocumentor/reflection-docblock (this) package

In abstraction:

  • A needs B
  • B needs C (new one!)
  • C needs A

Before - works

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

After - broken

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

When I run:

composer update

Composer conflict output:

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].

I've tried:

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

Any ideas how to approach this?

Tomas Votruba
  • 23,240
  • 9
  • 79
  • 115
  • Have you tried requiring `phpdocumentor/reflection-docblock` before phpunit and explicitly install the package? Basically: Install C, Install A (requires B), Install B (requires C, but is already installed) – Daniel W. Nov 13 '17 at 17:32
  • My pakage is `phpdocumentor/reflection-docblock` and it can't require itself. See [Github repository PR](https://github.com/phpDocumentor/ReflectionDocBlock/pull/128#issuecomment-343654897) for more – Tomas Votruba Nov 13 '17 at 17:35
  • I've updated the question to make that clear, thanks for feedback. – Tomas Votruba Nov 13 '17 at 17:36

1 Answers1

5

Add

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

to composer.json of phpdocumentor/reflection-docblock.

This will allow you to use current master as version 4.x which satisfies requirements

Downside is. You will have to update this section when moving on with versions.

mleko
  • 11,650
  • 6
  • 50
  • 71