Skip to content

Commit 8d3009d

Browse files
Coding Standards: Replace strval() with (string) type casting in wp_nav_menu().
This adjusts a newly introduced instance for consistency with the rest of core. Follow-up to [49108], [55059]. See #57169. git-svn-id: https://develop.svn.wordpress.org/trunk@55352 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1e6ab88 commit 8d3009d

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/wp-includes/nav-menu-template.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,9 @@ function wp_nav_menu( $args = array() ) {
200200
foreach ( (array) $menu_items as $menu_item ) {
201201
/*
202202
* Fix invalid `menu_item_parent`. See: https://core.trac.wordpress.org/ticket/56926.
203-
* Compare as strings. Plugins may change the ID to string.
204-
* To avoid modifying the object, use `strval()` rather than casting to (string).
203+
* Compare as strings. Plugins may change the ID to a string.
205204
*/
206-
if ( strval( $menu_item->ID ) === strval( $menu_item->menu_item_parent ) ) {
205+
if ( (string) $menu_item->ID === (string) $menu_item->menu_item_parent ) {
207206
$menu_item->menu_item_parent = 0;
208207
}
209208

0 commit comments

Comments
 (0)