Tomas Votruba
Tomas Votruba

Reputation: 24298

How to resolve composer package circular dependency of external package?

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:

In abstraction:

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:

Any ideas how to approach this?

Upvotes: 4

Views: 1268

Answers (1)

mleko
mleko

Reputation: 12243

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.

Upvotes: 5

Related Questions