Make WordPress Core


Ignore:
Timestamp:
04/09/2020 03:41:04 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict type check for in_array() and array_search().

This addresses all the remaining WordPress.PHP.StrictInArray.MissingTrueStrict issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r47550 r47557  
    21812181        ARRAY_N
    21822182    );
     2183
    21832184    if ( $dayswithposts ) {
    21842185        foreach ( (array) $dayswithposts as $daywith ) {
    2185             $daywithpost[] = $daywith[0];
     2186            $daywithpost[] = (int) $daywith[0];
    21862187        }
    21872188    }
     
    22102211        }
    22112212
    2212         if ( in_array( $day, $daywithpost ) ) {
     2213        if ( in_array( $day, $daywithpost, true ) ) {
    22132214            // Any posts today?
    22142215            $date_format = gmdate( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) );
     
    22242225            $calendar_output .= $day;
    22252226        }
     2227
    22262228        $calendar_output .= '</td>';
    22272229
     
    22352237        $calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '">&nbsp;</td>';
    22362238    }
     2239
    22372240    $calendar_output .= "\n\t</tr>\n\t</tbody>";
    22382241
Note: See TracChangeset for help on using the changeset viewer.