1

I found a Symfony component I would like to use in my project but it is only available since the version 5.2 and all my Symfony elements are currently in version 5.1.10.

I read the following links :

But I did not found how to upgrade all my current 5.1.10 version elements to 5.2.

I tried to manualy replace all '5.1.*' occurences in my composer.json with '5.2.*' and then run composer update but it did not work and throws the following error :

    Your requirements could not be resolved to an installable set of packages.
Problem 1
    - The requested package symfony/symfony 5.2.* exists as symfony/symfony[5.1.x-dev, v5.1.0, v5.1.0-BETA1, v5.1.0-RC1, v5.1.0-RC2, v5.1.1, v5.1.10, v5.1.2, v5.1.3, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these are rejected by your constraint.
  Problem 2
    - symfony/framework-bundle v5.2.1 requires symfony/cache ^5.2 -> no matching package found.
    - symfony/framework-bundle v5.2.0 requires symfony/cache ^5.2 -> no matching package found.
    - Installation request for symfony/framework-bundle 5.2.* -> satisfiable by symfony/framework-bundle[v5.2.0, v5.2.1].
Bpicco
  • 65
  • 5
  • 3
    Check the 'extra' section at the bottom of composer.json. Did you change the 'symfony require' version? – Cerad Dec 18 '20 at 17:34
  • @Cerad I did not, it seems to work. Thank you. I'm pretty new with php. – Bpicco Dec 18 '20 at 17:39
  • I never had to update that section before so it was new to me as well. I had gotten the same error as you did so I did my usual composer troubleshooting which consists of creating a new project and then comparing the composer.json files. – Cerad Dec 18 '20 at 17:41
  • Please share more details. It looks like you are using any configuration that blocks the update – Nico Haase Dec 18 '20 at 21:07

1 Answers1

1

I you want to upgrade a minor version, e.g. from 5.1 to 5.2 you can follow this documentation

to upgrade to a new minor version, you will probably need to update the version constraint next to each library starting symfony/. Suppose you are upgrading from Symfony 4.3 to 4.4:

{
    "...": "...",

    "require": {
-         "symfony/cache": "4.3.*",
+         "symfony/cache": "4.4.*",
-         "symfony/config": "4.3.*",
+         "symfony/config": "4.4.*",
-         "symfony/console": "4.3.*",
+         "symfony/console": "4.4.*",
        "...": "...",

        "...": "A few libraries starting with
                symfony/ follow their versioning scheme. You
                do not need to update these versions: you can
                upgrade them independently whenever you want",
        "symfony/monolog-bundle": "^3.5",
    },
    "...": "...",
}

Your composer.json file should also have an extra block that you will also need to update:

"extra": {
    "symfony": {
        "...": "...",
-         "require": "4.3.*"
+         "require": "4.4.*"
    }
}

After that you can update your dependencies with:

composer update
stollr
  • 6,534
  • 4
  • 43
  • 59