1 | <?php |
||
19 | final class CollectResponse implements ResponsableContract |
||
20 | { |
||
21 | private $repositories; |
||
22 | |||
23 | public function __construct(iterable $repositories) |
||
27 | |||
28 | /** |
||
29 | * Create an HTTP response that represents the object. |
||
30 | * |
||
31 | * @param \Illuminate\Http\Request $request |
||
32 | * @return \Symfony\Component\HttpFoundation\Response |
||
33 | */ |
||
34 | public function toResponse($request) |
||
38 | |||
39 | private function toJson(): JsonResponse |
||
43 | } |
||
44 |
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: