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-customize-manager.php

    r47387 r47550  
    59005900    public function _sanitize_background_setting( $value, $setting ) {
    59015901        if ( 'background_repeat' === $setting->id ) {
    5902             if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ) ) ) {
     5902            if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) {
    59035903                return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) );
    59045904            }
    59055905        } elseif ( 'background_attachment' === $setting->id ) {
    5906             if ( ! in_array( $value, array( 'fixed', 'scroll' ) ) ) {
     5906            if ( ! in_array( $value, array( 'fixed', 'scroll' ), true ) ) {
    59075907                return new WP_Error( 'invalid_value', __( 'Invalid value for background attachment.' ) );
    59085908            }
Note: See TracChangeset for help on using the changeset viewer.