for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace voku\twig;
use voku\helper\AntiXSS;
/**
* Class AntiXssExtension
*/
class AntiXssExtension extends \Twig_Extension
{
* @var array
private $options = [
'is_safe' => ['html'],
'needs_environment' => false,
];
* @var callable
private $callable;
* @var AntiXss
private $antiXss;
* AntiXssExtension constructor.
*
* @param AntiXSS $antiXss
public function __construct(AntiXSS $antiXss)
$this->antiXss = $antiXss;
$antiXss
object<voku\helper\AntiXSS>
object<voku\twig\AntiXss>
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
$this->callable = [$this, 'xss_clean'];
}
* @param string $html
* @return mixed
public function xss_clean($html)
return $this->antiXss->xss_clean($html);
/** @noinspection PhpMissingParentCallCommonInspection */
* @return array
public function getFilters(): array
return [
new \Twig_SimpleFilter('xss_clean', $this->callable, $this->options),
public function getFunctions(): array
new \Twig_SimpleFunction('xss_clean', $this->callable, $this->options),
public function getTokenParsers(): array
new AntiXssTokenParser(),
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..