| 1 | <?php |
||
| 9 | class View implements Item, Activatable |
||
| 10 | { |
||
| 11 | use ActivatableTrait; |
||
| 12 | |||
| 13 | /** @var string */ |
||
| 14 | protected $name; |
||
| 15 | |||
| 16 | /** @var array */ |
||
| 17 | protected $data; |
||
| 18 | |||
| 19 | public function __construct(string $name, array $data = []) |
||
| 24 | |||
| 25 | public static function create(string $name, array $data = []) |
||
| 29 | |||
| 30 | public function render(): string |
||
| 36 | } |
||
| 37 |
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: