| 1 | <?php |
||
| 11 | class GateRegistrar |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var GateContract |
||
| 15 | */ |
||
| 16 | private $gate; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var Repository |
||
| 20 | */ |
||
| 21 | private $cache; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * GateRegistrar constructor. |
||
| 25 | * |
||
| 26 | * @param GateContract $gate |
||
| 27 | * @param Repository $cache |
||
| 28 | */ |
||
| 29 | public function __construct(GateContract $gate, Repository $cache) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Handle permission gate registration. |
||
| 37 | */ |
||
| 38 | public function register() |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Get all permissions. |
||
| 57 | * |
||
| 58 | * @return Collection |
||
| 59 | */ |
||
| 60 | protected function getPermissions() |
||
| 72 | } |
||
| 73 |
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: