Skip to content

Commit f1364da

Browse files
Docs: Correct type declarations in test docblocks.
Replaces non-standard type names in test docblocks with the ones used throughout core, and fixes `@param` tags that had the type after the variable name. - `integer` → `int`, `boolean` → `bool`, `callback` → `callable`. - `@param $data string` → `@param string $data` - `tests_get_phpunit_version()` was documented as returning `double`. It actually returns the version string from PHPUnit, or `0` if PHPUnit is not loaded, so the `@return` is now `string|int`. - The affected `@param` blocks are realigned. Developed in #14204. Props Soean, dhruvang21, westonruter. See #65860. git-svn-id: https://develop.svn.wordpress.org/trunk@64319 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d4323aa commit f1364da

9 files changed

Lines changed: 19 additions & 19 deletions

File tree

‎tests/phpunit/includes/class-wp-sitemaps-large-test-provider.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class WP_Sitemaps_Large_Test_Provider extends WP_Sitemaps_Provider {
99
/**
1010
* Number of entries in the sitemap the provider produces.
1111
*
12-
* @var integer
12+
* @var int
1313
*/
1414
public $num_entries = 1;
1515

‎tests/phpunit/includes/functions.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/**
55
* Retrieves PHPUnit runner version.
66
*
7-
* @return double The version number.
7+
* @return string|int The version number, or 0 if PHPUnit is not loaded.
88
*/
99
function tests_get_phpunit_version() {
1010
if ( class_exists( 'PHPUnit\Runner\Version' ) ) {

‎tests/phpunit/includes/testcase-ajax.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function logout() {
198198
/**
199199
* Returns our callback handler
200200
*
201-
* @return callback
201+
* @return callable
202202
*/
203203
public function getDieHandler() {
204204
return array( $this, 'dieHandler' );

‎tests/phpunit/tests/ajax/wpAjaxResponse.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function tear_down() {
4747
/**
4848
* Return our callback handler
4949
*
50-
* @return callback
50+
* @return callable
5151
*/
5252
public function getDieHandler() {
5353
return array( $this, 'dieHandler' );

‎tests/phpunit/tests/block-supports/aria-label.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ private function register_aria_label_block_with_support( $block_name, $supports
5050
*
5151
* @dataProvider data_aria_label_block_support
5252
*
53-
* @param boolean|array $support Aria label block support configuration.
54-
* @param string $value Aria label value for attribute object.
55-
* @param array $expected Expected aria-label attributes.
53+
* @param bool|array $support Aria label block support configuration.
54+
* @param string $value Aria label value for attribute object.
55+
* @param array $expected Expected aria-label attributes.
5656
*/
5757
public function test_wp_apply_aria_label_support( $support, $value, $expected ) {
5858
$block_type = self::register_aria_label_block_with_support(

‎tests/phpunit/tests/block-supports/shadow.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ private function register_shadow_block_with_support( $block_name, $supports = ar
5454
*
5555
* @dataProvider data_generate_shadow_fixtures
5656
*
57-
* @param boolean|array $support Shadow block support configuration.
58-
* @param string $value Shadow style value for style attribute object.
59-
* @param array $expected Expected shadow block support styles.
57+
* @param bool|array $support Shadow block support configuration.
58+
* @param string $value Shadow style value for style attribute object.
59+
* @param array $expected Expected shadow block support styles.
6060
*/
6161
public function test_wp_apply_shadow_support( $support, $value, $expected ) {
6262
$block_type = self::register_shadow_block_with_support(

‎tests/phpunit/tests/db.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ public function data_esc_like() {
168168
*
169169
* @ticket 10041
170170
* @dataProvider data_like_query
171-
* @param $data string The haystack, raw.
172-
* @param $like string The like phrase, raw.
173-
* @param $result string The expected comparison result; '1' = true, '0' = false
171+
* @param string $data The haystack, raw.
172+
* @param string $like The like phrase, raw.
173+
* @param string $result The expected comparison result; '1' = true, '0' = false
174174
*/
175175
public function test_like_query( $data, $like, $result ) {
176176
global $wpdb;

‎tests/phpunit/tests/kses.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,8 +2131,8 @@ public function data_wp_kses_style_attr_decodes_entities_before_css_filtering()
21312131
* @ticket 46197
21322132
* @ticket 46498
21332133
*
2134-
* @param $input string The style attribute saved in the editor.
2135-
* @param $expected string The sanitized style attribute.
2134+
* @param string $input The style attribute saved in the editor.
2135+
* @param string $expected The sanitized style attribute.
21362136
*/
21372137
public function test_kses_style_attr_with_url( $input, $expected ) {
21382138
$actual = safecss_filter_attr( $input );

‎tests/phpunit/tests/media/testcase-adjacent-image-link.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
4040
/**
4141
* Sets up the test scenario.
4242
*
43-
* @param integer $current_attachment_index Current attachment's index number in the self::$attachments array.
44-
* @param integer $expected_attachment_index Expected attachment's index number in the self::$attachments array.
45-
* @param string $expected The expected output string.
46-
* @param array $args Array of arguments to pass to the function being tested.
43+
* @param int $current_attachment_index Current attachment's index number in the self::$attachments array.
44+
* @param int $expected_attachment_index Expected attachment's index number in the self::$attachments array.
45+
* @param string $expected The expected output string.
46+
* @param array $args Array of arguments to pass to the function being tested.
4747
* @return array {
4848
* Array of the prepared test parameters.
4949
*

0 commit comments

Comments
 (0)