Skip to content

Commit f3c7969

Browse files
Merge pull request #21 from mralston/7.x
PHP 8.4
2 parents d4b7271 + 1d8f442 commit f3c7969

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

src/FormBuilder.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public function withoutCsrf(bool $inject_token = false): static
273273
*
274274
* @return HtmlString|string
275275
*/
276-
public function label(string $name, string $value = null, array|null $options = [], bool|null $escape_html = true): HtmlString|string
276+
public function label(string $name, string|null $value = null, array|null $options = [], bool|null $escape_html = true): HtmlString|string
277277
{
278278
$this->labels[] = $name;
279279

@@ -311,7 +311,7 @@ protected function formatLabel(string $name, ?string $value): string
311311
*
312312
* @return string|HtmlString
313313
*/
314-
public function input(string $type, string|null $name, string $value = null, array $options = []): string|HtmlString
314+
public function input(string $type, string|null $name, string|null $value = null, array $options = []): string|HtmlString
315315
{
316316
$this->type = $type;
317317

@@ -347,7 +347,7 @@ public function input(string $type, string|null $name, string $value = null, arr
347347
*
348348
* @return string|HtmlString
349349
*/
350-
public function text(string $name, string $value = null, array $options = []): string|HtmlString
350+
public function text(string $name, string|null $value = null, array $options = []): string|HtmlString
351351
{
352352
return $this->input('text', $name, $value, $options);
353353
}
@@ -374,7 +374,7 @@ public function password(string $name, array $options = []): string|HtmlString
374374
*
375375
* @return string|HtmlString
376376
*/
377-
public function range(string $name, string $value = null, array $options = []): string|HtmlString
377+
public function range(string $name, string|null $value = null, array $options = []): string|HtmlString
378378
{
379379
return $this->input('range', $name, $value, $options);
380380
}
@@ -388,7 +388,7 @@ public function range(string $name, string $value = null, array $options = []):
388388
*
389389
* @return string|HtmlString
390390
*/
391-
public function hidden(string $name, string $value = null, array $options = []): string|HtmlString
391+
public function hidden(string $name, string|null $value = null, array $options = []): string|HtmlString
392392
{
393393
return $this->input('hidden', $name, $value, $options);
394394
}
@@ -402,7 +402,7 @@ public function hidden(string $name, string $value = null, array $options = []):
402402
*
403403
* @return string|HtmlString
404404
*/
405-
public function search(string $name, string $value = null, array $options = []): string|HtmlString
405+
public function search(string $name, string|null $value = null, array $options = []): string|HtmlString
406406
{
407407
return $this->input('search', $name, $value, $options);
408408
}
@@ -416,7 +416,7 @@ public function search(string $name, string $value = null, array $options = []):
416416
*
417417
* @return string|HtmlString
418418
*/
419-
public function email(string $name, string $value = null, array $options = []): string|HtmlString
419+
public function email(string $name, string|null $value = null, array $options = []): string|HtmlString
420420
{
421421
return $this->input('email', $name, $value, $options);
422422
}
@@ -430,7 +430,7 @@ public function email(string $name, string $value = null, array $options = []):
430430
*
431431
* @return string|HtmlString
432432
*/
433-
public function tel(string $name, string $value = null, array $options = []): string|HtmlString
433+
public function tel(string $name, string|null $value = null, array $options = []): string|HtmlString
434434
{
435435
return $this->input('tel', $name, $value, $options);
436436
}
@@ -444,7 +444,7 @@ public function tel(string $name, string $value = null, array $options = []): st
444444
*
445445
* @return string|HtmlString
446446
*/
447-
public function number(string $name, string $value = null, array $options = []): string|HtmlString
447+
public function number(string $name, string|null $value = null, array $options = []): string|HtmlString
448448
{
449449
return $this->input('number', $name, $value, $options);
450450
}
@@ -458,7 +458,7 @@ public function number(string $name, string $value = null, array $options = []):
458458
*
459459
* @return string|HtmlString
460460
*/
461-
public function date(string $name, string|DateTimeInterface $value = null, array $options = []): string|HtmlString
461+
public function date(string $name, string|DateTimeInterface|null $value = null, array $options = []): string|HtmlString
462462
{
463463
$value ??= $this->getValueAttribute($name, $value);
464464

@@ -478,7 +478,7 @@ public function date(string $name, string|DateTimeInterface $value = null, array
478478
*
479479
* @return HtmlString|string
480480
*/
481-
public function datetime(string $name, string|DateTimeInterface $value = null, array $options = []): HtmlString|string
481+
public function datetime(string $name, string|DateTimeInterface|null $value = null, array $options = []): HtmlString|string
482482
{
483483
if ($value instanceof DateTimeInterface) {
484484
$value = $value->format(DateTimeInterface::RFC3339);
@@ -497,7 +497,7 @@ public function datetime(string $name, string|DateTimeInterface $value = null, a
497497
* @return HtmlString|string
498498
* @noinspection PhpUnused
499499
*/
500-
public function datetimeLocal(string $name, string|DateTimeInterface $value = null, array $options = []): HtmlString|string
500+
public function datetimeLocal(string $name, string|DateTimeInterface|null $value = null, array $options = []): HtmlString|string
501501
{
502502
if ($value instanceof DateTimeInterface) {
503503
$value = $value->format('Y-m-d\TH:i');
@@ -515,7 +515,7 @@ public function datetimeLocal(string $name, string|DateTimeInterface $value = nu
515515
*
516516
* @return HtmlString|string
517517
*/
518-
public function time(string $name, string|DateTimeInterface $value = null, array $options = []): HtmlString|string
518+
public function time(string $name, string|DateTimeInterface|null $value = null, array $options = []): HtmlString|string
519519
{
520520
if ($value instanceof DateTimeInterface) {
521521
$value = $value->format('H:i');
@@ -533,7 +533,7 @@ public function time(string $name, string|DateTimeInterface $value = null, array
533533
*
534534
* @return HtmlString|string
535535
*/
536-
public function url(string $name, string $value = null, array $options = []): HtmlString|string
536+
public function url(string $name, string|null $value = null, array $options = []): HtmlString|string
537537
{
538538
return $this->input('url', $name, $value, $options);
539539
}
@@ -547,7 +547,7 @@ public function url(string $name, string $value = null, array $options = []): Ht
547547
*
548548
* @return HtmlString|string
549549
*/
550-
public function week(string $name, string|DateTimeInterface $value = null, array $options = []): HtmlString|string
550+
public function week(string $name, string|DateTimeInterface|null $value = null, array $options = []): HtmlString|string
551551
{
552552
if ($value instanceof DateTimeInterface) {
553553
$value = $value->format('Y-\WW');
@@ -578,7 +578,7 @@ public function file(string $name, array $options = []): HtmlString|string
578578
*
579579
* @return HtmlString|string
580580
*/
581-
public function textarea(string $name, string $value = null, array $options = []): HtmlString|string
581+
public function textarea(string $name, string|null $value = null, array $options = []): HtmlString|string
582582
{
583583
$this->type = 'textarea';
584584

@@ -659,7 +659,7 @@ protected function setQuickTextAreaSize(array $options): array
659659
public function select(
660660
string $name,
661661
array|Collection $list = [],
662-
bool|string|array|Collection $selected = null,
662+
bool|string|array|Collection|null $selected = null,
663663
array $selectAttributes = [],
664664
array $optionsAttributes = [],
665665
array $optgroupsAttributes = []
@@ -717,7 +717,7 @@ public function select(
717717
*
718718
* @return HtmlString|string
719719
*/
720-
public function selectRange(string $name, string $begin, string $end, string $selected = null, array $options = []): HtmlString|string
720+
public function selectRange(string $name, string $begin, string $end, string|null $selected = null, array $options = []): HtmlString|string
721721
{
722722
$range = array_combine($range = range($begin, $end), $range);
723723

@@ -735,7 +735,7 @@ public function selectRange(string $name, string $begin, string $end, string $se
735735
*
736736
* @return mixed
737737
*/
738-
public function selectYear(string $name, string $begin, string $end, string $selected = null, array $options = null): mixed
738+
public function selectYear(string $name, string $begin, string $end, string|null $selected = null, array|null $options = null): mixed
739739
{
740740
return call_user_func_array([$this, 'selectRange'], func_get_args());
741741
}
@@ -750,7 +750,7 @@ public function selectYear(string $name, string $begin, string $end, string $sel
750750
*
751751
* @return HtmlString|string
752752
*/
753-
public function selectMonth(string $name, string $selected = null, array $options = [], string $format = 'F'): HtmlString|string
753+
public function selectMonth(string $name, string|null $selected = null, array $options = [], string $format = 'F'): HtmlString|string
754754
{
755755
$months = [];
756756

@@ -898,7 +898,7 @@ public function checkbox(string $name, mixed $value = 1, bool|null $checked = nu
898898
*
899899
* @return HtmlString|string
900900
*/
901-
public function radio(string $name, mixed $value = null, bool $checked = null, array $options = []): HtmlString|string
901+
public function radio(string $name, mixed $value = null, bool|null $checked = null, array $options = []): HtmlString|string
902902
{
903903
if (is_null($value)) {
904904
$value = $name;
@@ -1050,7 +1050,7 @@ public function reset(string $value, array $attributes = []): HtmlString|string
10501050
*
10511051
* @return HtmlString|string
10521052
*/
1053-
public function image(string $url, string $name = null, array $attributes = []): HtmlString|string
1053+
public function image(string $url, string|null $name = null, array $attributes = []): HtmlString|string
10541054
{
10551055
$attributes['src'] = $this->url->asset($url);
10561056

@@ -1066,7 +1066,7 @@ public function image(string $url, string $name = null, array $attributes = []):
10661066
*
10671067
* @return HtmlString|string
10681068
*/
1069-
public function month(string $name, string|DateTimeInterface $value = null, array $options = []): HtmlString|string
1069+
public function month(string $name, string|DateTimeInterface|null $value = null, array $options = []): HtmlString|string
10701070
{
10711071
if ($value instanceof DateTimeInterface) {
10721072
$value = $value->format('Y-m');
@@ -1084,7 +1084,7 @@ public function month(string $name, string|DateTimeInterface $value = null, arra
10841084
*
10851085
* @return HtmlString|string
10861086
*/
1087-
public function color(string $name, string $value = null, array $options = []): HtmlString|string
1087+
public function color(string $name, string|null $value = null, array $options = []): HtmlString|string
10881088
{
10891089
return $this->input('color', $name, $value, $options);
10901090
}
@@ -1097,7 +1097,7 @@ public function color(string $name, string $value = null, array $options = []):
10971097
*
10981098
* @return HtmlString|string
10991099
*/
1100-
public function submit(string $value = null, array $options = []): HtmlString|string
1100+
public function submit(string|null $value = null, array $options = []): HtmlString|string
11011101
{
11021102
return $this->input('submit', null, $value, $options);
11031103
}
@@ -1110,7 +1110,7 @@ public function submit(string $value = null, array $options = []): HtmlString|st
11101110
*
11111111
* @return HtmlString|string
11121112
*/
1113-
public function button(string $value = null, array $options = []): HtmlString|string
1113+
public function button(string|null $value = null, array $options = []): HtmlString|string
11141114
{
11151115
if (! array_key_exists('type', $options)) {
11161116
$options['type'] = 'button';

src/HtmlBuilder.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function decode(string $value): string
7575
*
7676
* @return HtmlString|string
7777
*/
78-
public function script(string $url, array $attributes = [], bool $secure = null): HtmlString|string
78+
public function script(string $url, array $attributes = [], bool|null $secure = null): HtmlString|string
7979
{
8080
$attributes['src'] = $this->url->asset($url, $secure);
8181

@@ -91,7 +91,7 @@ public function script(string $url, array $attributes = [], bool $secure = null)
9191
*
9292
* @return HtmlString|string
9393
*/
94-
public function style(string $url, array $attributes = [], bool $secure = null): HtmlString|string
94+
public function style(string $url, array $attributes = [], bool|null $secure = null): HtmlString|string
9595
{
9696
$defaults = ['media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet'];
9797

@@ -112,7 +112,7 @@ public function style(string $url, array $attributes = [], bool $secure = null):
112112
*
113113
* @return HtmlString|string
114114
*/
115-
public function image(string $url, string $alt = null, array $attributes = [], bool $secure = null): HtmlString|string
115+
public function image(string $url, string|null $alt = null, array $attributes = [], bool|null $secure = null): HtmlString|string
116116
{
117117
$attributes['alt'] = $alt;
118118

@@ -129,7 +129,7 @@ public function image(string $url, string $alt = null, array $attributes = [], b
129129
*
130130
* @return HtmlString|string
131131
*/
132-
public function favicon(string $url, array $attributes = [], bool $secure = null): HtmlString|string
132+
public function favicon(string $url, array $attributes = [], bool|null $secure = null): HtmlString|string
133133
{
134134
$defaults = ['rel' => 'shortcut icon', 'type' => 'image/x-icon'];
135135

@@ -151,7 +151,7 @@ public function favicon(string $url, array $attributes = [], bool $secure = null
151151
*
152152
* @return HtmlString|string
153153
*/
154-
public function link(string $url, string $title = null, array $attributes = [], bool $secure = null, bool $escape = true): HtmlString|string
154+
public function link(string $url, string|null $title = null, array $attributes = [], bool|null $secure = null, bool $escape = true): HtmlString|string
155155
{
156156
$url = $this->url->to($url, [], $secure);
157157

@@ -176,7 +176,7 @@ public function link(string $url, string $title = null, array $attributes = [],
176176
*
177177
* @return HtmlString|string
178178
*/
179-
public function secureLink(string $url, string $title = null, array $attributes = [], bool $escape = true): HtmlString|string
179+
public function secureLink(string $url, string|null $title = null, array $attributes = [], bool $escape = true): HtmlString|string
180180
{
181181
return $this->link($url, $title, $attributes, true, $escape);
182182
}
@@ -192,7 +192,7 @@ public function secureLink(string $url, string $title = null, array $attributes
192192
*
193193
* @return HtmlString|string
194194
*/
195-
public function linkAsset(string $url, string $title = null, array $attributes = [], bool $secure = null, bool $escape = true): HtmlString|string
195+
public function linkAsset(string $url, string|null $title = null, array $attributes = [], bool|null $secure = null, bool $escape = true): HtmlString|string
196196
{
197197
$url = $this->url->asset($url, $secure);
198198

@@ -209,7 +209,7 @@ public function linkAsset(string $url, string $title = null, array $attributes =
209209
*
210210
* @return HtmlString|string
211211
*/
212-
public function linkSecureAsset(string $url, string $title = null, array $attributes = [], bool $escape = true): HtmlString|string
212+
public function linkSecureAsset(string $url, string|null $title = null, array $attributes = [], bool $escape = true): HtmlString|string
213213
{
214214
return $this->linkAsset($url, $title, $attributes, true, $escape);
215215
}
@@ -226,7 +226,7 @@ public function linkSecureAsset(string $url, string $title = null, array $attrib
226226
*
227227
* @return HtmlString|string
228228
*/
229-
public function linkRoute(string $name, string $title = null, mixed $parameters = [], array $attributes = [], bool $secure = null, bool $escape = true): HtmlString|string
229+
public function linkRoute(string $name, string|null $title = null, mixed $parameters = [], array $attributes = [], bool|null $secure = null, bool $escape = true): HtmlString|string
230230
{
231231
return $this->link($this->url->route($name, $parameters), $title, $attributes, $secure, $escape);
232232
}
@@ -243,7 +243,7 @@ public function linkRoute(string $name, string $title = null, mixed $parameters
243243
*
244244
* @return HtmlString|string
245245
*/
246-
public function linkAction(string $action, string $title = null, array $parameters = [], array $attributes = [], bool $secure = null, bool $escape = true): HtmlString|string
246+
public function linkAction(string $action, string|null $title = null, array $parameters = [], array $attributes = [], bool|null $secure = null, bool $escape = true): HtmlString|string
247247
{
248248
return $this->link($this->url->action($action, $parameters), $title, $attributes, $secure, $escape);
249249
}
@@ -258,7 +258,7 @@ public function linkAction(string $action, string $title = null, array $paramete
258258
*
259259
* @return HtmlString|string
260260
*/
261-
public function mailto(string $email, string $title = null, array $attributes = [], bool $escape = true): HtmlString|string
261+
public function mailto(string $email, string|null $title = null, array $attributes = [], bool $escape = true): HtmlString|string
262262
{
263263
$email = $this->email($email);
264264

@@ -424,7 +424,7 @@ protected function nestedListing(mixed $key, string $type, mixed $value): string
424424
* @param string|null $input_type
425425
* @return string
426426
*/
427-
public function attributes(array|null $attributes, string $input_type = null): string
427+
public function attributes(array|null $attributes, string|null $input_type = null): string
428428
{
429429
$defaultAttributes = config('html-forms.default_attributes', []);
430430
$all_default_attributes = $defaultAttributes['all'] ?? [];

src/helpers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function link_to(string $url, string|null $title = null, array $attributes = [],
3131
*
3232
* @return string
3333
*/
34-
function link_to_asset(string $url, string $title = null, array $attributes = [], bool $secure = null): string
34+
function link_to_asset(string $url, string|null $title = null, array $attributes = [], bool|null $secure = null): string
3535
{
3636
return app('html')->linkAsset($url, $title, $attributes, $secure);
3737
}
@@ -48,7 +48,7 @@ function link_to_asset(string $url, string $title = null, array $attributes = []
4848
*
4949
* @return string
5050
*/
51-
function link_to_route(string $name, string $title = null, mixed $parameters = [], array $attributes = []): HtmlString|string
51+
function link_to_route(string $name, string|null $title = null, mixed $parameters = [], array $attributes = []): HtmlString|string
5252
{
5353
return app('html')->linkRoute($name, $title, $parameters, $attributes);
5454
}
@@ -65,7 +65,7 @@ function link_to_route(string $name, string $title = null, mixed $parameters = [
6565
*
6666
* @return string
6767
*/
68-
function link_to_action(string $action, string $title = null, array $parameters = [], array $attributes = []): HtmlString|string
68+
function link_to_action(string $action, string|null $title = null, array $parameters = [], array $attributes = []): HtmlString|string
6969
{
7070
return app('html')->linkAction($action, $title, $parameters, $attributes);
7171
}

0 commit comments

Comments
 (0)