lint/laravel/add-relation-query-closure-type
In the lint-strict preset. In Rector’s rector-laravel/laravel-type-declarations set. Needs the laravel extension. Unsafe fix: it can change behavior.
What it does
Add type hinting to where relation has methods e.g. whereHas, orWhereHas, whereDoesntHave, orWhereDoesntHave, whereHasMorph, orWhereHasMorph, whereDoesntHaveMorph, orWhereDoesntHaveMorph
Configuration
[lint.rules]
"laravel/add-relation-query-closure-type" = "error"
To skip it in some files or lines, add an override or an ignore comment.
Replaces
EloquentWhereRelationTypeHintingParameter(rector-laravel)