| 1 | <?php |
||
| 8 | class WidgetEloquentRepository extends RepositoryAbstract implements WidgetRepository |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Get all widgets. |
||
| 12 | * |
||
| 13 | * @return \Illuminate\Database\Eloquent\Collection|static[] |
||
| 14 | */ |
||
| 15 | public function all() |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Get repository model. |
||
| 22 | * |
||
| 23 | * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Builder |
||
| 24 | */ |
||
| 25 | public function getModel() |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get all published widgets. |
||
| 32 | * |
||
| 33 | * @return \Illuminate\Database\Eloquent\Collection|static[] |
||
| 34 | */ |
||
| 35 | public function getPublished() |
||
| 39 | } |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: