Skip to content

Commit 2da24ad

Browse files
committed
Code Quality: Call process_blocks_custom_css() statically.
The `WP_Theme_JSON::process_blocks_custom_css()` method is declared static, yet three of its call sites invoked it through `$this` while the others already used `static::`. Behavior is unchanged, since both forms resolve the method with late static binding. In Gutenberg the same change, made in WordPress/gutenberg#87058, cleared the only errors of the `dynamicCallOnStaticMethod` rule from phpstan-strict-rules, so making it here keeps `WP_Theme_JSON` in sync with its Gutenberg counterpart. Developed in #16093. Follow-up to r55192, r58421. Props noruzzaman, westonruter. See #66739. git-svn-id: https://develop.svn.wordpress.org/trunk@65770 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5cb65d8 commit 2da24ad

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/wp-includes/class-wp-theme-json.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,7 +2283,7 @@ public function get_custom_css() {
22832283
$custom_block_css = $this->theme_json['styles']['blocks'][ $name ]['css'] ?? null;
22842284
if ( $custom_block_css ) {
22852285
$selector = static::$blocks_metadata[ $name ]['selector'];
2286-
$stylesheet .= $this->process_blocks_custom_css( $custom_block_css, $selector );
2286+
$stylesheet .= static::process_blocks_custom_css( $custom_block_css, $selector );
22872287
}
22882288
}
22892289
}
@@ -4202,7 +4202,7 @@ public function get_styles_for_block( $block_metadata ) {
42024202

42034203
// Store custom CSS for the style variation.
42044204
if ( isset( $style_variation_node['css'] ) ) {
4205-
$style_variation_custom_css[ $style_variation['selector'] ] = $this->process_blocks_custom_css( $style_variation_node['css'], $variation_css_selector );
4205+
$style_variation_custom_css[ $style_variation['selector'] ] = static::process_blocks_custom_css( $style_variation_node['css'], $variation_css_selector );
42064206
}
42074207

42084208
// Store variation metadata and node for layout styles generation.
@@ -4534,7 +4534,7 @@ static function ( $pseudo_selector ) use ( $selector ) {
45344534
// 7. Generate and append any custom CSS rules.
45354535
if ( isset( $node['css'] ) && ! $is_root_selector ) {
45364536
$css_selector = $css_feature_selector ?? $selector;
4537-
$block_rules .= $this->process_blocks_custom_css( $node['css'], $css_selector );
4537+
$block_rules .= static::process_blocks_custom_css( $node['css'], $css_selector );
45384538
}
45394539

45404540
// 8. Wrap the entire block output in a media query if this is a responsive node.

0 commit comments

Comments
 (0)