From c146958bab067d39021be197ae44cf6a0479f175 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Mon, 29 Sep 2025 14:35:27 +0200 Subject: [PATCH 1/3] Fix issues reported by PHPCS in WP core --- tests/unit/abilities-api/wpAbility.php | 25 +++++++++++-------- .../wpRestAbilitiesListController.php | 6 ++--- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/tests/unit/abilities-api/wpAbility.php b/tests/unit/abilities-api/wpAbility.php index d6bfe445..961a40f8 100644 --- a/tests/unit/abilities-api/wpAbility.php +++ b/tests/unit/abilities-api/wpAbility.php @@ -40,7 +40,7 @@ public function set_up(): void { */ public function data_execute_input() { return array( - 'null input' => array( + 'null input' => array( array( 'type' => array( 'null', 'integer' ), 'description' => 'The null or integer to convert to integer.', @@ -52,7 +52,7 @@ static function ( $input ): int { null, 0, ), - 'boolean input' => array( + 'boolean input' => array( array( 'type' => 'boolean', 'description' => 'The boolean to convert to integer.', @@ -64,7 +64,7 @@ static function ( bool $input ): int { true, 1, ), - 'integer input' => array( + 'integer input' => array( array( 'type' => 'integer', 'description' => 'The integer to add 5 to.', @@ -76,7 +76,7 @@ static function ( int $input ): int { 2, 7, ), - 'number input' => array( + 'number input' => array( array( 'type' => 'number', 'description' => 'The floating number to round.', @@ -88,7 +88,7 @@ static function ( float $input ): int { 2.7, 3, ), - 'string input' => array( + 'string input' => array( array( 'type' => 'string', 'description' => 'The string to measure the length of.', @@ -100,7 +100,7 @@ static function ( string $input ): int { 'Hello world!', 12, ), - 'object input' => array( + 'object input' => array( array( 'type' => 'object', 'description' => 'An object containing two numbers to add.', @@ -117,24 +117,27 @@ static function ( string $input ): int { ), ), 'additionalProperties' => false, - ), + ), static function ( array $input ): int { return $input['a'] + $input['b']; }, - array( 'a' => 2, 'b' => 3 ), + array( + 'a' => 2, + 'b' => 3, + ), 5, ), - 'array input' => array( + 'array input' => array( array( 'type' => 'array', 'description' => 'An array containing two numbers to add.', 'required' => true, 'minItems' => 2, - 'maxItems' => 2, + 'maxItems' => 2, 'items' => array( 'type' => 'integer', ), - ), + ), static function ( array $input ): int { return $input[0] + $input[1]; }, diff --git a/tests/unit/rest-api/wpRestAbilitiesListController.php b/tests/unit/rest-api/wpRestAbilitiesListController.php index b7d84d9d..319e26e0 100644 --- a/tests/unit/rest-api/wpRestAbilitiesListController.php +++ b/tests/unit/rest-api/wpRestAbilitiesListController.php @@ -300,7 +300,7 @@ public function test_pagination_links(): void { $request->set_param( 'page', 1 ); $response = $this->server->dispatch( $request ); - $headers = $response->get_headers(); + $headers = $response->get_headers(); $link_header = $headers['Link'] ?? ''; // Parse Link header for rel="next" and rel="prev" @@ -311,7 +311,7 @@ public function test_pagination_links(): void { $request->set_param( 'page', 3 ); $response = $this->server->dispatch( $request ); - $headers = $response->get_headers(); + $headers = $response->get_headers(); $link_header = $headers['Link'] ?? ''; $this->assertStringContainsString( 'rel="next"', $link_header ); @@ -323,7 +323,7 @@ public function test_pagination_links(): void { $request->set_param( 'page', $last_page ); $response = $this->server->dispatch( $request ); - $headers = $response->get_headers(); + $headers = $response->get_headers(); $link_header = $headers['Link'] ?? ''; $this->assertStringNotContainsString( 'rel="next"', $link_header ); From f83cfbf1a1d09946121a40e8e0e5d112a5bc6e9f Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Mon, 29 Sep 2025 14:39:35 +0200 Subject: [PATCH 2/3] Set the next release version in PHPDoc --- includes/abilities-api/class-wp-abilities-registry.php | 2 +- includes/abilities-api/class-wp-ability.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/abilities-api/class-wp-abilities-registry.php b/includes/abilities-api/class-wp-abilities-registry.php index b42eed83..3acf8a14 100644 --- a/includes/abilities-api/class-wp-abilities-registry.php +++ b/includes/abilities-api/class-wp-abilities-registry.php @@ -87,7 +87,7 @@ public function register( string $name, array $args ): ?WP_Ability { /** * Filters the ability arguments before they are validated and used to instantiate the ability. * - * @since n.e.x.t + * @since 0.2.0 * * @param array $args The arguments used to instantiate the ability. * @param string $name The name of the ability, with its namespace. diff --git a/includes/abilities-api/class-wp-ability.php b/includes/abilities-api/class-wp-ability.php index b40bf37e..cff7e1db 100644 --- a/includes/abilities-api/class-wp-ability.php +++ b/includes/abilities-api/class-wp-ability.php @@ -436,7 +436,7 @@ public function execute( $input = null ) { /** * Fires before an ability gets executed. * - * @since n.e.x.t + * @since 0.2.0 * * @param string $ability_name The name of the ability. * @param mixed $input The input data for the ability. @@ -456,7 +456,7 @@ public function execute( $input = null ) { /** * Fires immediately after an ability finished executing. * - * @since n.e.x.t + * @since 0.2.0 * * @param string $ability_name The name of the ability. * @param mixed $input The input data for the ability. From 7653cf69865713bea2ae428fd0dfa3f5a0b8aa8d Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Wed, 1 Oct 2025 08:53:50 +0200 Subject: [PATCH 3/3] Set the proper next version --- includes/abilities-api/class-wp-ability.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/abilities-api/class-wp-ability.php b/includes/abilities-api/class-wp-ability.php index cff7e1db..78ac5c3e 100644 --- a/includes/abilities-api/class-wp-ability.php +++ b/includes/abilities-api/class-wp-ability.php @@ -312,7 +312,7 @@ protected function validate_input( $input = null ) { * * The input is validated against the input schema before it is passed to to permission callback. * - * @since N.E.X.T + * @since 0.2.0 * * @param mixed $input Optional. The input data for permission checking. Default `null`. * @return bool|\WP_Error Whether the ability has the necessary permission. @@ -335,7 +335,7 @@ public function check_permissions( $input = null ) { * * The input is validated against the input schema before it is passed to to permission callback. * - * @deprecated N.E.X.T Use check_permissions() instead. + * @deprecated 0.2.0 Use check_permissions() instead. * @see WP_Ability::check_permissions() * * @since 0.1.0 @@ -344,7 +344,7 @@ public function check_permissions( $input = null ) { * @return bool|\WP_Error Whether the ability has the necessary permission. */ public function has_permission( $input = null ) { - _deprecated_function( __METHOD__, 'N.E.X.T', 'WP_Ability::check_permissions()' ); + _deprecated_function( __METHOD__, '0.2.0', 'WP_Ability::check_permissions()' ); return $this->check_permissions( $input ); }