Skip to content

Commit bc18af0

Browse files
committed
fix: php stan issues
1 parent 5365bbe commit bc18af0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Html/HtmlBuilder.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ public function script(string $url, array $attributes = [], bool $secure = null)
6363
/**
6464
* Transform the string to an Html serializable object
6565
*
66-
* @param $html
66+
* @param string $html
6767
* @return \Illuminate\Support\HtmlString
6868
*/
69-
protected function toHtmlString($html): HtmlString
69+
protected function toHtmlString(string $html): HtmlString
7070
{
7171
return new HtmlString($html);
7272
}
@@ -97,9 +97,9 @@ public function attributes(array $attributes): string
9797
*
9898
* @param string $key
9999
* @param mixed $value
100-
* @return string
100+
* @return mixed
101101
*/
102-
protected function attributeElement(string $key, mixed $value): string
102+
protected function attributeElement(string $key, mixed $value): mixed
103103
{
104104
// For numeric keys we will assume that the value is a boolean attribute
105105
// where the presence of the attribute represents a true value and the
@@ -120,10 +120,10 @@ protected function attributeElement(string $key, mixed $value): string
120120
}
121121

122122
if (! is_null($value)) {
123-
return $key.'="'.e($value, false).'"';
123+
return $key.'="'.e(strval($value), false).'"';
124124
}
125125

126-
return '';
126+
return null;
127127
}
128128

129129
/**
@@ -458,7 +458,7 @@ protected function listingElement(mixed $key, string $type, mixed $value): HtmlS
458458
if (is_array($value)) {
459459
return $this->nestedListing($key, $type, $value);
460460
} else {
461-
return '<li>'.e($value, false).'</li>';
461+
return '<li>'.e(strval($value), false).'</li>';
462462
}
463463
}
464464

@@ -467,10 +467,10 @@ protected function listingElement(mixed $key, string $type, mixed $value): HtmlS
467467
*
468468
* @param mixed $key
469469
* @param string $type
470-
* @param mixed $value
470+
* @param array $value
471471
* @return \Illuminate\Support\HtmlString|string
472472
*/
473-
protected function nestedListing(mixed $key, string $type, mixed $value): HtmlString|string
473+
protected function nestedListing(mixed $key, string $type, array $value): HtmlString|string
474474
{
475475
if (is_int($key)) {
476476
return $this->listing($type, $value);
@@ -548,6 +548,6 @@ public function tag(string $tag, mixed $content, array $attributes = []): HtmlSt
548548
{
549549
$content = is_array($content) ? implode('', $content) : $content;
550550

551-
return $this->toHtmlString('<'.$tag.$this->attributes($attributes).'>'.$this->toHtmlString($content).'</'.$tag.'>');
551+
return $this->toHtmlString('<'.$tag.$this->attributes($attributes).'>'.$this->toHtmlString(strval($content)).'</'.$tag.'>');
552552
}
553553
}

0 commit comments

Comments
 (0)