for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Kunstmaan\UtilitiesBundle\Twig;
use Kunstmaan\UtilitiesBundle\Helper\SlugifierInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
/**
* @final since 5.4
*/
class UtilitiesTwigExtension extends AbstractExtension
{
* @var SlugifierInterface
private $slugifier;
* @param $slugifier
public function __construct($slugifier)
$this->slugifier = $slugifier;
}
* Returns a list of filters.
*
* @return array An array of filters
TwigFilter[]
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 getFilters()
return [
new TwigFilter('slugify', [$this, 'slugify']),
];
* @param string $text
* @return string
public function slugify($text)
return $this->slugifier->slugify($text);
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.