Make WordPress Core


Ignore:
Timestamp:
09/29/2023 10:18:05 AM (2 years 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/colors.php

    r56709 r56742  
    1818function wp_register_colors_support( $block_type ) {
    1919    $color_support = false;
    20     if ( property_exists( $block_type, 'supports' ) ) {
     20    if ( $block_type instanceof WP_Block_Type ) {
    2121        $color_support = isset( $block_type->supports['color'] ) ? $block_type->supports['color'] : false;
    2222    }
Note: See TracChangeset for help on using the changeset viewer.