rectorphp / rector

Instant Upgrades and Automated Refactoring of any PHP 5.3+ code
https://getrector.com
MIT License
8.69k stars 684 forks source link

StaticCallOnNonStaticToInstanceCallRector: fixes valid static calls #991

Closed jkuchar closed 5 years ago

jkuchar commented 5 years ago

Rector\Php\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector is broken.

dibi::setConnection() which is valid static call. And it is fixed to

image

which is not valid anymore - as setConnection is static method. There is probably something wrong with detection of which method is static and which is not.

TomasVotruba commented 5 years ago

Could you send me link to dibi class on Github? The exact version you're using in your code.

If it's forked class, please provide minimal content to replicate

jkuchar commented 5 years ago

I use forked version of dibi, but both changes are already merged in master.

TomasVotruba commented 5 years ago

The static annotation is already covered: https://github.com/rectorphp/rector/commit/bf3c583cc2b57cb51694ea1a537211a6b0141979

Could you add test fixture with your dibi class with setConnection() format causing this error?

After that the incorrect spot would be clear.

TomasVotruba commented 5 years ago

I think it's due to missing annotation, that were not in your required code yet.

Closed as covered by test. If the bug still occurs, please send new PR with test to prove that.