These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\AdminBundle\Twig; |
||
4 | |||
5 | use Kunstmaan\AdminBundle\Helper\FormWidgets\Tabs\TabPane; |
||
6 | use Twig\Environment; |
||
7 | use Twig\Extension\AbstractExtension; |
||
8 | use Twig\TwigFunction; |
||
9 | |||
10 | /** |
||
11 | * Extension to render tabs |
||
12 | * |
||
13 | * @final since 5.4 |
||
14 | */ |
||
15 | class TabsTwigExtension extends AbstractExtension |
||
16 | { |
||
17 | /** |
||
18 | * Returns a list of functions to add to the existing list. |
||
19 | * |
||
20 | * @return array An array of functions |
||
0 ignored issues
–
show
|
|||
21 | */ |
||
22 | public function getFunctions() |
||
23 | { |
||
24 | return array( |
||
25 | new TwigFunction('tabs_widget', array($this, 'renderWidget'), array('needs_environment' => true, 'is_safe' => array('html'))), |
||
26 | ); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param Environment $env |
||
31 | * @param TabPane $tabPane The tab pane |
||
32 | * @param array $options The extra options |
||
33 | * @param string $template The template |
||
34 | * |
||
35 | * @return string |
||
36 | */ |
||
37 | public function renderWidget(Environment $env, TabPane $tabPane, $options = array(), $template = '@KunstmaanAdmin/TabsTwigExtension/widget.html.twig') |
||
38 | { |
||
39 | $template = $env->load($template); |
||
40 | |||
41 | return $template->render(array_merge($options, array( |
||
42 | 'tabPane' => $tabPane, |
||
43 | ))); |
||
44 | } |
||
45 | } |
||
46 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.