Skip to content

[Util] Add UseResolveFunctionLikeReflectionFromCallRector#8024

Closed
samsonasik wants to merge 9 commits into
mainfrom
samsonasik/utils-rector-resolve-function-like-reflection-from-call
Closed

[Util] Add UseResolveFunctionLikeReflectionFromCallRector#8024
samsonasik wants to merge 9 commits into
mainfrom
samsonasik/utils-rector-resolve-function-like-reflection-from-call

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@samsonasik samsonasik commented Jun 4, 2026

Ref #8015 (review)

Also register to rector.php so it can run on rector-src itself.

@samsonasik samsonasik requested a review from TomasVotruba June 4, 2026 14:25
@TomasVotruba
Copy link
Copy Markdown
Member

Ideally, if this would re-use any existing method there is, not just the reflection one.

@samsonasik
Copy link
Copy Markdown
Member Author

samsonasik commented Jun 4, 2026

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?

@TomasVotruba
Copy link
Copy Markdown
Member

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.

@samsonasik
Copy link
Copy Markdown
Member Author

Thats's seems need to lookup existing public method that contains both method. I will check if that possible in another separate PR.

@TomasVotruba
Copy link
Copy Markdown
Member

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.

@samsonasik samsonasik deleted the samsonasik/utils-rector-resolve-function-like-reflection-from-call branch June 4, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants