driftingly / rector-laravel

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

Adds the EloquentWhereTypeHintClosureParameterRector #141

Closed peterfox closed 11 months ago

peterfox commented 11 months ago

Adds a new rule to help add type hinting in a similar way to #138

EloquentWhereTypeHintClosureParameterRector

Change typehint of closure parameter in where method of Eloquent Builder

-$query->where(function ($query) {
+$query->where(function (\Illuminate\Contracts\Database\Eloquent\Builder $query) {
     $query->where('id', 1);
 });

Covers both static use with a Model and the instant's use on the builder.