| 1 | <?php |
||
| 13 | class View implements Item, Activatable, HasParentAttributes |
||
| 14 | { |
||
| 15 | use ActivatableTrait, Macroable, HasParentAttributesTrait; |
||
| 16 | |||
| 17 | /** @var string */ |
||
| 18 | protected $name; |
||
| 19 | |||
| 20 | /** @var array */ |
||
| 21 | protected $data; |
||
| 22 | |||
| 23 | /** @var string|null */ |
||
| 24 | protected $url = null; |
||
| 25 | |||
| 26 | /** @var bool */ |
||
| 27 | protected $active = false; |
||
| 28 | |||
| 29 | /** @var Attributes */ |
||
| 30 | protected $parentAttributes; |
||
| 31 | |||
| 32 | public function __construct(string $name, array $data = []) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param string $name |
||
| 41 | * @param array $data |
||
| 42 | * |
||
| 43 | * @return static |
||
| 44 | */ |
||
| 45 | public static function create(string $name, array $data = []) |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function render(): string |
||
| 65 | } |
||
| 66 |
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: