FriendsOfShopware/shopware-rector

Incompatible with Rector 0.18.0

Closed this issue · 4 comments

PHP Version

8.1

Shopware Version

6.5.4.0

Actual behaviour

Running Rector throws an error

CleanShot 2023-08-22 at 13 59 08@2x

Expected behaviour

Running Rector should work correctly

Steps to Reproduce?

I think this is related to rectorphp/rector-src#4698 since the import function has been refactored.

CleanShot 2023-08-22 at 14 00 46@2x
rmobis commented

We're having the same issue, had to pin rector/rector to ^0.17 in my project, which I believe is what frosh/shopware-rector should use as the dependency target too (or ^0.16 || ^0.17), given for versions < 1.0 semver states that breaking changes may be introduced on minor version bumps and using ^ instead of ~ properly accounts for that.

I do believe this is a rector/rector bug, but I'll report further with a reproducible example and then dig deeper.

rmobis commented

I've setup a MRE on this repo: https://github.com/rmobis/shopware-rector-mre

Cloning and running the following commands should reproduce the issue:

$ composer install
$ vendor/bin/rector process src --config .\rector.php

Hi, thanks for reporting. This change is intended with container switch.
Imported config paths must be explicit, to be compatible with other tooling.

Looking at shopware configs, there are just 3 files to include, so there is no need for glob loading.
https://github.com/FriendsOfShopware/shopware-rector/tree/main/config/v6.5

Also, exact paths allows PHPStan to validate if path exists.

Use exact paths instead 👍