Make WordPress Core


Ignore:
Timestamp:
05/16/2020 06:40:52 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison where static strings are involved.

This reduces the number of WordPress.PHP.StrictComparisons.LooseComparison issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.

File:
1 edited

Legend:

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

    r47550 r47808  
    193193function _post_format_link( $link, $term, $taxonomy ) {
    194194        global $wp_rewrite;
    195         if ( 'post_format' != $taxonomy ) {
     195        if ( 'post_format' !== $taxonomy ) {
    196196                return $link;
    197197        }
     
    233233function _post_format_get_terms( $terms, $taxonomies, $args ) {
    234234        if ( in_array( 'post_format', (array) $taxonomies, true ) ) {
    235                 if ( isset( $args['fields'] ) && 'names' == $args['fields'] ) {
     235                if ( isset( $args['fields'] ) && 'names' === $args['fields'] ) {
    236236                        foreach ( $terms as $order => $name ) {
    237237                                $terms[ $order ] = get_post_format_string( str_replace( 'post-format-', '', $name ) );
     
    239239                } else {
    240240                        foreach ( (array) $terms as $order => $term ) {
    241                                 if ( isset( $term->taxonomy ) && 'post_format' == $term->taxonomy ) {
     241                                if ( isset( $term->taxonomy ) && 'post_format' === $term->taxonomy ) {
    242242                                        $terms[ $order ]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) );
    243243                                }
     
    259259function _post_format_wp_get_object_terms( $terms ) {
    260260        foreach ( (array) $terms as $order => $term ) {
    261                 if ( isset( $term->taxonomy ) && 'post_format' == $term->taxonomy ) {
     261                if ( isset( $term->taxonomy ) && 'post_format' === $term->taxonomy ) {
    262262                        $terms[ $order ]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) );
    263263                }
Note: See TracChangeset for help on using the changeset viewer.