From 1d006a0f571861686ca36d990d1fa29898fbf4c3 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Mon, 16 Oct 2023 15:15:14 +0000 Subject: [PATCH] General: Remove discouraged `@return void` annotations. Such `@return void` annotations must not be used in WordPress core's PHP code, except bundled themes, third-party libraries, and PHP compatibility shims. Props isabel_brison, swissspidy. Fixes #59619. git-svn-id: https://develop.svn.wordpress.org/trunk@56943 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/block-template-utils.php | 2 -- src/wp-includes/class-wp-theme.php | 2 -- .../class-wp-rest-navigation-fallback-controller.php | 2 -- .../factory/class-wp-unittest-factory-for-blog.php | 2 -- .../factory/class-wp-unittest-factory-for-network.php | 2 -- tests/phpunit/includes/object-cache.php | 7 ------- tests/phpunit/tests/admin/includesPost.php | 2 -- .../tests/block-supports/wpRenderElementsSupport.php | 2 -- .../phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php | 1 - 9 files changed, 22 deletions(-) diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php index 94934599a8..f71ae26aab 100644 --- a/src/wp-includes/block-template-utils.php +++ b/src/wp-includes/block-template-utils.php @@ -478,7 +478,6 @@ function _flatten_blocks( &$blocks ) { * @access private * * @param array $block a parsed block. - * @return void */ function _inject_theme_attribute_in_template_part_block( &$block ) { if ( @@ -496,7 +495,6 @@ function _inject_theme_attribute_in_template_part_block( &$block ) { * @access private * * @param array $block a parsed block. - * @return void */ function _remove_theme_attribute_from_template_part_block( &$block ) { if ( diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php index 40812c72bc..84219cd921 100644 --- a/src/wp-includes/class-wp-theme.php +++ b/src/wp-includes/class-wp-theme.php @@ -776,8 +776,6 @@ final class WP_Theme implements ArrayAccess { * Perform reinitialization tasks. * * Prevents a callback from being injected during unserialization of an object. - * - * @return void */ public function __wakeup() { if ( $this->parent && ! $this->parent instanceof self ) { diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-navigation-fallback-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-navigation-fallback-controller.php index 2290c69f32..575a1a900e 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-navigation-fallback-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-navigation-fallback-controller.php @@ -40,8 +40,6 @@ class WP_REST_Navigation_Fallback_Controller extends WP_REST_Controller { * Registers the controllers routes. * * @since 6.3.0 - * - * @return void */ public function register_routes() { diff --git a/tests/phpunit/includes/factory/class-wp-unittest-factory-for-blog.php b/tests/phpunit/includes/factory/class-wp-unittest-factory-for-blog.php index 39b59f7169..c9ce9f335c 100644 --- a/tests/phpunit/includes/factory/class-wp-unittest-factory-for-blog.php +++ b/tests/phpunit/includes/factory/class-wp-unittest-factory-for-blog.php @@ -73,8 +73,6 @@ class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing { * * @param int $blog_id ID of the site to update. * @param array $fields The fields to update. - * - * @return void */ public function update_object( $blog_id, $fields ) {} diff --git a/tests/phpunit/includes/factory/class-wp-unittest-factory-for-network.php b/tests/phpunit/includes/factory/class-wp-unittest-factory-for-network.php index a578bddb6a..686ebe89bb 100644 --- a/tests/phpunit/includes/factory/class-wp-unittest-factory-for-network.php +++ b/tests/phpunit/includes/factory/class-wp-unittest-factory-for-network.php @@ -65,8 +65,6 @@ class WP_UnitTest_Factory_For_Network extends WP_UnitTest_Factory_For_Thing { * * @param int $network_id ID of the network to update. * @param array $fields The fields to update. - * - * @return void */ public function update_object( $network_id, $fields ) {} diff --git a/tests/phpunit/includes/object-cache.php b/tests/phpunit/includes/object-cache.php index e1404188f3..ef03546892 100644 --- a/tests/phpunit/includes/object-cache.php +++ b/tests/phpunit/includes/object-cache.php @@ -820,7 +820,6 @@ function wp_cache_set_option( $option, $value ) { * Switches blog prefix, which changes the cache that is accessed. * * @param int $blog_id Blog to switch to. - * @return void */ function wp_cache_switch_to_blog( $blog_id ) { global $wp_object_cache; @@ -832,7 +831,6 @@ function wp_cache_switch_to_blog( $blog_id ) { * Sets up Object Cache Global and assigns it. * * @global WP_Object_Cache $wp_object_cache WordPress Object Cache - * @return void */ function wp_cache_init() { global $wp_object_cache; @@ -843,7 +841,6 @@ function wp_cache_init() { * Adds a group or set of groups to the list of non-persistent groups. * * @param string|array $groups A group or an array of groups to add. - * @return void */ function wp_cache_add_global_groups( $groups ) { global $wp_object_cache; @@ -854,7 +851,6 @@ function wp_cache_add_global_groups( $groups ) { * Adds a group or set of groups to the list of non-Memcached groups. * * @param string|array $groups A group or an array of groups to add. - * @return void */ function wp_cache_add_non_persistent_groups( $groups ) { global $wp_object_cache; @@ -2329,7 +2325,6 @@ class WP_Object_Cache { * @link http://wordpress.org/extend/plugins/memcached/ * * @param array $groups Array of groups. - * @return void */ public function add_global_groups( $groups ) { if ( ! is_array( $groups ) ) { @@ -2349,7 +2344,6 @@ class WP_Object_Cache { * @link http://wordpress.org/extend/plugins/memcached/ * * @param array $groups Array of groups. - * @return void */ public function add_non_persistent_groups( $groups ) { if ( ! is_array( $groups ) ) { @@ -2381,7 +2375,6 @@ class WP_Object_Cache { * Switches blog prefix, which changes the cache that is accessed. * * @param int $blog_id Blog to switch to. - * @return void */ public function switch_to_blog( $blog_id ) { global $table_prefix; diff --git a/tests/phpunit/tests/admin/includesPost.php b/tests/phpunit/tests/admin/includesPost.php index f4eaa0f513..5b07f23568 100644 --- a/tests/phpunit/tests/admin/includesPost.php +++ b/tests/phpunit/tests/admin/includesPost.php @@ -1144,8 +1144,6 @@ class Tests_Admin_IncludesPost extends WP_UnitTestCase { /** * Test refreshed nonce for metabox loader. - * - * @return void */ public function test_user_get_refreshed_metabox_nonce() { diff --git a/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php b/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php index db5307d207..791cec8a72 100644 --- a/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php +++ b/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php @@ -25,8 +25,6 @@ class Tests_Block_Supports_WpRenderElementsSupport extends WP_UnitTestCase { * @ticket 59578 * * @covers ::wp_render_elements_support - * - * @return void */ public function test_leaves_block_content_alone_when_block_type_not_registered() { $block = array( diff --git a/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php b/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php index 6f8f114025..d454ab4842 100644 --- a/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php +++ b/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php @@ -300,7 +300,6 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase { * @param string $html HTML string with tags in it, one of which contains the "target" attribute. * @param array $breadcrumbs Breadcrumbs of element with "target" attribute set. * @param int $ignored_n Not used in this test but provided in the dataset for other tests. - * @return void */ public function test_reports_correct_breadcrumbs_for_html( $html, $breadcrumbs, $ignored_n ) { $p = WP_HTML_Processor::create_fragment( $html );