Make WordPress Core


Ignore:
Timestamp:
04/05/2020 03:00:44 AM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-formats.php

    r47122 r47550  
    7676    if ( ! empty( $format ) ) {
    7777        $format = sanitize_key( $format );
    78         if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs() ) ) {
     78        if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs(), true ) ) {
    7979            $format = '';
    8080        } else {
     
    232232 */
    233233function _post_format_get_terms( $terms, $taxonomies, $args ) {
    234     if ( in_array( 'post_format', (array) $taxonomies ) ) {
     234    if ( in_array( 'post_format', (array) $taxonomies, true ) ) {
    235235        if ( isset( $args['fields'] ) && 'names' == $args['fields'] ) {
    236236            foreach ( $terms as $order => $name ) {
Note: See TracChangeset for help on using the changeset viewer.