Skip to content

Commit

Permalink
Docs: Fix various incorrect WP-flavored array specifications.
Browse files Browse the repository at this point in the history
Tags like `@string` or `@array` do not exist and are not supported. The way these were used here, also meant duplicate information being documented.

Fixed now by using the `@type` tag as per the WP flavor of array documentation.

Includes some fixes to the documentation formatting.

Reference: [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#1-1-parameters-that-are-arrays PHP Documentation Standards: Parameters That Are Arrays].

Follow-up to [33322], [42880], [42971], [44786].

Props jrf.
See #59651.

git-svn-id: https://develop.svn.wordpress.org/trunk@57099 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Nov 9, 2023
1 parent 2bf4a27 commit 7287ff5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions tests/phpunit/tests/ajax/wpCustomizeNavMenus.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ public function test_ajax_load_available_items_cap_check( $role, $expected_resul
*
* @return array {
* @type array {
* @string string $role The role that will test caps for.
* @array array $expected_results The expected results from the Ajax call.
* @type string $role The role that will test caps for.
* @type array $expected_results The expected results from the Ajax call.
* }
* }
*/
Expand Down Expand Up @@ -191,8 +191,8 @@ public function test_ajax_load_available_items_error_messages( $post_args, $expe
*
* @return array {
* @type array {
* @array array $post_args The arguments that will merged with the $_POST array.
* @array array $expected_results The expected results from the Ajax call.
* @type array $post_args The arguments that will merged with the $_POST array.
* @type array $expected_results The expected results from the Ajax call.
* }
* }
*/
Expand Down Expand Up @@ -515,8 +515,8 @@ public function test_ajax_search_available_items_caps_check( $role, $expected_re
*
* @return array {
* @type array {
* @string string $role The role that will test caps for.
* @array array $expected_results The expected results from the Ajax call.
* @type string $role The role that will test caps for.
* @type array $expected_results The expected results from the Ajax call.
* }
* }
*/
Expand Down Expand Up @@ -610,8 +610,8 @@ public function test_ajax_search_available_items_results( $post_args, $expected_
*
* @return array {
* @type array {
* @string string $post_args The args that will be passed to Ajax.
* @array array $expected_results The expected results from the Ajax call.
* @type string $post_args The args that will be passed to Ajax.
* @type array $expected_results The expected results from the Ajax call.
* }
* }
*/
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/tests/functions/anonymization.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public function test_wp_privacy_anonymize_ip( $raw_ip, $expected_result ) {
*
* @return array {
* @type array {
* @string string $raw_ip Raw IP address.
* @string string $expected_result Expected result.
* @type string $raw_ip Raw IP address.
* @type string $expected_result Expected result.
* }
* }
*/
Expand Down Expand Up @@ -195,8 +195,8 @@ public function test_wp_privacy_anonymize_ip_with_inet_dependency( $raw_ip, $exp
*
* @return array {
* @type array {
* @string string $raw_ip Raw IP address.
* @string string $expected_result Expected result.
* @type string $raw_ip Raw IP address.
* @type string $expected_result Expected result.
* }
* }
*/
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/tests/kses.php
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,8 @@ public function test_safecss_filter_attr( $css, $expected ) {
*
* @return array {
* @type array {
* @string string $css A string of CSS rules.
* @string string $expected Expected string of CSS rules.
* @type string $css A string of CSS rules.
* @type string $expected Expected string of CSS rules.
* }
* }
*/
Expand Down Expand Up @@ -1614,8 +1614,8 @@ public function test_safecss_filter_attr_filtered( $css, $expected ) {
*
* @return array {
* @type array {
* @string string $css A string of CSS rules.
* @string string $expected Expected string of CSS rules.
* @type string $css A string of CSS rules.
* @type string $expected Expected string of CSS rules.
* }
* }
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,12 +626,12 @@ public function test_request_status_transitions_correctly( $expected_status, $re
*
* @return array {
* @type array {
* @string string $expected_status The expected post status after calling the function.
* @string string $response_page The exporter page to pass. Options are 'first' and 'last'. Default 'first'.
* @string string $exporter_index The exporter index to pass. Options are 'first' and 'last'. Default 'first'.
* @string string $page_index The page index to pass. Options are 'first' and 'last'. Default 'first'.
* @bool bool $send_as_email If the response should be sent as an email.
* @string string $exporter_key The slug (key) of the exporter to pass.
* @type string $expected_status The expected post status after calling the function.
* @type string $response_page The exporter page to pass. Options are 'first' and 'last'. Default 'first'.
* @type string $exporter_index The exporter index to pass. Options are 'first' and 'last'. Default 'first'.
* @type string $page_index The page index to pass. Options are 'first' and 'last'. Default 'first'.
* @type bool $send_as_email If the response should be sent as an email.
* @type string $exporter_key The slug (key) of the exporter to pass.
* }
* }
*/
Expand Down

0 comments on commit 7287ff5

Please sign in to comment.