Open vitkutny opened 1 year ago
Please show a piece of code for which "Nette\Utils\Html::insert(): Argument #2 ($child) must be of type Nette\HtmlStringable|string, XY given" is currently reported and which this PR should fix.
Also - did you first try to send a PR to https://github.com/nette/utils?
Please show a piece of code for which "Nette\Utils\Html::insert(): Argument https://github.com/phpstan/phpstan-nette/pull/2 ($child) must be of type Nette\HtmlStringable|string, XY given" is currently reported and which this PR should fix.
addHtml
method only calls insert
method with parameter type HtmlStringable|string
. This stub update prevents from passing only \Stringable
(or any other type than HtmlStringable|string
) into addHtml
namespace Nette\Utils;
class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringable
{
/**
* Adds new element's child.
*/
final public function addHtml(mixed $child): static
{
return $this->insert(null, $child);
}
/**
* Inserts child node.
*/
public function insert(?int $index, HtmlStringable|string $child, bool $replace = false): static
{
}
}
Also - did you first try to send a PR to https://github.com/nette/utils?
Right, I did not. I will :-)
fixes
Nette\Utils\Html::insert(): Argument #2 ($child) must be of type Nette\HtmlStringable|string, XY given