deprecated-packages / rector-cakephp

[DEPRECATED] Use following package instead
https://github.com/cakephp/upgrade
MIT License
20 stars 3 forks source link

How to replace chained method call #7

Closed othercorey closed 2 years ago

othercorey commented 2 years ago

@TomasVotruba

We have an API change in CakePHP 4.3:

From:

$this->getTableLocator()->get('Table');

To:

$this->fetchTable('Table');

Is there a rector rule that allows this?

This is available for a specific Trait, but we do have classes we know use the trait if that's not possible.

TomasVotruba commented 2 years ago

Hi, thanks for great question 👍

First you need to find method call, where:

Then return a new MethodCall() node and see what happens. The rest will be clear to you ☺️

markstory commented 2 years ago

This can be fixed with #9