Skip to content

Commit bf63c71

Browse files
committed
adjust typing for OptionRenderer
1 parent ccd2aa7 commit bf63c71

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/OptionRenderer.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ class OptionRenderer {
1717
* @return string
1818
*/
1919
public static function optionInput( array $option ) : string {
20-
return call_user_func(
21-
/* @phpstan-ignore-next-line */
20+
$option_input = call_user_func(
2221
[ 'WP2Static\OptionRenderer', self::INPUT_TYPE_FNS[ $option['type'] ] ],
2322
$option
2423
);
24+
25+
return strval( $option_input );
2526
}
2627

2728
/**
@@ -38,7 +39,11 @@ public static function optionInputArray( array $option ) : string {
3839
* @return string
3940
*/
4041
public static function optionInputBoolean( array $option ) : string {
41-
$checked = (int) $option['unfiltered_value'] === 1 ? ' checked' : '';
42+
/**
43+
* @var int $unfiltered_value
44+
*/
45+
$unfiltered_value = $option['unfiltered_value'];
46+
$checked = (int) $unfiltered_value === 1 ? ' checked' : '';
4247
return '<input id="' . $option['name'] . '" name="' . $option['name'] . '" value="1"' .
4348
' type="checkbox"' . $checked . '>';
4449
}
@@ -49,7 +54,7 @@ public static function optionInputBoolean( array $option ) : string {
4954
*/
5055
public static function optionInputInteger( array $option ) : string {
5156
return '<input class="widefat" id="' . $option['name'] . '" name="' . $option['name'] .
52-
'" type="number" value="' . esc_html( $option['value'] ) . '">';
57+
'" type="number" value="' . esc_html( strval( $option['value'] ) ) . '">';
5358
}
5459

5560
/**
@@ -58,7 +63,7 @@ public static function optionInputInteger( array $option ) : string {
5863
*/
5964
public static function optionInputPassword( array $option ) : string {
6065
return '<input class="widefat" id="' . $option['name'] . '" name="' . $option['name'] .
61-
'" type="password" value="' . esc_html( $option['value'] ) . '">';
66+
'" type="password" value="' . esc_html( strval( $option['value'] ) ) . '">';
6267
}
6368

6469
/**
@@ -67,7 +72,7 @@ public static function optionInputPassword( array $option ) : string {
6772
*/
6873
public static function optionInputString( array $option ) : string {
6974
return '<input class="widefat" id="' . $option['name'] . '" name="' . $option['name'] .
70-
'" type="text" value="' . esc_html( $option['value'] ) . '">';
75+
'" type="text" value="' . esc_html( strval( $option['value'] ) ) . '">';
7176
}
7277

7378
/**

0 commit comments

Comments
 (0)