[Util] Add UseResolveFunctionLikeReflectionFromCallRector#8024
[Util] Add UseResolveFunctionLikeReflectionFromCallRector#8024samsonasik wants to merge 9 commits into
Conversation
|
Ideally, if this would re-use any existing method there is, not just the reflection one. |
|
that will need a real target object type, and methods that contains the both if and else method, and method replacement definition, eg: make configurable rule, eg: return RectorConfig::configure()
->withConfiguredRule(UseExistingMethodCallRector::class, [
'Rector\Reflection\ReflectionResolver' => [
'resolveMethodReflectionFromMethodCall',
'resolveMethodReflectionFromStaticCall',
'resolveFunctionLikeReflectionFromCall',
],
])wdyt? |
|
This should be generic, so we can re-use it on any codebase without configuration. The idea is: instead of this complex structure, use this existing method that has the same complex structure. |
|
Thats's seems need to lookup existing public method that contains both method. I will check if that possible in another separate PR. |
|
Yes! Should be generic, maybe it will require parsing the contents, maybe it's an idea for another tool. But should be doable with bit of agent help 👍 Closing this one then, as that's not what I need. |
Ref #8015 (review)
Also register to
rector.phpso it can run on rector-src itself.