@@ -1570,7 +1570,7 @@ public function get_custom_css() {
15701570 */
15711571 public function get_base_custom_css () {
15721572 _deprecated_function ( __METHOD__ , 'Gutenberg 18.6.0 ' , 'get_stylesheet ' );
1573- return isset ( $ this ->theme_json ['styles ' ]['css ' ] ) ? $ this -> theme_json [ ' styles ' ][ ' css ' ] : '' ;
1573+ return $ this ->theme_json ['styles ' ]['css ' ] ?? '' ;
15741574 }
15751575
15761576 /**
@@ -1586,9 +1586,7 @@ public function get_block_custom_css_nodes() {
15861586 // Add the global styles block CSS.
15871587 if ( isset ( $ this ->theme_json ['styles ' ]['blocks ' ] ) ) {
15881588 foreach ( $ this ->theme_json ['styles ' ]['blocks ' ] as $ name => $ node ) {
1589- $ custom_block_css = isset ( $ this ->theme_json ['styles ' ]['blocks ' ][ $ name ]['css ' ] )
1590- ? $ this ->theme_json ['styles ' ]['blocks ' ][ $ name ]['css ' ]
1591- : null ;
1589+ $ custom_block_css = $ this ->theme_json ['styles ' ]['blocks ' ][ $ name ]['css ' ] ?? null ;
15921590 if ( $ custom_block_css ) {
15931591 $ block_nodes [] = array (
15941592 'name ' => $ name ,
@@ -1632,8 +1630,8 @@ public function get_custom_templates() {
16321630 foreach ( $ this ->theme_json ['customTemplates ' ] as $ item ) {
16331631 if ( isset ( $ item ['name ' ] ) ) {
16341632 $ custom_templates [ $ item ['name ' ] ] = array (
1635- 'title ' => isset ( $ item ['title ' ] ) ? $ item [ ' title ' ] : '' ,
1636- 'postTypes ' => isset ( $ item ['postTypes ' ] ) ? $ item [ ' postTypes ' ] : array ( 'page ' ),
1633+ 'title ' => $ item ['title ' ] ?? '' ,
1634+ 'postTypes ' => $ item ['postTypes ' ] ?? array ( 'page ' ),
16371635 );
16381636 }
16391637 }
@@ -1656,8 +1654,8 @@ public function get_template_parts() {
16561654 foreach ( $ this ->theme_json ['templateParts ' ] as $ item ) {
16571655 if ( isset ( $ item ['name ' ] ) ) {
16581656 $ template_parts [ $ item ['name ' ] ] = array (
1659- 'title ' => isset ( $ item ['title ' ] ) ? $ item [ ' title ' ] : '' ,
1660- 'area ' => isset ( $ item ['area ' ] ) ? $ item [ ' area ' ] : '' ,
1657+ 'title ' => $ item ['title ' ] ?? '' ,
1658+ 'area ' => $ item ['area ' ] ?? '' ,
16611659 );
16621660 }
16631661 }
@@ -1723,7 +1721,7 @@ protected function get_layout_styles( $block_metadata, $options = array() ) {
17231721 }
17241722 }
17251723
1726- $ selector = isset ( $ block_metadata ['selector ' ] ) ? $ block_metadata [ ' selector ' ] : '' ;
1724+ $ selector = $ block_metadata ['selector ' ] ?? '' ;
17271725 $ has_block_gap_support = isset ( $ this ->theme_json ['settings ' ]['spacing ' ]['blockGap ' ] );
17281726 $ has_fallback_gap_support = ! $ has_block_gap_support ; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback gap styles support.
17291727 $ node = _wp_array_get ( $ this ->theme_json , $ block_metadata ['path ' ], array () );
@@ -2977,7 +2975,7 @@ static function ( $split_selector ) use ( $clean_style_variation_selector ) {
29772975 $ style_variation_declarations [ $ style_variation ['selector ' ] ] = static ::compute_style_properties ( $ style_variation_node , $ settings , null , $ this ->theme_json );
29782976
29792977 // Process pseudo-selectors for this variation (e.g., :hover, :focus).
2980- $ block_name = isset ( $ block_metadata ['name ' ] ) ? $ block_metadata [ ' name ' ] : ( in_array ( 'blocks ' , $ block_metadata ['path ' ], true ) && count ( $ block_metadata ['path ' ] ) >= 3 ? static ::get_block_name_from_metadata_path ( $ block_metadata ) : null );
2978+ $ block_name = $ block_metadata ['name ' ] ?? ( in_array ( 'blocks ' , $ block_metadata ['path ' ], true ) && count ( $ block_metadata ['path ' ] ) >= 3 ? static ::get_block_name_from_metadata_path ( $ block_metadata ) : null );
29812979 $ variation_pseudo_declarations = static ::process_pseudo_selectors ( $ style_variation_node , $ style_variation ['selector ' ], $ settings , $ block_name );
29822980 $ style_variation_declarations = array_merge ( $ style_variation_declarations , $ variation_pseudo_declarations );
29832981
@@ -3038,7 +3036,7 @@ static function ( $pseudo_selector ) use ( $selector ) {
30383036 )
30393037 );
30403038
3041- $ pseudo_selector = isset ( $ pseudo_matches [0 ] ) ? $ pseudo_matches [ 0 ] : null ;
3039+ $ pseudo_selector = $ pseudo_matches [0 ] ?? null ;
30423040
30433041 /*
30443042 * If the current selector is a pseudo selector that's defined in the allow list for the current
@@ -3055,7 +3053,7 @@ static function ( $pseudo_selector ) use ( $selector ) {
30553053 // For block pseudo-selectors, we need to get the block data first, then access the pseudo-selector.
30563054 $ block_name = static ::get_block_name_from_metadata_path ( $ block_metadata ); // 'core/button'
30573055 $ block_data = _wp_array_get ( $ this ->theme_json , array ( 'styles ' , 'blocks ' , $ block_name ), array () );
3058- $ pseudo_data = isset ( $ block_data [ $ block_pseudo_selector ] ) ? $ block_data [ $ block_pseudo_selector ] : array ();
3056+ $ pseudo_data = $ block_data [ $ block_pseudo_selector ] ?? array ();
30593057
30603058 $ declarations = static ::compute_style_properties ( $ pseudo_data , $ settings , null , $ this ->theme_json , $ selector , $ use_root_padding );
30613059 } else {
@@ -3198,9 +3196,9 @@ public function get_root_layout_rules( $selector, $block_metadata, $options = ar
31983196 * as custom properties on the body element so all blocks can use them.
31993197 */
32003198 if ( isset ( $ settings ['layout ' ]['contentSize ' ] ) || isset ( $ settings ['layout ' ]['wideSize ' ] ) ) {
3201- $ content_size = isset ( $ settings ['layout ' ]['contentSize ' ] ) ? $ settings [ ' layout ' ][ ' contentSize ' ] : $ settings ['layout ' ]['wideSize ' ];
3199+ $ content_size = $ settings ['layout ' ]['contentSize ' ] ?? $ settings ['layout ' ]['wideSize ' ];
32023200 $ content_size = static ::is_safe_css_declaration ( 'max-width ' , $ content_size ) ? $ content_size : 'initial ' ;
3203- $ wide_size = isset ( $ settings ['layout ' ]['wideSize ' ] ) ? $ settings [ ' layout ' ][ ' wideSize ' ] : $ settings ['layout ' ]['contentSize ' ];
3201+ $ wide_size = $ settings ['layout ' ]['wideSize ' ] ?? $ settings ['layout ' ]['contentSize ' ];
32043202 $ wide_size = static ::is_safe_css_declaration ( 'max-width ' , $ wide_size ) ? $ wide_size : 'initial ' ;
32053203 $ css .= static ::ROOT_CSS_PROPERTIES_SELECTOR . ' { --wp--style--global--content-size: ' . $ content_size . '; ' ;
32063204 $ css .= '--wp--style--global--wide-size: ' . $ wide_size . '; } ' ;
@@ -4652,8 +4650,8 @@ private static function convert_variables_to_value( $styles, $values ) {
46524650 $ fallback ,
46534651 ),
46544652 array (
4655- isset ( $ values [ $ key_in_values ] ) ? $ values [ $ key_in_values ] : $ rule_to_replace ,
4656- isset ( $ values [ $ fallback ] ) ? $ values [ $ fallback ] : $ fallback ,
4653+ $ values [ $ key_in_values ] ?? $ rule_to_replace ,
4654+ $ values [ $ fallback ] ?? $ fallback ,
46574655 ),
46584656 $ resolved_style
46594657 );
0 commit comments