Skip to content

Commit e250141

Browse files
committed
chore: add traversable types
1 parent 7223268 commit e250141

39 files changed

+353
-374
lines changed

access-functions.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -819,10 +819,10 @@ function get_graphql_setting( string $option_name, $default_value = '', $section
819819

820820
/**
821821
* Filter the section fields
822-
*
823-
* @param array $section_fields The values of the fields stored for the section
824-
* @param string $section_name The name of the section
825-
* @param mixed $default_value The default value for the option being retrieved
822+
823+
* @param array<string,mixed> $section_fields The values of the fields stored for the section
824+
* @param string $section_name The name of the section
825+
* @param mixed $default_value The default value for the option being retrieved
826826
*/
827827
$section_fields = apply_filters( 'graphql_get_setting_section_fields', $section_fields, $section_name, $default_value );
828828

@@ -834,11 +834,11 @@ function get_graphql_setting( string $option_name, $default_value = '', $section
834834
/**
835835
* Filter the value before returning it
836836
*
837-
* @param mixed $value The value of the field
838-
* @param mixed $default_value The default value if there is no value set
839-
* @param string $option_name The name of the option
840-
* @param array $section_fields The setting values within the section
841-
* @param string $section_name The name of the section the setting belongs to
837+
* @param mixed $value The value of the field
838+
* @param mixed $default_value The default value if there is no value set
839+
* @param string $option_name The name of the option
840+
* @param array<string,mixed> $section_fields The setting values within the section
841+
* @param string $section_name The name of the section the setting belongs to
842842
*/
843843
return apply_filters( 'graphql_get_setting_section_field_value', $value, $default_value, $option_name, $section_fields, $section_name );
844844
}

src/Admin/Settings/SettingsRegistry.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ public function register_field( string $section, array $field ) {
128128
/**
129129
* Filter the setting field config
130130
*
131-
* @param array $field_config The field config for the setting
132-
* @param string $field_name The name of the field (unfilterable in the config)
133-
* @param string $section The slug of the section the field is registered to
131+
* @param array<string,mixed> $field_config The field config for the setting
132+
* @param string $field_name The name of the field (unfilterable in the config)
133+
* @param string $section The slug of the section the field is registered to
134134
*/
135135
$field = apply_filters( 'graphql_setting_field_config', $field_config, $field_name, $section );
136136

@@ -160,7 +160,7 @@ public function admin_init() {
160160
/**
161161
* Filter the settings sections
162162
*
163-
* @param array $setting_sections The registered settings sections
163+
* @param array<string,array<string,mixed>> $setting_sections The registered settings sections
164164
*/
165165
$setting_sections = apply_filters( 'graphql_settings_sections', $this->settings_sections );
166166

src/Data/CommentMutation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ public static function prepare_comment_object( array $input, array &$output_args
103103
/**
104104
* Filter the $insert_post_args
105105
*
106-
* @param array $output_args The array of $input_post_args that will be passed to wp_new_comment
107-
* @param array $input The data that was entered as input for the mutation
108-
* @param string $mutation_type The type of mutation being performed ( create, edit, etc )
106+
* @param array<string,mixed> $output_args The array of $input_post_args that will be passed to wp_new_comment
107+
* @param array<string,mixed> $input The data that was entered as input for the mutation
108+
* @param string $mutation_type The type of mutation being performed ( create, edit, etc )
109109
*/
110110
$output_args = apply_filters( 'graphql_comment_insert_post_args', $output_args, $input, $mutation_name );
111111

src/Data/Config.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,10 @@ public function graphql_wp_term_query_cursor_pagination_support( array $pieces,
382382
/**
383383
* If pre-filter hooked, return $pre_pieces.
384384
*
385-
* @param array<string,mixed>|null $pre_pieces The pre-filtered term query SQL clauses.
386-
* @param array<string,mixed> $pieces Terms query SQL clauses.
387-
* @param string[] $taxonomies An array of taxonomies.
388-
* @param array<string,mixed> $args An array of terms query arguments.
389-
*
390-
* @return array|null
385+
* @param ?array<string,mixed> $pre_pieces The pre-filtered term query SQL clauses.
386+
* @param array<string,mixed> $pieces Terms query SQL clauses.
387+
* @param string[] $taxonomies An array of taxonomies.
388+
* @param array<string,mixed> $args An array of terms query arguments.
391389
*/
392390
$pre_pieces = apply_filters( 'graphql_pre_wp_term_query_cursor_pagination_support', null, $pieces, $taxonomies, $args );
393391
if ( null !== $pre_pieces ) {
@@ -455,11 +453,9 @@ public function graphql_wp_comments_query_cursor_pagination_support( array $piec
455453
/**
456454
* If pre-filter hooked, return $pre_pieces.
457455
*
458-
* @param array|null $pre_pieces The pre-filtered comment query clauses.
459-
* @param array $pieces A compacted array of comment query clauses.
460-
* @param \WP_Comment_Query $query Current instance of WP_Comment_Query, passed by reference.
461-
*
462-
* @return array|null
456+
* @param ?array<string,mixed> $pre_pieces The pre-filtered comment query clauses.
457+
* @param array<string,mixed> $pieces A compacted array of comment query clauses.
458+
* @param \WP_Comment_Query $query Current instance of WP_Comment_Query, passed by reference.
463459
*/
464460
$pre_pieces = apply_filters( 'graphql_pre_wp_comments_query_cursor_pagination_support', null, $pieces, $query );
465461
if ( null !== $pre_pieces ) {

src/Data/Connection/AbstractConnectionResolver.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ abstract class AbstractConnectionResolver {
102102
protected $ids;
103103

104104
/**
105-
* @var array<string,mixed>
105+
* @var mixed[]
106106
*/
107107
protected $nodes;
108108

@@ -162,9 +162,9 @@ public function __construct( $source, array $args, AppContext $context, ResolveI
162162
*
163163
* Filters the GraphQL args before they are used in get_query_args().
164164
*
165-
* @param array $args The GraphQL args passed to the resolver.
165+
* @param array<string,mixed> $args The GraphQL args passed to the resolver.
166166
* @param \WPGraphQL\Data\Connection\AbstractConnectionResolver $connection_resolver Instance of the ConnectionResolver.
167-
* @param array $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
167+
* @param array<string,mixed> $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
168168
*
169169
* @since 1.11.0
170170
*/
@@ -188,10 +188,9 @@ public function __construct( $source, array $args, AppContext $context, ResolveI
188188
*
189189
* Filters the args
190190
*
191-
* @param array $query_args The query args to be used with the executable query to get data.
192-
* This should take in the GraphQL args and return args for use in fetching the data.
191+
* @param array<string,mixed> $query_args The query args to be used with the executable query to get data.
193192
* @param \WPGraphQL\Data\Connection\AbstractConnectionResolver $connection_resolver Instance of the ConnectionResolver
194-
* @param array $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
193+
* @param array<string,mixed> $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
195194
*/
196195
$this->query_args = apply_filters( 'graphql_connection_query_args', $this->get_query_args(), $this, $args );
197196
}
@@ -429,11 +428,11 @@ public function get_query_amount() {
429428
*
430429
* This filter is intentionally applied AFTER the query_args filter, as
431430
*
432-
* @param int $max_posts the maximum number of posts per page.
433-
* @param mixed $source source passed down from the resolve tree
434-
* @param array $args array of arguments input in the field as part of the GraphQL query
435-
* @param \WPGraphQL\AppContext $context Object containing app context that gets passed down the resolve tree
436-
* @param \GraphQL\Type\Definition\ResolveInfo $info Info about fields passed down the resolve tree
431+
* @param int $max_posts the maximum number of posts per page.
432+
* @param mixed $source source passed down from the resolve tree
433+
* @param array<string,mixed> $args array of arguments input in the field as part of the GraphQL query
434+
* @param \WPGraphQL\AppContext $context Object containing app context that gets passed down the resolve tree
435+
* @param \GraphQL\Type\Definition\ResolveInfo $info Info about fields passed down the resolve tree
437436
*
438437
* @since 0.0.6
439438
*/
@@ -820,7 +819,7 @@ public function get_edges() {
820819
/**
821820
* Create the edge, pass it through a filter.
822821
*
823-
* @param array $edge The edge within the connection
822+
* @param array<string,mixed> $edge The edge within the connection
824823
* @param \WPGraphQL\Data\Connection\AbstractConnectionResolver $connection_resolver Instance of the connection resolver class
825824
*/
826825
$edge = apply_filters(
@@ -940,7 +939,7 @@ public function execute_and_get_ids() {
940939
/**
941940
* Filter the connection IDs
942941
*
943-
* @param array $ids Array of IDs this connection will be resolving
942+
* @param int[]|string[] $ids Array of IDs this connection will be resolving
944943
* @param \WPGraphQL\Data\Connection\AbstractConnectionResolver $connection_resolver Instance of the Connection Resolver
945944
*/
946945
$this->ids = apply_filters( 'graphql_connection_ids', $this->get_ids(), $this );
@@ -984,15 +983,15 @@ function () {
984983
*
985984
* Filters the nodes in the connection
986985
*
987-
* @param array $nodes The nodes in the connection
986+
* @param array<int|string,mixed|\WPGraphQL\Model\Model|null> $nodes The nodes in the connection
988987
* @param \WPGraphQL\Data\Connection\AbstractConnectionResolver $connection_resolver Instance of the Connection Resolver
989988
*/
990989
$this->nodes = apply_filters( 'graphql_connection_nodes', $this->get_nodes(), $this );
991990

992991
/**
993992
* Filters the edges in the connection
994993
*
995-
* @param array $nodes The nodes in the connection
994+
* @param array<int|string,mixed|\WPGraphQL\Model\Model|null> $nodes The nodes in the connection
996995
* @param \WPGraphQL\Data\Connection\AbstractConnectionResolver $connection_resolver Instance of the Connection Resolver
997996
*/
998997
$this->edges = apply_filters( 'graphql_connection_edges', $this->get_edges(), $this );
@@ -1015,7 +1014,7 @@ function () {
10151014
*
10161015
* This filter allows additional fields to be returned to the connection resolver
10171016
*
1018-
* @param array $connection The connection data being returned
1017+
* @param array<string,mixed> $connection The connection data being returned
10191018
* @param \WPGraphQL\Data\Connection\AbstractConnectionResolver $connection_resolver The instance of the connection resolver
10201019
*/
10211020
return apply_filters( 'graphql_connection', $connection, $this );

src/Data/Connection/CommentConnectionResolver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ public function get_query_args() {
135135
* Filter the query_args that should be applied to the query. This filter is applied AFTER the input args from
136136
* the GraphQL Query have been applied and has the potential to override the GraphQL Query Input Args.
137137
*
138-
* @param array $query_args array of query_args being passed to the
139-
* @param mixed $source source passed down from the resolve tree
140-
* @param array $args array of arguments input in the field as part of the GraphQL query
141-
* @param \WPGraphQL\AppContext $context object passed down the resolve tree
138+
* @param array<string,mixed> $query_args array of query_args being passed to the
139+
* @param mixed $source source passed down from the resolve tree
140+
* @param array<string,mixed> $args array of arguments input in the field as part of the GraphQL query
141+
* @param \WPGraphQL\AppContext $context object passed down the resolve tree
142142
* @param \GraphQL\Type\Definition\ResolveInfo $info info about fields passed down the resolve tree
143143
*
144144
* @since 0.0.6
@@ -256,7 +256,7 @@ static function ( $id ) {
256256
*
257257
* Filters the GraphQL args before they are used in get_query_args().
258258
*
259-
* @param array $args The GraphQL args passed to the resolver.
259+
* @param array<string,mixed> $args The GraphQL args passed to the resolver.
260260
* @param \WPGraphQL\Data\Connection\CommentConnectionResolver $connection_resolver Instance of the ConnectionResolver
261261
*
262262
* @since 1.11.0

src/Data/Connection/MenuItemConnectionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public function get_args(): array {
104104
*
105105
* Filters the GraphQL args before they are used in get_query_args().
106106
*
107-
* @param array $args The GraphQL args passed to the resolver.
108-
* @param array $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
107+
* @param array<string,mixed> $args The GraphQL args passed to the resolver.
108+
* @param array<string,mixed> $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
109109
*
110110
* @since 1.11.0
111111
*/

src/Data/Connection/PostObjectConnectionResolver.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class PostObjectConnectionResolver extends AbstractConnectionResolver {
1818
/**
1919
* The name of the post type, or array of post types the connection resolver is resolving for
2020
*
21-
* @var mixed string|array
21+
* @var mixed|string|string[]
2222
*/
2323
protected $post_type;
2424

@@ -352,11 +352,11 @@ static function ( $id ) {
352352
/**
353353
* Filter the $query args to allow folks to customize queries programmatically
354354
*
355-
* @param array $query_args The args that will be passed to the WP_Query
356-
* @param mixed $source The source that's passed down the GraphQL queries
357-
* @param array $args The inputArgs on the field
358-
* @param \WPGraphQL\AppContext $context The AppContext passed down the GraphQL tree
359-
* @param \GraphQL\Type\Definition\ResolveInfo $info The ResolveInfo passed down the GraphQL tree
355+
* @param array<string,mixed> $query_args The args that will be passed to the WP_Query
356+
* @param mixed $source The source that's passed down the GraphQL queries
357+
* @param array<string,mixed> $args The inputArgs on the field
358+
* @param \WPGraphQL\AppContext $context The AppContext passed down the GraphQL tree
359+
* @param \GraphQL\Type\Definition\ResolveInfo $info The ResolveInfo passed down the GraphQL tree
360360
*/
361361
return apply_filters( 'graphql_post_object_connection_query_args', $query_args, $this->source, $this->args, $this->context, $this->info );
362362
}
@@ -419,15 +419,14 @@ public function sanitize_input_fields( array $where_args ) {
419419
* This allows plugins/themes to hook in and alter what $args should be allowed to be passed
420420
* from a GraphQL Query to the WP_Query
421421
*
422-
* @param array $query_args The mapped query arguments
423-
* @param array $args Query "where" args
424-
* @param mixed $source The query results for a query calling this
425-
* @param array $all_args All of the arguments for the query (not just the "where" args)
426-
* @param \WPGraphQL\AppContext $context The AppContext object
427-
* @param \GraphQL\Type\Definition\ResolveInfo $info The ResolveInfo object
428-
* @param mixed|string|array $post_type The post type for the query
422+
* @param array<string,mixed> $query_args The mapped query arguments
423+
* @param array<string,mixed> $args Query "where" args
424+
* @param mixed $source The query results for a query calling this
425+
* @param array<string,mixed> $all_args All of the arguments for the query (not just the "where" args)
426+
* @param \WPGraphQL\AppContext $context The AppContext object
427+
* @param \GraphQL\Type\Definition\ResolveInfo $info The ResolveInfo object
428+
* @param mixed|string|string[] $post_type The post type for the query
429429
*
430-
* @return array
431430
* @since 0.0.5
432431
*/
433432
$query_args = apply_filters( 'graphql_map_input_fields_to_wp_query', $query_args, $where_args, $this->source, $this->args, $this->context, $this->info, $this->post_type );
@@ -576,9 +575,9 @@ static function ( $id ) {
576575
*
577576
* Filters the GraphQL args before they are used in get_query_args().
578577
*
579-
* @param array $args The GraphQL args passed to the resolver.
578+
* @param array<string,mixed> $args The GraphQL args passed to the resolver.
580579
* @param \WPGraphQL\Data\Connection\PostObjectConnectionResolver $connection_resolver Instance of the ConnectionResolver.
581-
* @param array $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
580+
* @param array<string,mixed> $unfiltered_args Array of arguments input in the field as part of the GraphQL query.
582581
*
583582
* @since 1.11.0
584583
*/

0 commit comments

Comments
 (0)