1 | <?php |
||
19 | class TimelineWidget extends \Twig_Extension |
||
20 | { |
||
21 | protected $widgetOptions; |
||
22 | protected $timeline; |
||
23 | |||
24 | /** |
||
25 | * @param WidgetOptions $widgetOptions |
||
26 | * @param TimelineBuilderInterface $timeline |
||
27 | */ |
||
28 | 6 | public function __construct(WidgetOptions $widgetOptions, TimelineBuilderInterface $timeline) |
|
33 | |||
34 | /** |
||
35 | * @return array |
||
36 | */ |
||
37 | 1 | public function getFunctions() |
|
38 | { |
||
39 | return [ |
||
40 | 1 | new \Twig_SimpleFunction('tw', [$this, 'renderWidget'], ['is_safe' => ['html']]), |
|
41 | 1 | new \Twig_SimpleFunction('twJs', [$this, 'getOneTimeWidgetJs'], ['is_safe' => ['html']]), |
|
42 | |||
43 | ]; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return string |
||
48 | */ |
||
49 | 1 | public function getName() |
|
53 | |||
54 | /** |
||
55 | * @param array|WidgetOptionsInterface $options |
||
56 | * @param bool $addJs |
||
57 | * @return string |
||
58 | */ |
||
59 | 2 | public function renderWidget($options, $addJs = true) |
|
70 | |||
71 | /** |
||
72 | * @return mixed |
||
73 | */ |
||
74 | 1 | public function getOneTimeWidgetJs() |
|
78 | } |
||
79 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.