cakephp / upgrade

Upgrade tools for CakePHP meant to facilitate migrating from one version of the framework to another
MIT License
110 stars 60 forks source link

[5.x] AbstractRector not found #275

Closed Rakasch closed 6 months ago

Rakasch commented 6 months ago

What i did: git checkout 5.x git pull composer install --no-dev bin/cake upgrade rector --rules cakephp50 /var/www/html/myproject

I get the following error: [ERROR] Class "Rector\Rector\AbstractRector" not found

I checked my vendor files. The file exists. See Screenshot.

It does state "Reactor applied successfully". But I have some doubts because of the error.

Comment: I've already used the upgrade tool for the 4.x branch. The 4.x branch works fine, so I assume there is a problem with the 5.x branch.

image

othercorey commented 6 months ago

If you pulled the upgrade repo recently, this is probably from the rector 1/0 upgrade. I didn't notice any errors, but if it's still passing when throwing this error, that would explain it.

garas commented 6 months ago

AbstractRector in your screenshot is in Rector\Core\Rector namespace, which was renamed to Rector\Rector in Rector 0.19.

When you switched branch to 5.x, composer.json was checked out, but composer.lock was untouched because it is not in Git.

composer install used .lock file and stayed with 4.x dependencies. You got warning because .lock doesn't match .json dependencies.

Use composer update --no-dev to update to 5.x dependencies.

Rakasch commented 6 months ago

@garas Thanks, that's one of those moments when you (me) feel really stupid for overlooking it.