Skip to content

Commit e86772d

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53284 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 09237ef commit e86772d

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/wp-content/themes/twentytwenty/inc/custom-css.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @param string $value The CSS value.
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 ) {
2525

src/wp-content/themes/twentytwentyone/inc/custom-css.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @param string $value The CSS value.
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
*/
2323
function twenty_twenty_one_generate_css( $selector, $style, $value, $prefix = '', $suffix = '', $display = true ) {

src/wp-includes/class.wp-styles.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,13 @@ public function add_inline_style( $handle, $code ) {
324324
*
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

336336
if ( empty( $output ) ) {
@@ -339,7 +339,7 @@ public function print_inline_style( $handle, $echo = true ) {
339339

340340
$output = implode( "\n", $output );
341341

342-
if ( ! $echo ) {
342+
if ( ! $display ) {
343343
return $output;
344344
}
345345

0 commit comments

Comments
 (0)