mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 13:14:29 +00:00
Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50. Includes minor code layout fixes for better readability. See #49542. git-svn-id: https://develop.svn.wordpress.org/trunk@47550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -135,7 +135,7 @@ foreach ( array_merge( $builtin, $types ) as $ptype ) {
|
||||
} else {
|
||||
$menu_icon = esc_url( $ptype_obj->menu_icon );
|
||||
}
|
||||
} elseif ( in_array( $ptype, $builtin ) ) {
|
||||
} elseif ( in_array( $ptype, $builtin, true ) ) {
|
||||
$menu_icon = 'dashicons-admin-' . $ptype;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ foreach ( array_merge( $builtin, $types ) as $ptype ) {
|
||||
$edit_tags_file = "edit-tags.php?taxonomy=%s&post_type=$ptype";
|
||||
}
|
||||
|
||||
if ( in_array( $ptype, $builtin ) ) {
|
||||
if ( in_array( $ptype, $builtin, true ) ) {
|
||||
$ptype_menu_id = 'menu-' . $ptype_for_id . 's';
|
||||
} else {
|
||||
$ptype_menu_id = 'menu-posts-' . $ptype_for_id;
|
||||
@@ -162,7 +162,7 @@ foreach ( array_merge( $builtin, $types ) as $ptype ) {
|
||||
* by a hard-coded value below, increment the position.
|
||||
*/
|
||||
$core_menu_positions = array( 59, 60, 65, 70, 75, 80, 85, 99 );
|
||||
while ( isset( $menu[ $ptype_menu_position ] ) || in_array( $ptype_menu_position, $core_menu_positions ) ) {
|
||||
while ( isset( $menu[ $ptype_menu_position ] ) || in_array( $ptype_menu_position, $core_menu_positions, true ) ) {
|
||||
$ptype_menu_position++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user