diff --git a/migrations/44-50/new-deprecations.md b/migrations/44-50/new-deprecations.md index 3fff1a43..9abb5111 100644 --- a/migrations/44-50/new-deprecations.md +++ b/migrations/44-50/new-deprecations.md @@ -10,3 +10,22 @@ All the new deprecations that should be aware of and what you should now be usin This page is unfinished, please use the **Edit this Page** link at the bottom of this page to help make it more useful. ::: + +### Joomla\CMS\Extension\PluginInterface to no longer extend Joomla\Event\DispatcherAwareInterface +In 6.0 `Joomla\CMS\Extension\PluginInterface` will no longer extend `Joomla\Event\DispatcherAwareInterface`. An instance of `Joomla\Event\DispatcherInterface` must be passed to `Joomla\CMS\Extension\PluginInterface::registerListeners()` instead. This applies to the `Joomla\CMS\Plugin\CMSPlugin` implementation too. + +### Joomla\CMS\Plugin\CMSPlugin::__construct() to longer accept an instance of Joomla\Event\DispatcherInterface +In 6.0 passing an instance of `Joomla\Event\DispatcherInterface` as the first argument to `Joomla\CMS\Plugin\CMSPlugin::__construct()` will not be supported. An instance of `Joomla\Event\DispatcherInterface` must be passed to `Joomla\CMS\Plugin\CMSPlugin::registerListeners()` instead. + +### Joomla\CMS\Plugin\CMSPlugin::registerLegacyListener() and Joomla\CMS\Plugin\CMSPlugin::registerListeners() deprecated +`Joomla\CMS\Plugin\CMSPlugin::registerLegacyListener()` and `Joomla\CMS\Plugin\CMSPlugin::registerListener()` methods are deprecated and will be removed in 6.0. Listeners must be registered with the event dispatcher in the `registerListeners()` method. + +### Joomla\CMS\Plugin\PluginHelper::importPlugin() signature change +In 6.0 the fourth argument of `Joomla\CMS\Plugin\PluginHelper::importPlugin()` will no longer be optional and will require an instance of `Joomla\Event\DispatcherInterface`. Therefore, preceding arguments will become mandatory. Method calls must be updated accordingly, for example: + +```php +Joomla\CMS\Plugin\PluginHelper::importPlugin('system', null, true, $dispatcher); +``` + +### Joomla\CMS\Plugin\PluginHelper::import() signature change +In 6.0 the third argument of `Joomla\CMS\Plugin\PluginHelper::import()` will not longer be optional and will require an instance of `Joomla\Event\DispatcherInterface`. Therefore, preceding arguments will become mandatory. diff --git a/migrations/44-50/removed-backward-incompatibility.md b/migrations/44-50/removed-backward-incompatibility.md index 7944c5d0..e0fa68db 100644 --- a/migrations/44-50/removed-backward-incompatibility.md +++ b/migrations/44-50/removed-backward-incompatibility.md @@ -37,3 +37,17 @@ class MyModel extends ListModel { ### CSS removals The CSS class ".ie11" was removed [via PR #39018](https://github.com/joomla/joomla-cms/pull/39018) + +### Joomla\CMS\Extension\PluginInterface::registerListeners() signature change +`Joomla\CMS\Extension\PluginInterface::registerListeners()` method signature has been changed to accept an instance of `Joomla\Event\DispatcherInterface`. The argument is made optional to allow plugin developers to easily support both 4.0 and 5.0. It will become mandatory in 6.0. + +The signature in implementations must be changed accordingly: +```php +class MyPlugin implements \Joomla\CMS\Extension\PluginInterface +{ + public function registerListeners(?\Joomla\Event\DispatcherInterface $dispatcher = null) + { + // Register listeners with the event dispatcher. + } +} +```