当我尝试通过更改 `extra.symfony.require` 来升级 Symfony 时,为什么会出现此错误?

Why do I get this error when I attempt to upgrade Symfony by changing `extra.symfony.require`?

我正在尝试从 Symfony 5.2 升级到 Symfony 5.3。

我不知道要更新 Symfony 的哪些软件包,所以我使用的是官方网站,并且我都关注了:

https://symfony.com/doc/current/setup/upgrade_major.html

还有 https://symfony.com/doc/current/setup/upgrade_minor.html 表示要更新:

      "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.*",

我得到了同样的作曲错误。

部分命令运行:

composer update "symfony/*" --with-all-dependencies
composer update

和 'Updating Recipes' 部分,更新了所有需要的部分。

错误依旧:

>composer update
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "5.3.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - symfony/web-profiler-bundle[v5.3.0-BETA1, ..., 5.3.x-dev] require symfony/framework-bundle ^5.3 -> found symfony/framework-bundle[v5.3.0-BETA1, ..., 5.4.x-dev] but it conflicts with your root composer.json require (5.2.*).
    - Root composer.json requires symfony/web-profiler-bundle ^5.2 -> satisfiable by symfony/web-profiler-bundle[v5.3.0-BETA1, ..., 5.3.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

composer.json

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": ">=7.2.5",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "1.11.99.1",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.3",
        "doctrine/doctrine-migrations-bundle": "^3.0",
        "doctrine/orm": "^2.8",
        "guzzlehttp/guzzle": "^7.3",
        "phpdocumentor/reflection-docblock": "^5.2",
        "sensio/framework-extra-bundle": "^6.1",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "5.2.*",
        "symfony/console": "5.3.*",
        "symfony/dotenv": "5.2.*",
        "symfony/expression-language": "5.2.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "5.2.*",
        "symfony/framework-bundle": "5.2.*",
        "symfony/http-client": "5.2.*",
        "symfony/intl": "5.2.*",
        "symfony/mailer": "5.2.*",
        "symfony/mime": "5.2.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/notifier": "5.2.*",
        "symfony/process": "5.2.*",
        "symfony/property-access": "5.2.*",
        "symfony/property-info": "5.2.*",
        "symfony/proxy-manager-bridge": "5.2.*",
        "symfony/rate-limiter": "5.2.*",
        "symfony/security-bundle": "5.2.*",
        "symfony/sendgrid-mailer": "5.3.*",
        "symfony/serializer": "5.2.*",
        "symfony/string": "5.2.*",
        "symfony/translation": "5.2.*",
        "symfony/twig-bundle": "^5.3",
        "symfony/validator": "5.2.*",
        "symfony/web-link": "5.2.*",
        "symfony/webpack-encore-bundle": "^1.11",
        "symfony/yaml": "5.2.*",
        "symfonycasts/reset-password-bundle": "^1.6",
        "symfonycasts/verify-email-bundle": "^1.3",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "symfony/browser-kit": "^5.2",
        "symfony/css-selector": "^5.2",
        "symfony/debug-bundle": "^5.3",
        "symfony/maker-bundle": "^1.30",
        "symfony/phpunit-bridge": "^5.2",
        "symfony/stopwatch": "^5.2",
        "symfony/var-dumper": "^5.2",
        "symfony/web-profiler-bundle": "^5.2"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\Tests\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "5.3.*"
        }
    }
}

您的要求有冲突。

extra.symfony.require 你说你想要 5.3.*.

但是根据您个人的 Symfony 要求,您指定 ^5.25.2.*(在某些情况下还指定 ^5.3)。

当项目使用 Symfony Flex(如您的情况)时,extra.symfony.require 的存在将用于限制为 many/most Symfony 包安装的包版本。但前提是您没有在 require 部分声明特定版本。

在这种情况下,您已经在 extra.symfony.require5.* 范围内指定了一个版本。保持那个状态,只使用 * 作为 require 部分中所有其他 Symfony 包的版本约束。

(请注意,它并不是真正的 all,因为有些包不是由 Flex 管理的,只需更新那些在 5.* 范围内声明的版本)