Better class-enforcing checking

This commit is contained in:
Claudiu Lodromanean 2017-03-01 08:58:03 -08:00
parent 2dd8ec743a
commit 65b98b77a3
1 changed files with 1 additions and 1 deletions

View File

@ -72,7 +72,7 @@ class WC_Data_Store {
if ( array_key_exists( $object_type, $this->stores ) ) {
$store = apply_filters( 'woocommerce_' . $object_type . '_data_store', $this->stores[ $object_type ] );
if ( is_object( $store ) ) {
if ( ! class_implements( $store, WC_Object_Data_Store_Interface::class ) ) {
if ( ! $store instanceof WC_Object_Data_Store_Interface ) {
throw new Exception( __( 'Invalid data store.', 'woocommerce' ) );
}
$this->current_class_name = get_class( $store );