psalm-plugin-laravel
psalm-plugin-laravel copied to clipboard
Missing stub for EloquentBuilder "when" method for Laravel version 8,
Currently, there is no stub for Laravel 8's EloquentBuilder "when" method and psalm showing error, when trying to call it with a second parameter.
TooManyArguments - Too many arguments for method Illuminate\Database\Eloquent\Builder::with - saw 2
From version 8 it's support a second parameter as a Closure.
https://github.com/laravel/framework/commit/c05334d29904551fe185a7f50839f37ebe2ff230
Simply add a stub, for the version 8 variant of EloquentBuilder.stubphp
/** * @param mixed $relations * @param string|\Closure|null $callback * @return self<TModel> */ public function with($relations, $callback = null) { }