From c0842768ea4c4bce24367fa8ed42ee46a59ad3ae Mon Sep 17 00:00:00 2001 From: Luis Herranz Date: Wed, 31 Jan 2024 17:30:26 +0100 Subject: [PATCH] Improve state/config return msg and fix arg name --- .../interactivity-api/class-wp-interactivity-api.php | 6 ++++-- .../interactivity-api/interactivity-api.php | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/interactivity-api/class-wp-interactivity-api.php b/src/wp-includes/interactivity-api/class-wp-interactivity-api.php index 7ccc59ca01813..c2a0a286d42a0 100644 --- a/src/wp-includes/interactivity-api/class-wp-interactivity-api.php +++ b/src/wp-includes/interactivity-api/class-wp-interactivity-api.php @@ -60,7 +60,8 @@ class WP_Interactivity_API { * @param string $store_namespace The unique store namespace identifier. * @param array $state Optional. The array that will be merged with the existing state for the specified * store namespace. - * @return array The current state for the specified store namespace. + * @return array The current state for the specified store namespace. This will be the updated state if a $state + * argument was provided. */ public function state( string $store_namespace, array $state = null ): array { if ( ! isset( $this->state_data[ $store_namespace ] ) ) { @@ -87,7 +88,8 @@ public function state( string $store_namespace, array $state = null ): array { * @param string $store_namespace The unique store namespace identifier. * @param array $config Optional. The array that will be merged with the existing configuration for the * specified store namespace. - * @return array The current configuration for the specified store namespace. + * @return array The configuration for the specified store namespace. This will be the updated configuration if a + * $config argument was provided. */ public function config( string $store_namespace, array $config = null ): array { if ( ! isset( $this->config_data[ $store_namespace ] ) ) { diff --git a/src/wp-includes/interactivity-api/interactivity-api.php b/src/wp-includes/interactivity-api/interactivity-api.php index 8a5f96a2a9b17..1859ea081ddb8 100644 --- a/src/wp-includes/interactivity-api/interactivity-api.php +++ b/src/wp-includes/interactivity-api/interactivity-api.php @@ -109,7 +109,8 @@ function wp_interactivity_process_directives( $html ) { * @param string $store_namespace The unique store namespace identifier. * @param array $state Optional. The array that will be merged with the existing state for the specified * store namespace. - * @return array The current state for the specified store namespace. + * @return array The state for the specified store namespace. This will be the updated state if a $state argument was + * provided. */ function wp_interactivity_state( $store_namespace, $state = null ) { return wp_interactivity()->state( $store_namespace, $state ); @@ -127,8 +128,9 @@ function wp_interactivity_state( $store_namespace, $state = null ) { * @param string $store_namespace The unique store namespace identifier. * @param array $config Optional. The array that will be merged with the existing configuration for the * specified store namespace. - * @return array The current configuration for the specified store namespace. + * @return array The configuration for the specified store namespace. This will be the updated configuration if a + * $config argument was provided. */ -function wp_interactivity_config( $store_namespace, $initial_state = null ) { - return wp_interactivity()->config( $store_namespace, $initial_state ); +function wp_interactivity_config( $store_namespace, $config = null ) { + return wp_interactivity()->config( $store_namespace, $config ); }