Skip to content

[Transform] MethodCall to New#6352

Merged
TomasVotruba merged 3 commits intorectorphp:mainfrom
peterfox:feature/method-call-to-new
Oct 11, 2024
Merged

[Transform] MethodCall to New#6352
TomasVotruba merged 3 commits intorectorphp:mainfrom
peterfox:feature/method-call-to-new

Conversation

@peterfox
Copy link
Contributor

@peterfox peterfox commented Oct 4, 2024

Changes

  • Adds a new rule for MethodCall to New
  • Adds a MethodCallToNew value object
  • Adds tests for the new rule

Why

This can be useful when you have something like a factory class that creates a new instance.

-$factory->createResponse(['a' => 1]);
+new Response(['a' => 1]);

@TomasVotruba
Copy link
Member

Thanks @peterfox 👍

@TomasVotruba TomasVotruba merged commit 28ba716 into rectorphp:main Oct 11, 2024
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

Successfully merging this pull request may close these issues.

3 participants