driftingly / rector-laravel

Rector upgrades rules for Laravel
http://getrector.org
MIT License
500 stars 49 forks source link

[CodeQuality] Adds rules for the with and value helpers #175

Closed peterfox closed 7 months ago

peterfox commented 7 months ago

Changes

Why

Based on rules from Larastan. These are quite simple little use cases where we can remove the use of a helper when it's not needed.

-value(new Object())->something();
+(new Object())->something();

-with(new Object())->something(); +(new Object())->something();

value() => https://github.com/larastan/larastan/blob/2.x/src/Rules/UselessConstructs/NoUselessValueFunctionCallsRule.php with() => https://github.com/larastan/larastan/blob/2.x/src/Rules/UselessConstructs/NoUselessWithFunctionCallsRule.php

driftingly commented 7 months ago

Thanks @peterfox 🙌