Make WordPress Core

Changeset 53240


Ignore:
Timestamp:
04/21/2022 09:03:05 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in wp-includes/block-supports/border.php.

While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the $default parameter to $default_value in wp_has_border_feature_support().

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.

File:
1 edited

Legend:

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

    r53076 r53240  
    154154 * @access private
    155155 *
    156  * @param WP_Block_Type $block_type Block type to check for support.
    157  * @param string        $feature    Name of the feature to check support for.
    158  * @param mixed         $default    Fallback value for feature support, defaults to false.
     156 * @param WP_Block_Type $block_type    Block type to check for support.
     157 * @param string        $feature       Name of the feature to check support for.
     158 * @param mixed         $default_value Fallback value for feature support, defaults to false.
    159159 * @return bool Whether the feature is supported.
    160160 */
    161 function wp_has_border_feature_support( $block_type, $feature, $default = false ) {
     161function wp_has_border_feature_support( $block_type, $feature, $default_value = false ) {
    162162    // Check if all border support features have been opted into via `"__experimentalBorder": true`.
    163163    if (
    164164        property_exists( $block_type, 'supports' ) &&
    165         ( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), $default ) )
     165        ( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), $default_value ) )
    166166    ) {
    167167        return true;
     
    170170    // Check if the specific feature has been opted into individually
    171171    // via nested flag under `__experimentalBorder`.
    172     return block_has_support( $block_type, array( '__experimentalBorder', $feature ), $default );
     172    return block_has_support( $block_type, array( '__experimentalBorder', $feature ), $default_value );
    173173}
    174174
Note: See TracChangeset for help on using the changeset viewer.