for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Kunstmaan\AdminBundle\Twig;
use Twig_Environment;
use Twig_Extension;
/**
* Extension to render blocks of twig templates
*/
class ToolbarTwigExtension extends Twig_Extension
{
* Returns a list of functions to add to the existing list.
*
* @return array An array of functions
\Twig_SimpleFunction[]
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.
array
public function getFunctions()
return array(
new \Twig_SimpleFunction('block_render', array($this, 'renderBlock'), array('needs_environment' => true, 'is_safe' => array('html'))),
);
}
* @param Twig_Environment $env
* @param $template
* @param $block
* @param $context
* @return string
public function renderBlock(Twig_Environment $env, $template, $block, $context)
$template = $env->loadTemplate($template);
$context = $env->mergeGlobals($context);
return $template->renderBlock($block, $context);
public function getName()
return 'toolbar_twig_extension';
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.