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

Facades are rewritten to Service via StaticCallOnNonStaticToInstanceCallRector #187

Open
Jaspur opened this issue Feb 26, 2024 · 2 comments

Comments

@Jaspur
Copy link

Jaspur commented Feb 26, 2024

Hi,

How can I prevent that Facades are being rewritten to Service classes?

-        $subtotal = Webshop::calculateTotals($order->cart, $order->country, coupon: $coupon);
+        $subtotal = (new Webshop())->calculateTotals($order->cart, $order->country, coupon: $coupon);

Want to keep the Facade-way, because Facade isn't static.

Adding one of those to withSkip() didn't help: ThisCallOnStaticMethodToStaticCallRector::class & StaticCallOnNonStaticToInstanceCallRector

@Jaspur Jaspur changed the title Facades are rewritten to Service Facades are rewritten to Service via StaticCallOnNonStaticToInstanceCallRector Feb 26, 2024
@GeniJaho
Copy link
Collaborator

@Jaspur skipping StaticCallOnNonStaticToInstanceCallRector should work, unless there is some other rule that is making the change. When you run Rector (also with --dry-run), you can see which rule made the change, and you can skip it.
If that doesn't work, can you share the rules you're using and skipping in your RectorConfig, please?

@peterfox
Copy link
Collaborator

peterfox commented Jan 3, 2025

@Jaspur I have a feeling this is maybe caused by the namespace of your classes. Can you provide a sample where the namespaces are provided as well for context?

This is technically a problem rule to rules in the main rector repo as well, which would be out of scope for this project.

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

3 participants