for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace NatePage\EasyHtmlElement\Bridge\Twig;
use NatePage\EasyHtmlElement\HtmlElementInterface;
use NatePage\EasyHtmlElement\ElementInterface;
class EasyHtmlElementExtension extends \Twig_Extension
{
/** @var HtmlElementInterface */
private $htmlElement;
public function __construct(HtmlElementInterface $htmlElement)
$this->htmlElement = $htmlElement;
}
/**
* {@inheritdoc}
*/
public function getFunctions(): array
return array(
new \Twig_Function('htmlElement', array($this, 'load'), array('is_safe' => array('html')))
);
* Load a html element.
*
* @param string|array $name The element name
* @param array $parameters The element parameters
* @param array $attributes The element attributes
* @param array $children The element children
* @return ElementInterface
public function load(
$name,
array $parameters = array(),
array $attributes = array(),
array $children = array()
): ElementInterface
return $this->htmlElement->load($name, $parameters, $attributes, $children);
$parameters
array
string|null
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: