rectorphp / rector-phpunit

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

Check if an assert method is static before calling it with self #331

Closed pl-github closed 4 months ago

pl-github commented 4 months ago

In my project, I have self-defined assert methods that are not static because they need to access some instance variables. But the PreferPHPUnitSelfCallRector rule converts all method calls to static calls because the names match.

I created a patch that additionally checks if the assert method can be called statically.

samsonasik commented 4 months ago

Looks good, thank you @pl-github