Skip to content

Commit

Permalink
Improve state/config return msg and fix arg name
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Jan 31, 2024
1 parent c12b9ab commit 7aaf308
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] ) ) {
Expand All @@ -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 ] ) ) {
Expand Down
10 changes: 6 additions & 4 deletions src/wp-includes/interactivity-api/interactivity-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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 );
}

0 comments on commit 7aaf308

Please sign in to comment.