Make WordPress Core

Changeset 55141


Ignore:
Timestamp:
01/25/2023 09:54:43 PM (2 years ago)
Author:
hellofromTonya
Message:

Editor: Remove WP_DEBUG defined check in wp_tinycolor_hue_to_rgb().

The constant WP_DEBUG is a default constant that is set within wp_initial_constants() when not defined. This means the constant will always be defined, thus making the defined( 'WP_DEBUG' ) unnecessary.

Removing the defined() provides these benefits:

  • Makes the code more readable.
  • Tiny performance optimization.

References:

Follow-up to [52049].

Props ocean90, spacedmonkey, mamaduka.
See #57527.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/duotone.php

    r55140 r55141  
    460460    $svg = ob_get_clean();
    461461
    462     if ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) {
     462    if ( ! SCRIPT_DEBUG ) {
    463463        // Clean up the whitespace.
    464464        $svg = preg_replace( "/[\r\n\t ]+/", ' ', $svg );
     
    544544    // !important is needed because these styles render before global styles,
    545545    // and they should be overriding the duotone filters set by global styles.
    546     $filter_style = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG
     546    $filter_style = SCRIPT_DEBUG
    547547        ? $selector . " {\n\tfilter: " . $filter_property . " !important;\n}\n"
    548548        : $selector . '{filter:' . $filter_property . ' !important;}';
Note: See TracChangeset for help on using the changeset viewer.