如何解决升级到 CakePHP4 的 Composer 依赖项?

How do I resolve Composer dependency upgrading to CakePHP4?

我正在按照升级说明将 CakePHP 项目移动到版本 4。一切顺利,直到最后一个命令:

php composer.phar require --update-with-dependencies "cakephp/cakephp:4.0.*"

这导致

Problem 1

  • cakephp/bake 1.11.2 requires cakephp/cakephp ^3.8.0 -> satisfiable by cakephp/cakephp[3.8.0, >>3.8.0-RC1, 3.8.0-RC2, 3.8.0-RC3, 3.8.0-beta1, 3.8.1, 3.8.10, 3.8.11, 3.8.2, 3.8.3, 3.8.4, >>3.8.5, 3.8.6, 3.8.7, 3.8.8, 3.8.9, 3.x-dev] but these conflict with your requirements or >.minimum-stability.
  • cakephp/bake 1.11.2 requires cakephp/cakephp ^3.8.0 -> satisfiable by cakephp/cakephp[3.8.0, 3.8.0-RC1, 3.8.0-RC2, 3.8.0-RC3, 3.8.0-beta1, 3.8.1, 3.8.10, 3.8.11, 3.8.2, 3.8.3, 3.8.4, 3.8.5, 3.8.6, 3.8.7, 3.8.8, 3.8.9, 3.x-dev] but these conflict with your requirements or minimum-stability.
  • cakephp/bake 1.11.2 requires cakephp/cakephp ^3.8.0 -> satisfiable by cakephp/cakephp[3.8.0, 3.8.0-RC1, 3.8.0-RC2, 3.8.0-RC3, 3.8.0-beta1, 3.8.1, 3.8.10, 3.8.11, 3.8.2, 3.8.3, 3.8.4, 3.8.5, 3.8.6, 3.8.7, 3.8.8, 3.8.9, 3.x-dev] but these conflict with your requirements or minimum-stability.
  • Installation request for cakephp/bake (locked at 1.11.2, required as ^1.9.0) -> satisfiable by cakephp/bake[1.11.2].

项目的 VERSION.txt 显示 CakePHP 为 3.8.11。

在 composer.json 文件中:

    "require-dev": {
          "cakephp/bake": "^1.9.0",
           "cakephp/cakephp-codesniffer": "^3.0",
           "cakephp/debug_kit": "^3.17.0",
           "josegonzalez/dotenv": "3.*",
           "psy/psysh": "@stable"
       },

不更新,根据最新的 4.x application template's composer.json 文件更改所有要求,将您可能已安装的其他 CakePHP 插件的要求更改为 4.x 兼容版本,然后 更新您的依赖项。

composer require --no-update "cakephp/cakephp:^4.0" "cakephp/migrations:^3.0@beta"
composer require --no-update --dev "cakephp/bake:^2.0.3" "cakephp/cakephp-codesniffer:~4.1.0" "cakephp/debug_kit:^4.0" "phpunit/phpunit:^8.5"
composer update --with-dependencies