driftingly / rector-laravel

Rector upgrades rules for Laravel
http://getrector.org
MIT License
529 stars 51 forks source link

Add missing renames for dispatchNow method on Jobs #219

Closed GeniJaho closed 4 months ago

GeniJaho commented 5 months ago

Fixes https://github.com/driftingly/rector-laravel/issues/215.

peterfox commented 5 months ago

Have you tested this? It might not work as Dispatchables is a trait if I remember correctly and won't be picked up in the same way PHPStan does with Classes and Interfaces because it's not a type.

GeniJaho commented 5 months ago

@peterfox Yes, both in a real project and with tests in the rector-laravel code. The RenameMethodRector takes trait uses into account when we provide traits instead of regular classes to it.

It would be great if we could add tests for the sets instead of just the rules. Not sure if this has been mentioned or considered before in the core Rector repo.

peterfox commented 5 months ago

@GeniJaho okay good to know, I know when I've used PHPStan directly I found it didn't find traits so wanted to double check.

I created a folder for testing Sets if you're asking if it's possible? It's just creating a config that points to the sets. Tests are otherwise the same as rule tests.

GeniJaho commented 4 months ago

@peterfox that's exactly what I was looking for, thank you. I didn't know we already had them.

I added tests for the Laravel 10 Set and fixed a 'bad' configuration for renaming $routeMiddleware in the Http Kernel.