diff --git a/libraries/src/Extension/PluginInterface.php b/libraries/src/Extension/PluginInterface.php index 9ac414a7d869c..5c56d9d73c0e5 100644 --- a/libraries/src/Extension/PluginInterface.php +++ b/libraries/src/Extension/PluginInterface.php @@ -30,6 +30,10 @@ interface PluginInterface extends DispatcherAwareInterface * @return void * * @since 4.0.0 + * + * @deprecated __DEPLOY_VERSION__ will be removed in 7.0 + * Plugin should implement SubscriberInterface. + * These plugins will be added to dispatcher in PluginHelper::import(). */ public function registerListeners(); } diff --git a/libraries/src/Plugin/CMSPlugin.php b/libraries/src/Plugin/CMSPlugin.php index 37a93a302106d..61475104b4f30 100644 --- a/libraries/src/Plugin/CMSPlugin.php +++ b/libraries/src/Plugin/CMSPlugin.php @@ -222,6 +222,10 @@ public function loadLanguage($extension = '', $basePath = JPATH_ADMINISTRATOR) * @return void * * @since 4.0.0 + * + * @deprecated __DEPLOY_VERSION__ will be removed in 7.0 + * Plugin should implement SubscriberInterface. + * These plugins will be added to dispatcher in PluginHelper::import(). */ public function registerListeners() { @@ -232,6 +236,8 @@ public function registerListeners() return; } + @trigger_error('The plugin should implement SubscriberInterface.', \E_USER_DEPRECATED); + $reflectedObject = new \ReflectionObject($this); $methods = $reflectedObject->getMethods(\ReflectionMethod::IS_PUBLIC); @@ -287,6 +293,9 @@ public function registerListeners() * @return void * * @since 4.0.0 + * + * @deprecated __DEPLOY_VERSION__ will be removed in 7.0 + * Plugin should implement SubscriberInterface. */ final protected function registerLegacyListener(string $methodName) { @@ -335,6 +344,9 @@ function (AbstractEvent $event) use ($methodName) { * @return void * * @since 4.0.0 + * + * @deprecated __DEPLOY_VERSION__ will be removed in 7.0 + * Plugin should implement SubscriberInterface. */ final protected function registerListener(string $methodName) { @@ -349,6 +361,9 @@ final protected function registerListener(string $methodName) * @return boolean * * @since 4.0.0 + * + * @deprecated __DEPLOY_VERSION__ will be removed in 7.0 + * Plugin should implement SubscriberInterface. */ private function parameterImplementsEventInterface(\ReflectionParameter $parameter): bool { diff --git a/libraries/src/Plugin/PluginHelper.php b/libraries/src/Plugin/PluginHelper.php index b2681071f3282..08ac384b26d83 100644 --- a/libraries/src/Plugin/PluginHelper.php +++ b/libraries/src/Plugin/PluginHelper.php @@ -239,6 +239,7 @@ protected static function import($plugin, $autocreate = true, ?DispatcherInterfa return; } + // @TODO: Starting from 7.0 it should use $dispatcher->addSubscriber($plugin); for plugins which implement SubscriberInterface. $plugin->registerListeners(); }