1 | <?php |
||
7 | class Sitemap |
||
8 | { |
||
9 | /** @var array */ |
||
10 | protected $tags = []; |
||
11 | |||
12 | |||
13 | /** |
||
14 | * @return static |
||
15 | */ |
||
16 | public static function create() |
||
20 | |||
21 | /** |
||
22 | * @param string|\Spatie\Sitemap\Tags\Tag $tag |
||
23 | * |
||
24 | * @return $this |
||
25 | */ |
||
26 | public function add($tag) |
||
36 | |||
37 | public function render(): string |
||
45 | |||
46 | public function writeToFile(string $path) |
||
52 | } |
||
53 |
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: