symfony / flex

Composer plugin for Symfony
MIT License
4.17k stars 183 forks source link

Unclear problem description when Flex blocks package installation (by `extra.symfony.require` rule) #1002

Open 7ochem opened 1 year ago

7ochem commented 1 year ago

The extra.symfony.require rule makes sure you only install Symfony packages of a certain version, even if these are sub (or sub-sub) dependencies. Which is great, but when there's a conflict, the problem description that is outputted by Composer doesn't make sense at all. I ran in this a few times before and every time I'm staring at my screen wondering why it is conflicting because the lines in Composer's problem description don't make sense. It concludes that something isn't installable, but comparing all these lines on my screen I can't conclude there's any conflict.

Just now I ran into this:

Symfony 6.4.0-BETA1 is out. I'm requiring a bunch of Symfony packages in my composer.json, for example "symfony/console": "^6.4". I have proprietary packages with Sf 6 feature branches "proprietary/x-bundle": "dev-feature-symfony-6". I have Sonata Admin packages. I have extra.symfony.require set to 6.4.*. I have "minimum-stability": "dev"

Now I try a composer update -W and run into conflicts. (If I try this with --no-plugins everything is just fine.)

Restricting packages listed in "symfony/symfony" to "6.4.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - sonata-project/doctrine-orm-admin-bundle[4.0.0-alpha-1, ..., 4.0.0] require symfony/config ^4.4 || ^5.2 -> found symfony/config[v4.4.0-BETA1, ..., 4.4.x-dev, v5.2.0-BETA1, ..., 5.4.x-dev] but these were not loaded, likely because it conflicts with another require.
    - sonata-project/doctrine-orm-admin-bundle 4.1.0 requires symfony/config ^4.4 || ^5.3 -> found symfony/config[v4.4.0-BETA1, ..., 4.4.x-dev, v5.3.0-BETA1, ..., 5.4.x-dev] but these were not loaded, likely because it conflicts with another require.
    - Root composer.json requires proprietary/y-bundle dev-feature-symfony-6 -> satisfiable by proprietary/y-bundle[dev-feature-symfony-6].
    - Root composer.json requires proprietary/x-bundle dev-feature-symfony-6 -> satisfiable by proprietary/x-bundle[dev-feature-symfony-6].
    - proprietary/x-bundle dev-feature-symfony-6 requires sonata-project/doctrine-orm-admin-bundle ^4 -> satisfiable by sonata-project/doctrine-orm-admin-bundle[4.0.0-alpha-1, ..., 4.x-dev].
    - sonata-project/doctrine-orm-admin-bundle[4.12.0, ..., 4.x-dev] require symfony/doctrine-bridge ^5.4 || ^6.2 -> satisfiable by symfony/doctrine-bridge[v6.4.0-BETA1, 6.4.x-dev].
    - sonata-project/doctrine-orm-admin-bundle[4.10.0, ..., 4.11.0] require symfony/doctrine-bridge ^4.4 || ^5.4 || ^6.2 -> satisfiable by symfony/doctrine-bridge[v6.4.0-BETA1, 6.4.x-dev].
    - sonata-project/doctrine-orm-admin-bundle[4.3.1, ..., 4.9.1] require symfony/doctrine-bridge ^4.4 || ^5.4 || ^6.0 -> satisfiable by symfony/doctrine-bridge[v6.4.0-BETA1, 6.4.x-dev].
    - sonata-project/doctrine-orm-admin-bundle[4.2.0, ..., 4.3.0] require symfony/doctrine-bridge ^4.4 || ^5.3 || ^6.0 -> satisfiable by symfony/doctrine-bridge[v6.4.0-BETA1, 6.4.x-dev].
    - Conclusion: don't install symfony/doctrine-bridge v6.4.0-BETA1 (conflict analysis result)

If I look at these rules I conclude:

But then all of a sudden, there's Conclusion: don't install symfony/doctrine-bridge v6.4.0-BETA1 (conflict analysis result) ???

If I change extra.symfony.require to 6.4.0-BETA1 everything is just fine. So that is not my issue/bug report.

My issue here is that the "Problem" output is very confusing and nowhere is stated that my extra.symfony.require rule with value 6.4.* is the cause of it all. Is there a way to add this to the problem description?

stof commented 1 year ago

I don't think Flex can hook into this problem rendering done by Composer.