Feature: Eloquent Collection Types
Illuminate\Database\Eloquent\Collection has type support
Background:
Given I have the following config
"""
"""
Scenario:
Given I have the following code
"""
*/
public function getAll(): \Illuminate\Database\Eloquent\Collection
{
return User::all();
}
public function getFirst(): ?User
{
return $this->getAll()->first();
}
/**
* @return \Illuminate\Database\Eloquent\Builder
*/
public function getBuilder(array $attributes): \Illuminate\Database\Eloquent\Builder
{
return User::where($attributes);
}
/**
* @psalm-return \Illuminate\Database\Eloquent\Collection
*/
public function getWhere(array $attributes): \Illuminate\Database\Eloquent\Collection
{
return User::where($attributes)->get();
}
}
"""
When I run Psalm
Then I see no errors