Skip to content

Commit f778b19

Browse files
authored
[5.4] Remove use of deprecated dispatcher from the plugin constructors (#45644)
* Remove use of deprecated dispatcher
1 parent 2ef3e3c commit f778b19

File tree

184 files changed

+172
-455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+172
-455
lines changed

administrator/components/com_finder/src/Indexer/Adapter.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,21 @@ abstract class Adapter extends CMSPlugin
131131
/**
132132
* Method to instantiate the indexer adapter.
133133
*
134-
* @param DispatcherInterface $dispatcher The object to observe.
135134
* @param array $config An array that holds the plugin configuration.
136135
*
137136
* @since 2.5
138137
*/
139-
public function __construct(DispatcherInterface $dispatcher, array $config)
138+
public function __construct($config)
140139
{
141140
// Call the parent constructor.
142-
parent::__construct($dispatcher, $config);
141+
if ($config instanceof DispatcherInterface) {
142+
$dispatcher = $config;
143+
$config = \func_num_args() > 1 ? func_get_arg(1) : [];
144+
145+
parent::__construct($dispatcher, $config);
146+
} else {
147+
parent::__construct($config);
148+
}
143149

144150
// Get the type id.
145151
$this->type_id = $this->getTypeId();

phpstan-baseline.neon

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17387,6 +17387,16 @@ parameters:
1738717387
count: 2
1738817388
path: plugins/content/confirmconsent/src/Field/ConsentBoxField.php
1738917389

17390+
-
17391+
message: '''
17392+
#^Call to deprecated method setDispatcher\(\) of class Joomla\\Plugin\\Content\\Finder\\Extension\\Finder\:
17393+
5\.2 will be removed in 7\.0
17394+
Plugin should implement DispatcherAwareInterface on its own, when it is needed\.$#
17395+
'''
17396+
identifier: method.deprecated
17397+
count: 1
17398+
path: plugins/content/finder/services/provider.php
17399+
1739017400
-
1739117401
message: '''
1739217402
#^Call to deprecated method getDispatcher\(\) of class Joomla\\Plugin\\Content\\Finder\\Extension\\Finder\:
@@ -17490,6 +17500,16 @@ parameters:
1749017500
count: 2
1749117501
path: plugins/editors/codemirror/layouts/editors/codemirror/codemirror.php
1749217502

17503+
-
17504+
message: '''
17505+
#^Call to deprecated method setDispatcher\(\) of class Joomla\\Plugin\\Editors\\CodeMirror\\Extension\\Codemirror\:
17506+
5\.2 will be removed in 7\.0
17507+
Plugin should implement DispatcherAwareInterface on its own, when it is needed\.$#
17508+
'''
17509+
identifier: method.deprecated
17510+
count: 1
17511+
path: plugins/editors/codemirror/services/provider.php
17512+
1749317513
-
1749417514
message: '''
1749517515
#^Call to deprecated method getDispatcher\(\) of class Joomla\\Plugin\\Editors\\CodeMirror\\Extension\\Codemirror\:
@@ -17500,6 +17520,16 @@ parameters:
1750017520
count: 1
1750117521
path: plugins/editors/codemirror/src/Extension/Codemirror.php
1750217522

17523+
-
17524+
message: '''
17525+
#^Call to deprecated method setDispatcher\(\) of class Joomla\\Plugin\\Editors\\None\\Extension\\None\:
17526+
5\.2 will be removed in 7\.0
17527+
Plugin should implement DispatcherAwareInterface on its own, when it is needed\.$#
17528+
'''
17529+
identifier: method.deprecated
17530+
count: 1
17531+
path: plugins/editors/none/services/provider.php
17532+
1750317533
-
1750417534
message: '''
1750517535
#^Call to deprecated method getDispatcher\(\) of class Joomla\\Plugin\\Editors\\None\\Extension\\None\:
@@ -17510,6 +17540,16 @@ parameters:
1751017540
count: 1
1751117541
path: plugins/editors/none/src/Extension/None.php
1751217542

17543+
-
17544+
message: '''
17545+
#^Call to deprecated method setDispatcher\(\) of class Joomla\\Plugin\\Editors\\TinyMCE\\Extension\\TinyMCE\:
17546+
5\.2 will be removed in 7\.0
17547+
Plugin should implement DispatcherAwareInterface on its own, when it is needed\.$#
17548+
'''
17549+
identifier: method.deprecated
17550+
count: 1
17551+
path: plugins/editors/tinymce/services/provider.php
17552+
1751317553
-
1751417554
message: '''
1751517555
#^Call to deprecated method getDispatcher\(\) of class Joomla\\Plugin\\Editors\\TinyMCE\\Extension\\TinyMCE\:
@@ -17723,6 +17763,16 @@ parameters:
1772317763
count: 2
1772417764
path: plugins/system/actionlogs/src/Extension/ActionLogs.php
1772517765

17766+
-
17767+
message: '''
17768+
#^Call to deprecated method setDispatcher\(\) of class Joomla\\Plugin\\System\\Cache\\Extension\\Cache\:
17769+
5\.2 will be removed in 7\.0
17770+
Plugin should implement DispatcherAwareInterface on its own, when it is needed\.$#
17771+
'''
17772+
identifier: method.deprecated
17773+
count: 1
17774+
path: plugins/system/cache/services/provider.php
17775+
1772617776
-
1772717777
message: '''
1772817778
#^Call to deprecated method getDispatcher\(\) of class Joomla\\Plugin\\System\\Cache\\Extension\\Cache\:
@@ -17926,6 +17976,16 @@ parameters:
1792617976
count: 1
1792717977
path: plugins/system/languagefilter/src/Extension/LanguageFilter.php
1792817978

17979+
-
17980+
message: '''
17981+
#^Call to deprecated method setDispatcher\(\) of class Joomla\\Plugin\\System\\Schemaorg\\Extension\\Schemaorg\:
17982+
5\.2 will be removed in 7\.0
17983+
Plugin should implement DispatcherAwareInterface on its own, when it is needed\.$#
17984+
'''
17985+
identifier: method.deprecated
17986+
count: 1
17987+
path: plugins/system/schemaorg/services/provider.php
17988+
1792917989
-
1793017990
message: '''
1793117991
#^Call to deprecated method getDispatcher\(\) of class Joomla\\Plugin\\System\\Schemaorg\\Extension\\Schemaorg\:
@@ -17936,6 +17996,16 @@ parameters:
1793617996
count: 4
1793717997
path: plugins/system/schemaorg/src/Extension/Schemaorg.php
1793817998

17999+
-
18000+
message: '''
18001+
#^Call to deprecated method setDispatcher\(\) of class Joomla\\Plugin\\System\\Shortcut\\Extension\\Shortcut\:
18002+
5\.2 will be removed in 7\.0
18003+
Plugin should implement DispatcherAwareInterface on its own, when it is needed\.$#
18004+
'''
18005+
identifier: method.deprecated
18006+
count: 1
18007+
path: plugins/system/shortcut/services/provider.php
18008+
1793918009
-
1794018010
message: '''
1794118011
#^Call to deprecated method getDispatcher\(\) of class Joomla\\Plugin\\System\\Shortcut\\Extension\\Shortcut\:

plugins/actionlog/joomla/services/provider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Joomla\Database\DatabaseInterface;
1818
use Joomla\DI\Container;
1919
use Joomla\DI\ServiceProviderInterface;
20-
use Joomla\Event\DispatcherInterface;
2120
use Joomla\Plugin\Actionlog\Joomla\Extension\Joomla;
2221

2322
return new class () implements ServiceProviderInterface {
@@ -36,7 +35,6 @@ public function register(Container $container)
3635
PluginInterface::class,
3736
function (Container $container) {
3837
$plugin = new Joomla(
39-
$container->get(DispatcherInterface::class),
4038
(array) PluginHelper::getPlugin('actionlog', 'joomla')
4139
);
4240
$plugin->setApplication(Factory::getApplication());

plugins/actionlog/joomla/src/Extension/Joomla.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use Joomla\Component\Actionlogs\Administrator\Plugin\ActionLogPlugin;
2525
use Joomla\Database\DatabaseAwareTrait;
2626
use Joomla\Database\Exception\ExecutionFailureException;
27-
use Joomla\Event\DispatcherInterface;
2827
use Joomla\Event\Event;
2928
use Joomla\Event\SubscriberInterface;
3029
use Joomla\Utilities\ArrayHelper;
@@ -78,14 +77,13 @@ final class Joomla extends ActionLogPlugin implements SubscriberInterface
7877
/**
7978
* Constructor.
8079
*
81-
* @param DispatcherInterface $dispatcher The dispatcher
8280
* @param array $config An optional associative array of configuration settings
8381
*
8482
* @since 3.9.0
8583
*/
86-
public function __construct(DispatcherInterface $dispatcher, array $config)
84+
public function __construct(array $config)
8785
{
88-
parent::__construct($dispatcher, $config);
86+
parent::__construct($config);
8987

9088
$params = ComponentHelper::getComponent('com_actionlogs')->getParams();
9189

plugins/api-authentication/basic/services/provider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Joomla\Database\DatabaseInterface;
1818
use Joomla\DI\Container;
1919
use Joomla\DI\ServiceProviderInterface;
20-
use Joomla\Event\DispatcherInterface;
2120
use Joomla\Plugin\ApiAuthentication\Basic\Extension\Basic;
2221

2322
return new class () implements ServiceProviderInterface {
@@ -36,7 +35,6 @@ public function register(Container $container)
3635
PluginInterface::class,
3736
function (Container $container) {
3837
$plugin = new Basic(
39-
$container->get(DispatcherInterface::class),
4038
(array) PluginHelper::getPlugin('api-authentication', 'basic'),
4139
);
4240
$plugin->setApplication(Factory::getApplication());

plugins/api-authentication/token/services/provider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Joomla\Database\DatabaseInterface;
1818
use Joomla\DI\Container;
1919
use Joomla\DI\ServiceProviderInterface;
20-
use Joomla\Event\DispatcherInterface;
2120
use Joomla\Filter\InputFilter;
2221
use Joomla\Plugin\ApiAuthentication\Token\Extension\Token;
2322

@@ -37,7 +36,6 @@ public function register(Container $container)
3736
PluginInterface::class,
3837
function (Container $container) {
3938
$plugin = new Token(
40-
$container->get(DispatcherInterface::class),
4139
(array) PluginHelper::getPlugin('api-authentication', 'token'),
4240
new InputFilter()
4341
);

plugins/api-authentication/token/src/Extension/Token.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Joomla\CMS\User\UserFactoryAwareTrait;
1818
use Joomla\Database\DatabaseAwareTrait;
1919
use Joomla\Database\ParameterType;
20-
use Joomla\Event\DispatcherInterface;
2120
use Joomla\Event\SubscriberInterface;
2221
use Joomla\Filter\InputFilter;
2322

@@ -74,15 +73,14 @@ public static function getSubscribedEvents(): array
7473
/**
7574
* Constructor.
7675
*
77-
* @param DispatcherInterface $dispatcher The dispatcher
7876
* @param array $config An optional associative array of configuration settings
7977
* @param InputFilter $filter The input filter
8078
*
8179
* @since 4.2.0
8280
*/
83-
public function __construct(DispatcherInterface $dispatcher, array $config, InputFilter $filter)
81+
public function __construct(array $config, InputFilter $filter)
8482
{
85-
parent::__construct($dispatcher, $config);
83+
parent::__construct($config);
8684

8785
$this->filter = $filter;
8886
}

plugins/authentication/cookie/services/provider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Joomla\Database\DatabaseInterface;
1818
use Joomla\DI\Container;
1919
use Joomla\DI\ServiceProviderInterface;
20-
use Joomla\Event\DispatcherInterface;
2120
use Joomla\Plugin\Authentication\Cookie\Extension\Cookie;
2221

2322
return new class () implements ServiceProviderInterface {
@@ -36,7 +35,6 @@ public function register(Container $container)
3635
PluginInterface::class,
3736
function (Container $container) {
3837
$plugin = new Cookie(
39-
$container->get(DispatcherInterface::class),
4038
(array) PluginHelper::getPlugin('authentication', 'cookie')
4139
);
4240
$plugin->setApplication(Factory::getApplication());

plugins/authentication/joomla/services/provider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Joomla\Database\DatabaseInterface;
1818
use Joomla\DI\Container;
1919
use Joomla\DI\ServiceProviderInterface;
20-
use Joomla\Event\DispatcherInterface;
2120
use Joomla\Plugin\Authentication\Joomla\Extension\Joomla;
2221

2322
return new class () implements ServiceProviderInterface {
@@ -36,7 +35,6 @@ public function register(Container $container)
3635
PluginInterface::class,
3736
function (Container $container) {
3837
$plugin = new Joomla(
39-
$container->get(DispatcherInterface::class),
4038
(array) PluginHelper::getPlugin('authentication', 'joomla')
4139
);
4240
$plugin->setApplication(Factory::getApplication());

plugins/authentication/ldap/services/provider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Joomla\CMS\Plugin\PluginHelper;
1616
use Joomla\DI\Container;
1717
use Joomla\DI\ServiceProviderInterface;
18-
use Joomla\Event\DispatcherInterface;
1918
use Joomla\Plugin\Authentication\Ldap\Extension\Ldap;
2019
use Joomla\Plugin\Authentication\Ldap\Factory\LdapFactory;
2120

@@ -36,7 +35,6 @@ public function register(Container $container)
3635
function (Container $container) {
3736
$plugin = new Ldap(
3837
new LdapFactory(),
39-
$container->get(DispatcherInterface::class),
4038
(array) PluginHelper::getPlugin('authentication', 'ldap')
4139
);
4240
$plugin->setApplication(Factory::getApplication());

0 commit comments

Comments
 (0)