234234class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringable
235235{
236236 /** @var array<string, mixed> element's attributes */
237- public $ attrs = [];
237+ public array $ attrs = [];
238238
239239 /** void elements */
240- public static $ emptyElements = [
240+ public static array $ emptyElements = [
241241 'img ' => 1 , 'hr ' => 1 , 'br ' => 1 , 'input ' => 1 , 'meta ' => 1 , 'area ' => 1 , 'embed ' => 1 , 'keygen ' => 1 ,
242242 'source ' => 1 , 'base ' => 1 , 'col ' => 1 , 'link ' => 1 , 'param ' => 1 , 'basefont ' => 1 , 'frame ' => 1 ,
243243 'isindex ' => 1 , 'wbr ' => 1 , 'command ' => 1 , 'track ' => 1 ,
244244 ];
245245
246246 /** @var array<int, HtmlStringable|string> nodes */
247- protected $ children = [];
247+ protected array $ children = [];
248248
249249 /** element's name */
250250 private string $ name = '' ;
@@ -573,7 +573,7 @@ final public function getText(): string
573573 /**
574574 * Adds new element's child.
575575 */
576- final public function addHtml (mixed $ child ): static
576+ final public function addHtml (HtmlStringable | string $ child ): static
577577 {
578578 return $ this ->insert (null , $ child );
579579 }
@@ -582,7 +582,7 @@ final public function addHtml(mixed $child): static
582582 /**
583583 * Appends plain-text string to element content.
584584 */
585- public function addText (mixed $ text ): static
585+ public function addText (\ Stringable | string $ text ): static
586586 {
587587 if (!$ text instanceof HtmlStringable) {
588588 $ text = htmlspecialchars ((string ) $ text , ENT_NOQUOTES , 'UTF-8 ' );
0 commit comments