Skip to content

Conversation

@LordSimal
Copy link
Contributor

@LordSimal LordSimal commented May 25, 2025

Refs: cakephp/upgrade#310

As we are currently trying to write configs to rename a whole bunch of methods for our newest major version of CakePHP we recognised, that the RenameMethodRector does not work with traits (or at least not how we expected it to)

How do we expect it to work?

Well if we configure rector with

new MethodCallRename(SomeTrait::class, '_test', 'test'),

it should

  • not only rename the trait method itself, but also
  • all class methods, which use this trait method and
  • all class methods, which have overwritten that trait method with their own implementation

This is my crude implementation of how this could work.

I am - in fact - not really accustomed to this codebase so this could very well be a horrible hack in your opinion, so please bear with me 😅

@TomasVotruba TomasVotruba requested a review from samsonasik May 27, 2025 09:00
@samsonasik
Copy link
Member

Let's give it a try, thank you @LordSimal

@samsonasik samsonasik merged commit 512ccd2 into rectorphp:main May 27, 2025
45 checks passed
@github-actions
Copy link
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants