nette / utils

🛠 Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
https://doc.nette.org/utils
Other
2.01k stars 149 forks source link

Incorrect argument type definition in `addHtml` method #313

Open mskocik opened 5 months ago

mskocik commented 5 months ago

Version: latest

Bug Description

Method addHtml() has mixed type definition, which is incorrect. In fact it really expects HtmlStringable|string, because of inner call of ->insert().

~The same applies to addText().~

Steps To Reproduce

Html::el('span')->addHtml(0); // results in following TypeError

TypeError Nette\Utils\Html::insert(): Argument #2 ($child) must be of type Nette\HtmlStringable|string, int given

Expected Behavior

No type error being thrown

dg commented 5 months ago

Please send PR