Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rector to replace constructor with static method call #5245

Closed
bendavies opened this issue Jan 19, 2021 · 3 comments
Closed

Rector to replace constructor with static method call #5245

bendavies opened this issue Jan 19, 2021 · 3 comments

Comments

@bendavies
Copy link
Contributor

Hi there,

I had a look through the rectors, but couldn't find anything.
Is there a rector that can do this?
before:

new Foo('bar');

after

Foo::create('bar');

many thanks!

@TomasVotruba
Copy link
Member

Hi Ben,

such rules could be found in "Transform" group. E.g. method call to static call etc.

Maybe this one:
https://github.com/rectorphp/rector/blob/master/docs/rector_rules_overview.md#newtostaticcallrector

@bendavies
Copy link
Contributor Author

Doh! thankyou @TomasVotruba !

@TomasVotruba
Copy link
Member

You're welcome :)

TomasVotruba added a commit that referenced this issue Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants