From 05d12bfa4cefd47cc281d2a8a246133cbb500a55 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 19 Apr 2022 13:51:08 +0000 Subject: [PATCH] Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/taxonomy.php`. While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names. This commit: * Renames the `$parent` parameter to `$category_parent` in `category_exists()` and `wp_create_category()`. This matches the category object property of the same name. * Amends similar parameters in `dropdown_categories()` and `wp_dropdown_cats()` for consistency. Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #55327. Built from https://develop.svn.wordpress.org/trunk@53216 git-svn-id: http://core.svn.wordpress.org/trunk@52805 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/deprecated.php | 18 +++++++++--------- wp-admin/includes/taxonomy.php | 18 +++++++++--------- wp-includes/version.php | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php index 38576f25a4..5a932887d6 100644 --- a/wp-admin/includes/deprecated.php +++ b/wp-admin/includes/deprecated.php @@ -78,10 +78,10 @@ function get_udims( $width, $height ) { * @global int $post_ID * * @param int $default_category Unused. - * @param int $parent_category Unused. + * @param int $category_parent Unused. * @param array $popular_ids Unused. */ -function dropdown_categories( $default_category = 0, $parent_category = 0, $popular_ids = array() ) { +function dropdown_categories( $default_category = 0, $category_parent = 0, $popular_ids = array() ) { _deprecated_function( __FUNCTION__, '2.6.0', 'wp_category_checklist()' ); global $post_ID; wp_category_checklist( $post_ID ); @@ -127,21 +127,21 @@ function get_real_file_to_edit( $file ) { * @deprecated 3.0.0 Use wp_dropdown_categories() * @see wp_dropdown_categories() * - * @param int $current_cat Optional. ID of the current category. Default 0. - * @param int $current_parent Optional. Current parent category ID. Default 0. - * @param int $parent_cat Optional. Parent ID to retrieve categories for. Default 0. - * @param int $level Optional. Number of levels deep to display. Default 0. - * @param array $categories Optional. Categories to include in the control. Default 0. + * @param int $current_cat Optional. ID of the current category. Default 0. + * @param int $current_parent Optional. Current parent category ID. Default 0. + * @param int $category_parent Optional. Parent ID to retrieve categories for. Default 0. + * @param int $level Optional. Number of levels deep to display. Default 0. + * @param array $categories Optional. Categories to include in the control. Default 0. * @return void|false Void on success, false if no categories were found. */ -function wp_dropdown_cats( $current_cat = 0, $current_parent = 0, $parent_cat = 0, $level = 0, $categories = 0 ) { +function wp_dropdown_cats( $current_cat = 0, $current_parent = 0, $category_parent = 0, $level = 0, $categories = 0 ) { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_dropdown_categories()' ); if (!$categories ) $categories = get_categories( array('hide_empty' => 0) ); if ( $categories ) { foreach ( $categories as $category ) { - if ( $current_cat != $category->term_id && $parent_cat == $category->parent) { + if ( $current_cat != $category->term_id && $category_parent == $category->parent) { $pad = str_repeat( '– ', $level ); $category->name = esc_html( $category->name ); echo "\n\t