Make WordPress Core


Ignore:
Timestamp:
11/29/2022 08:58:26 PM (23 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Always use strict type check for in_array().

This fixes the currently flagged WordPress.PHP.StrictInArray.MissingTrueStrict issues:

  • Not using strict comparison for in_array; supply true for third argument.

These all do comparisons with strings, so all the more reason why it is imperative that a strict comparison is used.

Follow-up to [47550], [47557], [54155], [53480].

Props jrf.
See #56791.

File:
1 edited

Legend:

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

    r54891 r54895  
    28802880        }
    28812881
    2882         if ( in_array( $args['decoding'], array( 'async', 'sync', 'auto' ) ) && ! preg_match( '/\bdecoding\s*=/', $extra_attr ) ) {
     2882        if ( in_array( $args['decoding'], array( 'async', 'sync', 'auto' ), true ) && ! preg_match( '/\bdecoding\s*=/', $extra_attr ) ) {
    28832883            if ( ! empty( $extra_attr ) ) {
    28842884                $extra_attr .= ' ';
Note: See TracChangeset for help on using the changeset viewer.