declarer = $declarer ?? static function ( string $feature, string $file, bool $compatible ): bool { $util = 'Automattic\\WooCommerce\\Utilities\\FeaturesUtil'; if ( ! class_exists( $util ) ) { return false; } return (bool) $util::declare_compatibility( $feature, $file, $compatible ); }; } /** * Hook the declarations. */ public function register(): void { add_action( 'before_woocommerce_init', array( $this, 'declare' ) ); } /** * Declare compatibility with each feature. */ public function declare(): void { foreach ( self::FEATURES as $feature ) { ( $this->declarer )( $feature, $this->plugin_file, true ); } } }