| Subject | Details |
| :------------- | :---------------------------------------------------------------|
| Rector version | 0.8.x-dev@efa35bb |
| Installed as | composer dependency |
StaticCallOnNonStaticToInstanceCallRector incorrectly replaces static call to non static call if method name is dynamic.
Bug introduced in commit 791fe51b4a1a736380b56eefda79db62a7737bf5.
https://getrector.org/demo/cad7b22e-bf0c-4623-beb8-5e76b14b1ad7
<?php
class SomeClass
{
public static function someMethod()
{
return true;
}
}
class MyClass
{
public function run()
{
$method = 'someMethod';
SomeClass::$method();
}
}
---------- begin diff ----------
--- Original
+++ New
@@ -14,6 +14,6 @@
{
$method = 'someMethod';
- SomeClass::$method();
+ (new SomeClass())->{$method}();
}
}
----------- end diff -----------
Applied rules:
* Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector
No changes
Thanks for the report!
Could you send pull-request with failing fixture to StaticCallOnNonStaticToInstanceCallRectorTest?
pull request for failing test: https://github.com/rectorphp/rector/pull/3825
Just fixed, thanks for the test fixture :+1: