Skip to content

Commit 0a8ad30

Browse files
committed
Html: improved type hints [Closes nette/nette#1570]
1 parent 17932ce commit 0a8ad30

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Utils/Html.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ public function data(string $name, mixed $value = null): static
531531
/**
532532
* Sets element's HTML content.
533533
*/
534-
final public function setHtml(mixed $html): static
534+
final public function setHtml(HtmlStringable|string $html): static
535535
{
536536
$this->children = [(string) $html];
537537
return $this;
@@ -550,7 +550,7 @@ final public function getHtml(): string
550550
/**
551551
* Sets element's textual content.
552552
*/
553-
final public function setText(mixed $text): static
553+
final public function setText(\Stringable|string $text): static
554554
{
555555
if (!$text instanceof HtmlStringable) {
556556
$text = htmlspecialchars((string) $text, ENT_NOQUOTES, 'UTF-8');
@@ -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

Comments
 (0)