Make WordPress Core


Ignore:
Timestamp:
09/29/2023 10:18:05 AM (18 months ago)
Author:
spacedmonkey
Message:

Editor: Replace property_exists calls in block related functions with instanceof

Replace calls to property_exists with instanceof WP_Block_Type in block related functions. This change not only improves type safety but also enhances performance.

Follow on from [56678] and [56677].

Props gziolo, aristath, aaronrobertshaw, spacedmonkey.
Fixes #59453

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/border.php

    r56709 r56742  
    153153function wp_has_border_feature_support( $block_type, $feature, $default_value = false ) {
    154154    // Check if all border support features have been opted into via `"__experimentalBorder": true`.
    155     if ( property_exists( $block_type, 'supports' ) ) {
     155    if ( $block_type instanceof WP_Block_Type ) {
    156156        $block_type_supports_border = isset( $block_type->supports['__experimentalBorder'] )
    157157            ? $block_type->supports['__experimentalBorder']
Note: See TracChangeset for help on using the changeset viewer.