1

I am upgrading the existing Cakephp-3.6.16 to Cakephp-4.2and when firing the below step-4 Rector command it return the PHP Fatal error.

I followed the below steps for the upgrade

1 Install the upgrade tool

git clone git://github.com/cakephp/upgrade
cd upgrade
git checkout master
composer install --no-dev
  1. Rename locale files [This command run successfully]

C:\Apache24\htdocs\latest\Techno\upgrade\bin>cake upgrade file_rename locales C:/Apache24/htdocs/latest/Techno

  1. This command run successfully and upgrade .crt file to .php in “src/templates” folder and the folder is now moved from “Techno/src/templates” to root folder “Techno/templates”.

C:\Apache24\htdocs\latest\Techno\upgrade> cake upgrade file_rename templates C:/Apache24/htdocs/latest/Techno

  1. This two Rector Refactorings commands are not working and throwing error

C:\Apache24\htdocs\latest\Techno\upgrade\bin> cake upgrade rector --rules phpunit80 C:/Apache24/htdocs/latest/Techno/tests

C:\Apache24\htdocs\latest\Techno\upgrade\bin> cake upgrade rector --rules cakephp40 C:/Apache24/htdocs/latest/Techno/src


PHP Fatal error:  Uncaught Error: Class 'Rector\Core\Console\Style\SymfonyStyleFactory' not found in C:\Apache24\htdocs\Techno\upgrade\vendor\rector\rector\bin\rector.php:38
Stack trace:
#0 C:\Apache24\htdocs\Techno\upgrade\vendor\rector\rector\bin\rector(4): require_once()
#1 {main}
  thrown in C:\Apache24\htdocs\Techno\upgrade\vendor\rector\rector\bin\rector.php on line 38
Fatal error: Uncaught Error: Class 'Rector\Core\Console\Style\SymfonyStyleFactory' not found in C:\Apache24\htdocs\Techno\upgrade\vendor\rector\rector\bin\rector.php:38
Stack trace:
#0 C:\Apache24\htdocs\Techno\upgrade\vendor\rector\rector\bin\rector(4): require_once()
#1 {main}
  thrown in C:\Apache24\htdocs\Techno\upgrade\vendor\rector\rector\bin\rector.php on line 38

Is there any steps I missed for upgradaion ?

  • try first to upgrade to cake 4.0, then to a newer version. – Salines Jan 29 '21 at 08:56
  • From my experience rector is pretty volatile, and can break from one minute to the other, and on Windows it seems to have issues in general. So, maybe give a linux based VM/container a try, and try a different rector version by pinning it in the upgrade app's `composer.json`. – ndm Jan 29 '21 at 08:59
  • @Salines Yes, I tried to upgrade CakePHP from 3.3.16 to 4.0 version and got this errors. – user15101991 Jan 29 '21 at 10:18
  • read here https://stackoverflow.com/a/60260874/1127933 – Salines Jan 29 '21 at 10:35
  • @ndm Which version of `rector` you suggest for windows? I have installed rector/rector - 0.9.16 – user15101991 Jan 29 '21 at 10:36
  • None, it never worked for me on Windows, hence I'm suggesting a VM/container. – ndm Jan 29 '21 at 10:42

0 Answers0