Skip to content

Commit d94c996

Browse files
committed
Fix psalm issues.
1 parent 7ccbed2 commit d94c996

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

plugins/hwp-previews/src/Admin/Settings/Fields/Field/Abstract_Settings_Field.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public function get_description(): string {
9999
* @param string $section The settings section.
100100
* @param string $page The settings page.
101101
* @param array<string, mixed> $args The arguments for the settings field.
102+
*
103+
* @psalm-suppress ArgumentTypeCoercion
102104
*/
103105
public function add_settings_field( string $section, string $page, array $args ): void {
104106
add_settings_field(

plugins/hwp-previews/src/Admin/Settings_Page.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static function init(): Settings_Page {
5959
/**
6060
* Fire off init action.
6161
*
62-
* @param self $instance the instance of the plugin class.
62+
* @param Settings_Page $instance the instance of the plugin class.
6363
*/
6464
do_action( 'hwp_previews_init', self::$instance );
6565

@@ -118,12 +118,13 @@ public function get_current_tab( array $post_types, string $tab = 'tab' ): strin
118118
return '';
119119
}
120120
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification not required for tab selection.
121-
if ( ! array_key_exists( $tab, $_GET ) ) {
121+
$value = $_GET[ $tab ] ?? '';
122+
if ( ! is_string( $value ) || '' === $value ) {
122123
return (string) key( $post_types );
123124
}
124125

125126
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification not required for tab selection.
126-
return sanitize_key( $_GET[ $tab ] );
127+
return sanitize_key( $value );
127128
}
128129

129130
/**

0 commit comments

Comments
 (0)