1 | <?php |
||
12 | class TwigTemplate implements TemplateInterface |
||
13 | { |
||
14 | private $template; |
||
15 | |||
16 | 12 | public function __construct(\Twig_Template $template) |
|
20 | |||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | 12 | public function getTemplateName() |
|
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function getParentTemplate() |
||
33 | { |
||
34 | $parent = $this->template->getParent([]); |
||
35 | |||
36 | if ($parent === false) |
||
37 | { |
||
38 | return false; |
||
39 | } |
||
40 | |||
41 | return new TwigTemplate($parent); |
||
|
|||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 12 | public function render(array $context = []) |
|
51 | } |
||
52 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.