Skip to content

Too restrictive composer.json version requirements for nikic/php-parser #129

@d42ohpaz

Description

@d42ohpaz

Both the develop and master composer.json use the ^ to restrict nikic/php-parser to a single major version. This is problematic as php-parser is one major version ahead of develop and three major versions ahead of master. Does this package not work on newer versions?

The use-case for this ticket is that I am building a jenkins CI environment, and I'm using ramsey/jenkins-php to install the various tools I plan to use. It depends on phpdocumentor/phpdocumentor 2.8, which depends on phpdocumentor/reflection ^3.0, which depends on nikic/php-parser ^1.0.

When I try to install phpstan/phpstan-symfony, which depends on nikic/php-parser ^4.0, it fails because nikic/php-parser ^1.0 is already installed:

[root@localhost ~]# /usr/local/bin/composer global require phpstan/phpstan-symfony
Changed current directory to /root/.composer
Using version ^0.10.1 for phpstan/phpstan-symfony
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for phpstan/phpstan-symfony ^0.10.1 -> satisfiable by phpstan/phpstan-symfony[0.10.1].
    - Conclusion: remove nikic/php-parser v1.4.1
    - Conclusion: don't install nikic/php-parser v1.4.1
    - phpstan/phpstan-symfony 0.10.1 requires nikic/php-parser ^4.0 -> satisfiable by nikic/php-parser[v4.0.0, v4.0.1, v4.0.2, v4.0.3].
    - Can only install one of: nikic/php-parser[v4.0.0, v1.4.1].
    - Can only install one of: nikic/php-parser[v4.0.1, v1.4.1].
    - Can only install one of: nikic/php-parser[v4.0.2, v1.4.1].
    - Can only install one of: nikic/php-parser[v4.0.3, v1.4.1].
    - Installation request for nikic/php-parser (locked at v1.4.1) -> satisfiable by nikic/php-parser[v1.4.1].


Installation failed, reverting ./composer.json to its original content.

Would it not be more preferable to use a constraint such as >=1.0.0 (master) and >=3.0.0 (develop)?

At this juncture, I feel stuck between a rock and a hard place in having to decide between two equally needed tools for my CI environment.

As a side note, I will also be reaching out to phpstan/phpstan-symfony about their usage of the ^ version constraint as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions