rectorphp / rector-phpunit

Rector upgrade rules for PHPUnit
https://getrector.com/find-rule?activeRectorSetGroup=phpunit
MIT License
64 stars 47 forks source link

NamedArgumentForDataProviderRector not working because the class DataProvider is using a scoped rector version #344

Closed gnutix closed 3 months ago

gnutix commented 3 months ago

Hello there,

I've just tried the new NamedArgumentForDataProviderRector rule and was surprised that it changed nothing in my project. I started debugging and the issue was this :

-use RectorPrefix202406\PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\DataProvider;

I'm not sure if the issue is that the DataProvider class must be referenced somewhere in Rector's code to be properly handled when scoped, or if the issue is with how Rector is installed in our project (which is quite standard I think, but these things tend to get complicated real fast, so who knows...).

gnutix

TomasVotruba commented 3 months ago

Hi, indeed, this class name should be untouched.

@samsonasik Could you fix this one, as it requires a bit of Rector internals?

samsonasik commented 3 months ago

Yes, here the PR: