1 | <?php |
||
21 | final class TwigFileExtractor implements FileExtractor |
||
22 | { |
||
23 | /** |
||
24 | * @var Visitor[]|\Twig_NodeVisitorInterface[] |
||
25 | */ |
||
26 | private $visitors = []; |
||
27 | |||
28 | /** |
||
29 | * @var \Twig_Environment |
||
30 | */ |
||
31 | private $twig; |
||
32 | |||
33 | /** |
||
34 | * @param \Twig_Environment $twig |
||
35 | */ |
||
36 | 4 | public function __construct(\Twig_Environment $twig) |
|
40 | |||
41 | 4 | public function getSourceLocations(SplFileInfo $file, SourceCollection $collection) |
|
59 | |||
60 | 1 | public function getType() |
|
64 | |||
65 | /** |
||
66 | * @param \Twig_NodeVisitorInterface $visitor |
||
67 | */ |
||
68 | 4 | public function addVisitor(\Twig_NodeVisitorInterface $visitor) |
|
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: