Make WordPress Core


Ignore:
Timestamp:
02/09/2024 10:52:09 AM (3 years ago)
Author:
gziolo
Message:

Editor: Add wakeup magic method to the block bindings registry

See #60282.
Follow-up [57373].
Props dmsnell, mukesh27, gziolo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-bindings-registry.php

    r57562 r57575  
    213213
    214214        /**
     215         * Wakeup magic method.
     216         *
     217         * @since 6.5.0
     218         */
     219        public function __wakeup() {
     220                if ( ! $this->sources ) {
     221                        return;
     222                }
     223                if ( ! is_array( $this->sources ) ) {
     224                        throw new UnexpectedValueException();
     225                }
     226                foreach ( $this->sources as $value ) {
     227                        if ( ! $value instanceof WP_Block_Bindings_Source ) {
     228                                throw new UnexpectedValueException();
     229                        }
     230                }
     231        }
     232
     233        /**
    215234         * Utility method to retrieve the main instance of the class.
    216235         *
Note: See TracChangeset for help on using the changeset viewer.