Unable to use upgrade tool to upgrade from CakePHP 3.9 to CakePHP 4.0

Hello,

Unless I am doing something very wrong, I cannot get a fresh installation of the upgrade tool to work on a clean CakePHP 3.9 skeleton

Steps to reproduce:

Install the CakePHP 3.9 skeleton into /tmp/cakestuff/myapp

cd /tmp
mkdir cakestuff
cd cakestuff
composer create-project --prefer-dist "cakephp/app:^3.8" myapp

Install the upgrade tool into /tmp/cakestuff/upgrade

git clone git://github.com/cakephp/upgrade
cd upgrade
composer install --no-dev

Attempt to upgrade /tmp/cakestuff/myapp

bin/cake upgrade /tmp/cakestuff/myapp

This produces the following output:

Moving templates
Renaming /tmp/cakestuff/myapp/src/Template
Moving sub directories of /tmp/cakestuff/myapp/templates
Recursively changing extensions in /tmp/cakestuff/myapp/templates
Moving locale files
Renaming /tmp/cakestuff/myapp/src/Locale
Applying cakephp40 Rector rules


 [ERROR] Undefined class constant 'CAKEPHP_40'


Rector applied successfully


 [ERROR] Undefined class constant 'CAKEPHP_40'


Rector applied successfully


 [ERROR] Undefined class constant 'CAKEPHP_40'


Rector applied successfully


 [ERROR] Undefined class constant 'CAKEPHP_40'


Rector applied successfully
Applying phpunit80 Rector rules


 [ERROR] Undefined class constant 'PHPUNIT_80'


Rector applied successfully
Next upgrade your composer.json.

Am I doing something very wrong or stupid, or is there an issue with the upgrade tool?

This is on PHP 7.4.16 with rector 0.10.20

You should open an issue on the upgrade repo

Thanks! I have opened an issue at Undefined class constants: Fresh installation of upgrade tool fails on clean CakePHP3.9 skeleton · Issue #169 · cakephp/upgrade · GitHub and it does appear to be a bug, in case anyone else ends up here and has the same issue.