rector-laravel
rector-laravel copied to clipboard
Facades are rewritten to Service via StaticCallOnNonStaticToInstanceCallRector
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 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?