diff --git a/lib/block-supports/border.php b/lib/block-supports/border.php index 1a54371d082e1..bd4c772675a5e 100644 --- a/lib/block-supports/border.php +++ b/lib/block-supports/border.php @@ -142,7 +142,7 @@ function gutenberg_apply_border_support( $block_type, $block_attributes ) { */ function gutenberg_has_border_feature_support( $block_type, $feature, $default_value = false ) { // Check if all border support features have been opted into via `"__experimentalBorder": true`. - if ( property_exists( $block_type, 'supports' ) ) { + if ( $block_type instanceof WP_Block_Type ) { $block_type_supports_border = $block_type->supports['__experimentalBorder'] ?? $default_value; if ( true === $block_type_supports_border ) { return true; diff --git a/lib/block-supports/colors.php b/lib/block-supports/colors.php index 6919f58c067e4..80a0a2cf974df 100644 --- a/lib/block-supports/colors.php +++ b/lib/block-supports/colors.php @@ -12,7 +12,7 @@ */ function gutenberg_register_colors_support( $block_type ) { $color_support = false; - if ( property_exists( $block_type, 'supports' ) ) { + if ( $block_type instanceof WP_Block_Type ) { $color_support = $block_type->supports['color'] ?? false; } $has_text_colors_support = true === $color_support || diff --git a/lib/block-supports/typography.php b/lib/block-supports/typography.php index 5c051ee05cc2c..3cda86cf0a257 100644 --- a/lib/block-supports/typography.php +++ b/lib/block-supports/typography.php @@ -11,7 +11,7 @@ * @param WP_Block_Type $block_type Block Type. */ function gutenberg_register_typography_support( $block_type ) { - if ( ! property_exists( $block_type, 'supports' ) ) { + if ( ! $block_type instanceof WP_Block_Type ) { return; } @@ -76,7 +76,7 @@ function gutenberg_register_typography_support( $block_type ) { * @return array Typography CSS classes and inline styles. */ function gutenberg_apply_typography_support( $block_type, $block_attributes ) { - if ( ! property_exists( $block_type, 'supports' ) ) { + if ( ! $block_type instanceof WP_Block_Type ) { return array(); } diff --git a/lib/class-wp-duotone-gutenberg.php b/lib/class-wp-duotone-gutenberg.php index 270c13875787f..3395f98f09e7c 100644 --- a/lib/class-wp-duotone-gutenberg.php +++ b/lib/class-wp-duotone-gutenberg.php @@ -649,7 +649,7 @@ private static function get_global_styles_presets( $sources ) { private static function get_selector( $block_name ) { $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block_name ); - if ( $block_type && property_exists( $block_type, 'supports' ) ) { + if ( $block_type && $block_type instanceof WP_Block_Type ) { // Backwards compatibility with `supports.color.__experimentalDuotone` // is provided via the `block_type_metadata_settings` filter. If // `supports.filter.duotone` has not been set and the experimental @@ -747,7 +747,7 @@ private static function enqueue_global_styles_preset( $filter_id, $duotone_selec */ public static function register_duotone_support( $block_type ) { $has_duotone_support = false; - if ( property_exists( $block_type, 'supports' ) ) { + if ( $block_type instanceof WP_Block_Type ) { // Previous `color.__experimentalDuotone` support flag is migrated // to `filter.duotone` via `block_type_metadata_settings` filter. $has_duotone_support = $block_type->supports['filter']['duotone'] ?? null;