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 Twig_Environment; |
||
6 | use Twig_Extension; |
||
7 | |||
8 | /** |
||
9 | * Extension to render blocks of twig templates |
||
10 | */ |
||
11 | class ToolbarTwigExtension extends Twig_Extension |
||
12 | { |
||
13 | /** |
||
14 | * Returns a list of functions to add to the existing list. |
||
15 | * |
||
16 | * @return array An array of functions |
||
0 ignored issues
–
show
|
|||
17 | */ |
||
18 | public function getFunctions() |
||
19 | { |
||
20 | return array( |
||
21 | new \Twig_SimpleFunction('block_render', array($this, 'renderBlock'), array('needs_environment' => true, 'is_safe' => array('html'))), |
||
22 | ); |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * @param Twig_Environment $env |
||
27 | * @param $template |
||
28 | * @param $block |
||
29 | * @param $context |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | public function renderBlock(Twig_Environment $env, $template, $block, $context) |
||
34 | { |
||
35 | $template = $env->loadTemplate($template); |
||
36 | $context = $env->mergeGlobals($context); |
||
37 | |||
38 | return $template->renderBlock($block, $context); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return string |
||
43 | */ |
||
44 | public function getName() |
||
45 | { |
||
46 | return 'toolbar_twig_extension'; |
||
47 | } |
||
48 | } |
||
49 |
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.