Skip to content

Commit d2587b7

Browse files
committed
Add more specific types
1 parent 3694f16 commit d2587b7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/wp-includes/interactivity-api/class-wp-interactivity-api.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ final class WP_Interactivity_API {
8989
* Set of script modules that can be loaded after client-side navigation.
9090
*
9191
* @since 6.9.0
92-
* @var array<string, bool>
92+
* @var array<non-empty-string, true>
9393
*/
9494
private $script_modules_that_can_load_on_client_navigation = array();
9595

@@ -397,11 +397,12 @@ public function add_hooks() {
397397
*
398398
* @since 6.9.0
399399
*
400-
* @param array $attributes The script tag attributes.
400+
* @param array<string, string|true>|mixed $attributes The script tag attributes.
401401
* @return array The modified script tag attributes.
402402
*/
403403
public function add_load_on_client_navigation_attribute_to_script_modules( $attributes ) {
404404
if (
405+
is_array( $attributes ) &&
405406
isset( $attributes['type'], $attributes['id'] ) &&
406407
'module' === $attributes['type'] &&
407408
array_key_exists(
@@ -423,9 +424,10 @@ public function add_load_on_client_navigation_attribute_to_script_modules( $attr
423424
* `data-wp-router-options` directive.
424425
*
425426
* @since 6.9.0
426-
* @param string $script_module_id The script module identifier.
427+
*
428+
* @param non-empty-string $script_module_id The script module identifier.
427429
*/
428-
public function add_client_navigation_support_to_script_module( $script_module_id ) {
430+
public function add_client_navigation_support_to_script_module( string $script_module_id ) {
429431
$this->script_modules_that_can_load_on_client_navigation[ $script_module_id ] = true;
430432
}
431433

0 commit comments

Comments
 (0)