From 8bec516c183abc1cac5cd39efe479cff27a84707 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 7 Sep 2016 16:15:30 +0000 Subject: [PATCH] Menus: Correct the docblocks for `Walker_Nav_Menu`, `wp_nav_menu()`, and `walk_nav_menu_tree()`. This corrects the parameter type for the `$args` and `$item` parameters passed throughout these functions, class methods, and hooks. See #24587 See #35206 See #37770 Built from https://develop.svn.wordpress.org/trunk@38559 git-svn-id: http://core.svn.wordpress.org/trunk@38502 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-walker-nav-menu.php | 74 +++++++++++++-------------- wp-includes/nav-menu-template.php | 26 +++++----- wp-includes/version.php | 2 +- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/wp-includes/class-walker-nav-menu.php b/wp-includes/class-walker-nav-menu.php index edc6f2a607..13c9e6dd0a 100644 --- a/wp-includes/class-walker-nav-menu.php +++ b/wp-includes/class-walker-nav-menu.php @@ -45,9 +45,9 @@ class Walker_Nav_Menu extends Walker { * * @see Walker::start_lvl() * - * @param string $output Passed by reference. Used to append additional content. - * @param int $depth Depth of menu item. Used for padding. - * @param array $args An array of wp_nav_menu() arguments. + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args An object of wp_nav_menu() arguments. */ public function start_lvl( &$output, $depth = 0, $args = array() ) { if ( 'preserve' === $args->item_spacing ) { @@ -68,9 +68,9 @@ class Walker_Nav_Menu extends Walker { * * @see Walker::end_lvl() * - * @param string $output Passed by reference. Used to append additional content. - * @param int $depth Depth of menu item. Used for padding. - * @param array $args An array of wp_nav_menu() arguments. + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args An object of wp_nav_menu() arguments. */ public function end_lvl( &$output, $depth = 0, $args = array() ) { if ( 'preserve' === $args->item_spacing ) { @@ -92,11 +92,11 @@ class Walker_Nav_Menu extends Walker { * * @see Walker::start_el() * - * @param string $output Passed by reference. Used to append additional content. - * @param object $item Menu item data object. - * @param int $depth Depth of menu item. Used for padding. - * @param array $args An array of wp_nav_menu() arguments. - * @param int $id Current item ID. + * @param string $output Passed by reference. Used to append additional content. + * @param WP_Post $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args An object of wp_nav_menu() arguments. + * @param int $id Current item ID. */ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { if ( 'preserve' === $args->item_spacing ) { @@ -116,9 +116,9 @@ class Walker_Nav_Menu extends Walker { * * @since 4.4.0 * - * @param array $args An array of arguments. - * @param object $item Menu item data object. - * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args An object of wp_nav_menu() arguments. + * @param WP_Post $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. */ $args = apply_filters( 'nav_menu_item_args', $args, $item, $depth ); @@ -128,10 +128,10 @@ class Walker_Nav_Menu extends Walker { * @since 3.0.0 * @since 4.1.0 The `$depth` parameter was added. * - * @param array $classes The CSS classes that are applied to the menu item's `
  • ` element. - * @param object $item The current menu item. - * @param array $args An array of wp_nav_menu() arguments. - * @param int $depth Depth of menu item. Used for padding. + * @param array $classes The CSS classes that are applied to the menu item's `
  • ` element. + * @param WP_Post $item The current menu item. + * @param stdClass $args An object of wp_nav_menu() arguments. + * @param int $depth Depth of menu item. Used for padding. */ $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; @@ -142,10 +142,10 @@ class Walker_Nav_Menu extends Walker { * @since 3.0.1 * @since 4.1.0 The `$depth` parameter was added. * - * @param string $menu_id The ID that is applied to the menu item's `
  • ` element. - * @param object $item The current menu item. - * @param array $args An array of wp_nav_menu() arguments. - * @param int $depth Depth of menu item. Used for padding. + * @param string $menu_id The ID that is applied to the menu item's `
  • ` element. + * @param WP_Post $item The current menu item. + * @param stdClass $args An object of wp_nav_menu() arguments. + * @param int $depth Depth of menu item. Used for padding. */ $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args, $depth ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; @@ -172,9 +172,9 @@ class Walker_Nav_Menu extends Walker { * @type string $rel The rel attribute. * @type string $href The href attribute. * } - * @param object $item The current menu item. - * @param array $args An array of wp_nav_menu() arguments. - * @param int $depth Depth of menu item. Used for padding. + * @param WP_Post $item The current menu item. + * @param stdClass $args An object of wp_nav_menu() arguments. + * @param int $depth Depth of menu item. Used for padding. */ $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth ); @@ -194,10 +194,10 @@ class Walker_Nav_Menu extends Walker { * * @since 4.4.0 * - * @param string $title The menu item's title. - * @param object $item The current menu item. - * @param array $args An array of wp_nav_menu() arguments. - * @param int $depth Depth of menu item. Used for padding. + * @param string $title The menu item's title. + * @param WP_Post $item The current menu item. + * @param stdClass $args An object of wp_nav_menu() arguments. + * @param int $depth Depth of menu item. Used for padding. */ $title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth ); @@ -216,10 +216,10 @@ class Walker_Nav_Menu extends Walker { * * @since 3.0.0 * - * @param string $item_output The menu item's starting HTML output. - * @param object $item Menu item data object. - * @param int $depth Depth of menu item. Used for padding. - * @param array $args An array of wp_nav_menu() arguments. + * @param string $item_output The menu item's starting HTML output. + * @param WP_Post $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args An object of wp_nav_menu() arguments. */ $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } @@ -231,10 +231,10 @@ class Walker_Nav_Menu extends Walker { * * @see Walker::end_el() * - * @param string $output Passed by reference. Used to append additional content. - * @param object $item Page data object. Not used. - * @param int $depth Depth of page. Not Used. - * @param array $args An array of wp_nav_menu() arguments. + * @param string $output Passed by reference. Used to append additional content. + * @param WP_Post $item Page data object. Not used. + * @param int $depth Depth of page. Not Used. + * @param stdClass $args An object of wp_nav_menu() arguments. */ public function end_el( &$output, $item, $depth = 0, $args = array() ) { if ( 'preserve' === $args->item_spacing ) { diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index fc62c94a91..ba49918b73 100644 --- a/wp-includes/nav-menu-template.php +++ b/wp-includes/nav-menu-template.php @@ -82,7 +82,7 @@ function wp_nav_menu( $args = array() ) { * @see wp_nav_menu() * * @param string|null $output Nav menu output to short-circuit with. Default null. - * @param object $args An object containing wp_nav_menu() arguments. + * @param stdClass $args An object containing wp_nav_menu() arguments. */ $nav_menu = apply_filters( 'pre_wp_nav_menu', null, $args ); @@ -182,8 +182,8 @@ function wp_nav_menu( $args = array() ) { * * @since 3.1.0 * - * @param array $sorted_menu_items The menu items, sorted by each menu item's menu order. - * @param object $args An object containing wp_nav_menu() arguments. + * @param array $sorted_menu_items The menu items, sorted by each menu item's menu order. + * @param stdClass $args An object containing wp_nav_menu() arguments. */ $sorted_menu_items = apply_filters( 'wp_nav_menu_objects', $sorted_menu_items, $args ); @@ -213,8 +213,8 @@ function wp_nav_menu( $args = array() ) { * * @see wp_nav_menu() * - * @param string $items The HTML list content for the menu items. - * @param object $args An object containing wp_nav_menu() arguments. + * @param string $items The HTML list content for the menu items. + * @param stdClass $args An object containing wp_nav_menu() arguments. */ $items = apply_filters( 'wp_nav_menu_items', $items, $args ); /** @@ -224,8 +224,8 @@ function wp_nav_menu( $args = array() ) { * * @see wp_nav_menu() * - * @param string $items The HTML list content for the menu items. - * @param object $args An object containing wp_nav_menu() arguments. + * @param string $items The HTML list content for the menu items. + * @param stdClass $args An object containing wp_nav_menu() arguments. */ $items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args ); @@ -246,8 +246,8 @@ function wp_nav_menu( $args = array() ) { * * @see wp_nav_menu() * - * @param string $nav_menu The HTML content for the navigation menu. - * @param object $args An object containing wp_nav_menu() arguments. + * @param string $nav_menu The HTML content for the navigation menu. + * @param stdClass $args An object containing wp_nav_menu() arguments. */ $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args ); @@ -495,10 +495,10 @@ function _wp_menu_item_classes_by_context( &$menu_items ) { * @uses Walker_Nav_Menu to create HTML list content. * @since 3.0.0 * - * @param array $items - * @param int $depth - * @param object $r - * @return string + * @param array $items The menu items, sorted by each menu item's menu order. + * @param int $depth Depth of the item in reference to parents. + * @param stdClass $r An object containing wp_nav_menu() arguments. + * @return string The HTML list content for the menu items. */ function walk_nav_menu_tree( $items, $depth, $r ) { $walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker; diff --git a/wp-includes/version.php b/wp-includes/version.php index ff2113eb5a..06477ed425 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38538'; +$wp_version = '4.7-alpha-38559'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.