Skip to content

Commit d96e3ef

Browse files
committed
Fix PHPDoc for arrays
1 parent 03d285a commit d96e3ef

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed

src/wp-includes/abilities-api/class-wp-abilities-registry.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public function register( string $name, array $args ): ?WP_Ability {
130130
* @type array<string, bool|string> $annotations Optional. Annotation metadata for the ability.
131131
* @type bool $show_in_rest Optional. Whether to expose this ability in the REST API. Default false.
132132
* }
133+
* @type string $ability_class Optional. Custom class to instantiate instead of WP_Ability.
133134
* }
134135
* @param string $name The name of the ability, with its namespace.
135136
*/

src/wp-includes/abilities-api/class-wp-ability-category.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,20 @@ public function __construct( string $slug, array $args ) {
108108
*
109109
* @since 6.9.0
110110
*
111-
* @param array<string, mixed> $args An associative array of arguments used to instantiate the class.
112-
* @return array<string, mixed> The validated and prepared properties.
111+
* @param array<string, mixed> $args $args {
112+
* An associative array of arguments used to instantiate the ability category class.
113+
*
114+
* @type string $label The human-readable label for the category.
115+
* @type string $description A description of the category.
116+
* @type array<string, mixed> $meta Optional. Additional metadata for the category.
117+
* }
118+
* @return array<string, mixed> $args {
119+
* An associative array with validated and prepared ability category properties.
120+
*
121+
* @type string $label The human-readable label for the category.
122+
* @type string $description A description of the category.
123+
* @type array<string, mixed> $meta Optional. Additional metadata for the category.
124+
* }
113125
* @throws InvalidArgumentException if an argument is invalid.
114126
*
115127
* @phpstan-return array{

src/wp-includes/abilities-api/class-wp-ability.php

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,44 @@ public function __construct( string $name, array $args ) {
192192
*
193193
* @see WP_Abilities_Registry::register()
194194
*
195-
* @param array<string, mixed> $args An associative array of arguments used to instantiate the class.
196-
* @return array<string, mixed> The validated and prepared properties.
195+
* @param array<string, mixed> $args {
196+
* An associative array of arguments used to instantiate the ability class.
197+
*
198+
* @type string $label The human-readable label for the ability.
199+
* @type string $description A detailed description of what the ability does.
200+
* @type string $category The category slug this ability belongs to.
201+
* @type callable $execute_callback A callback function to execute when the ability is invoked.
202+
* Receives optional mixed input and returns mixed result or WP_Error.
203+
* @type callable $permission_callback A callback function to check permissions before execution.
204+
* Receives optional mixed input and returns bool or WP_Error.
205+
* @type array<string, mixed> $input_schema Optional. JSON Schema definition for the ability's input.
206+
* @type array<string, mixed> $output_schema Optional. JSON Schema definition for the ability's output.
207+
* @type array<string, mixed> $meta {
208+
* Optional. Additional metadata for the ability.
209+
*
210+
* @type array<string, bool|string> $annotations Optional. Annotation metadata for the ability.
211+
* @type bool $show_in_rest Optional. Whether to expose this ability in the REST API. Default false.
212+
* }
213+
* }
214+
* @return array<string, mixed> {
215+
* An associative array of arguments with validated and prepared properties for the ability class.
216+
*
217+
* @type string $label The human-readable label for the ability.
218+
* @type string $description A detailed description of what the ability does.
219+
* @type string $category The category slug this ability belongs to.
220+
* @type callable $execute_callback A callback function to execute when the ability is invoked.
221+
* Receives optional mixed input and returns mixed result or WP_Error.
222+
* @type callable $permission_callback A callback function to check permissions before execution.
223+
* Receives optional mixed input and returns bool or WP_Error.
224+
* @type array<string, mixed> $input_schema Optional. JSON Schema definition for the ability's input.
225+
* @type array<string, mixed> $output_schema Optional. JSON Schema definition for the ability's output.
226+
* @type array<string, mixed> $meta {
227+
* Additional metadata for the ability.
228+
*
229+
* @type array<string, bool|string> $annotations Optional. Annotation metadata for the ability.
230+
* @type bool $show_in_rest Whether to expose this ability in the REST API. Default false.
231+
* }
232+
* }
197233
* @throws InvalidArgumentException if an argument is invalid.
198234
*
199235
* @phpstan-return array{

0 commit comments

Comments
 (0)