Make WordPress Core

Changeset 53284


Ignore:
Timestamp:
04/26/2022 02:57:41 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in wp-includes/class.wp-styles.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 $echo parameter to $display in WP_Styles class methods.

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], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283].

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

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwenty/inc/custom-css.php

    r53236 r53284  
    2020     * @param string $prefix   The CSS prefix.
    2121     * @param string $suffix   The CSS suffix.
    22      * @param bool   $display  Output the styles.
     22     * @param bool   $display  Print the styles.
    2323     */
    2424    function twentytwenty_generate_css( $selector, $style, $value, $prefix = '', $suffix = '', $display = true ) {
  • trunk/src/wp-content/themes/twentytwentyone/inc/custom-css.php

    r53236 r53284  
    1818 * @param string $prefix   The CSS prefix.
    1919 * @param string $suffix   The CSS suffix.
    20  * @param bool   $display  Output the styles.
     20 * @param bool   $display  Print the styles.
    2121 * @return string
    2222 */
  • trunk/src/wp-includes/class.wp-styles.php

    r52610 r53284  
    325325     * @since 3.3.0
    326326     *
    327      * @param string $handle The style's registered handle.
    328      * @param bool   $echo   Optional. Whether to echo the inline style
    329      *                       instead of just returning it. Default true.
    330      * @return string|bool False if no data exists, inline styles if `$echo` is true,
     327     * @param string $handle  The style's registered handle.
     328     * @param bool   $display Optional. Whether to print the inline style
     329     *                        instead of just returning it. Default true.
     330     * @return string|bool False if no data exists, inline styles if `$display` is true,
    331331     *                     true otherwise.
    332332     */
    333     public function print_inline_style( $handle, $echo = true ) {
     333    public function print_inline_style( $handle, $display = true ) {
    334334        $output = $this->get_data( $handle, 'after' );
    335335
     
    340340        $output = implode( "\n", $output );
    341341
    342         if ( ! $echo ) {
     342        if ( ! $display ) {
    343343            return $output;
    344344        }
Note: See TracChangeset for help on using the changeset viewer.