From 83fc4e6d46ead018a31e3167948da2a6adc7bd79 Mon Sep 17 00:00:00 2001 From: Bart Jaskulski <bjaskulski@protonmail.com> Date: Tue, 13 Aug 2024 08:49:15 +0200 Subject: [PATCH] fix: improve compatibility with/without wp-builder Signed-off-by: Bart Jaskulski <bjaskulski@protonmail.com> --- src/Binding/Hookable.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Binding/Hookable.php b/src/Binding/Hookable.php index 3fb1e51..0ed2900 100644 --- a/src/Binding/Hookable.php +++ b/src/Binding/Hookable.php @@ -4,7 +4,15 @@ declare(strict_types=1); namespace WPDesk\Init\Binding; -interface Hookable extends \WPDesk\PluginBuilder\Plugin\Hookable { - - public function hooks(): void; +/** + * Operate in mode compatible with wp-builder library, as wp-init roots on it and needs to preserve the easy way to upgrade existing clients. + */ +if ( class_exists( \WPDesk\PluginBuilder\Plugin\Hookable::class ) ) { + interface Hookable extends \WPDesk\PluginBuilder\Plugin\Hookable { + public function hooks(): void; + } +} else { + interface Hookable { + public function hooks(): void; + } } -- GitLab