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/class-wp-embed.php

    r47122 r47550  
    371371
    372372        $post_types = get_post_types( array( 'show_ui' => true ) );
     373
    373374        /**
    374375         * Filters the array of post types to cache oEmbed results for.
     
    378379         * @param string[] $post_types Array of post type names to cache oEmbed results for. Defaults to post types with `show_ui` set to true.
    379380         */
    380         if ( empty( $post->ID ) || ! in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', $post_types ) ) ) {
     381        $cache_oembed_types = apply_filters( 'embed_cache_oembed_types', $post_types );
     382
     383        if ( empty( $post->ID ) || ! in_array( $post->post_type, $cache_oembed_types, true ) ) {
    381384            return;
    382385        }
Note: See TracChangeset for help on using the changeset viewer.