Skip to content

Commit 79f439d

Browse files
laoneoHLeithner
andauthored
Remove extra reference assignment in plugin constructor for dispatcher argument (#40746)
--------- Co-authored-by: Harald Leithner <[email protected]>
1 parent 6d83587 commit 79f439d

File tree

133 files changed

+192
-333
lines changed

Some content is hidden

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

133 files changed

+192
-333
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Joomla\CMS\Table\Table;
1717
use Joomla\Database\DatabaseInterface;
1818
use Joomla\Database\QueryInterface;
19+
use Joomla\Event\DispatcherInterface;
1920
use Joomla\Utilities\ArrayHelper;
2021

2122
// phpcs:disable PSR1.Files.SideEffects
@@ -131,15 +132,15 @@ abstract class Adapter extends CMSPlugin
131132
/**
132133
* Method to instantiate the indexer adapter.
133134
*
134-
* @param object $subject The object to observe.
135-
* @param array $config An array that holds the plugin configuration.
135+
* @param DispatcherInterface $dispatcher The object to observe.
136+
* @param array $config An array that holds the plugin configuration.
136137
*
137138
* @since 2.5
138139
*/
139-
public function __construct(&$subject, $config)
140+
public function __construct(DispatcherInterface $dispatcher, array $config)
140141
{
141142
// Call the parent constructor.
142-
parent::__construct($subject, $config);
143+
parent::__construct($dispatcher, $config);
143144

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

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Joomla\CMS\Table\Table;
1616
use Joomla\Database\DatabaseInterface;
1717
use Joomla\Database\QueryInterface;
18+
use Joomla\Event\DispatcherInterface;
1819
use Joomla\Utilities\ArrayHelper;
1920

2021
/**
@@ -129,15 +130,15 @@ abstract class DebugAdapter extends CMSPlugin
129130
/**
130131
* Method to instantiate the indexer adapter.
131132
*
132-
* @param object $subject The object to observe.
133-
* @param array $config An array that holds the plugin configuration.
133+
* @param DispatcherInterface $dispatcher The object to observe.
134+
* @param array $config An array that holds the plugin configuration.
134135
*
135136
* @since 5.0.0
136137
*/
137-
public function __construct(&$subject, $config)
138+
public function __construct(DispatcherInterface $dispatcher, array $config)
138139
{
139140
// Call the parent constructor.
140-
parent::__construct($subject, $config);
141+
parent::__construct($dispatcher, $config);
141142

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

libraries/src/Plugin/CMSPlugin.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ abstract class CMSPlugin implements DispatcherAwareInterface, PluginInterface, L
9999
/**
100100
* Constructor
101101
*
102-
* @param DispatcherInterface &$subject The object to observe
103-
* @param array $config An optional associative array of configuration settings.
104-
* Recognized key values include 'name', 'group', 'params', 'language'
105-
* (this list is not meant to be comprehensive).
102+
* @param DispatcherInterface $dispatcher The event dispatcher
103+
* @param array $config An optional associative array of configuration settings.
104+
* Recognized key values include 'name', 'group', 'params', 'language'
105+
* (this list is not meant to be comprehensive).
106106
*
107107
* @since 1.5
108108
*/
109-
public function __construct(&$subject, $config = [])
109+
public function __construct(DispatcherInterface $dispatcher, array $config = [])
110110
{
111111
// Get the parameters.
112112
if (isset($config['params'])) {
@@ -153,7 +153,7 @@ public function __construct(&$subject, $config = [])
153153
}
154154

155155
// Set the dispatcher we are to register our listeners with
156-
$this->setDispatcher($subject);
156+
$this->setDispatcher($dispatcher);
157157
}
158158

159159
/**

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ public function register(Container $container)
3535
$container->set(
3636
PluginInterface::class,
3737
function (Container $container) {
38-
$dispatcher = $container->get(DispatcherInterface::class);
3938
$plugin = new Basic(
40-
$dispatcher,
39+
$container->get(DispatcherInterface::class),
4140
(array) PluginHelper::getPlugin('api-authentication', 'basic'),
4241
);
4342
$plugin->setApplication(Factory::getApplication());

plugins/authentication/cookie/services/provider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ public function register(Container $container)
3535
$container->set(
3636
PluginInterface::class,
3737
function (Container $container) {
38-
$dispatcher = $container->get(DispatcherInterface::class);
39-
4038
$plugin = new Cookie(
41-
$dispatcher,
39+
$container->get(DispatcherInterface::class),
4240
(array) PluginHelper::getPlugin('authentication', 'cookie')
4341
);
4442
$plugin->setApplication(Factory::getApplication());

plugins/authentication/joomla/services/provider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ public function register(Container $container)
3535
$container->set(
3636
PluginInterface::class,
3737
function (Container $container) {
38-
$dispatcher = $container->get(DispatcherInterface::class);
39-
4038
$plugin = new Joomla(
41-
$dispatcher,
39+
$container->get(DispatcherInterface::class),
4240
(array) PluginHelper::getPlugin('authentication', 'joomla')
4341
);
4442
$plugin->setApplication(Factory::getApplication());

plugins/authentication/ldap/services/provider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ public function register(Container $container)
3434
$container->set(
3535
PluginInterface::class,
3636
function (Container $container) {
37-
$dispatcher = $container->get(DispatcherInterface::class);
38-
3937
$plugin = new Ldap(
4038
new LdapFactory(),
41-
$dispatcher,
39+
$container->get(DispatcherInterface::class),
4240
(array) PluginHelper::getPlugin('authentication', 'ldap')
4341
);
4442
$plugin->setApplication(Factory::getApplication());

plugins/authentication/ldap/src/Extension/Ldap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Joomla\CMS\Authentication\Authentication;
1414
use Joomla\CMS\Log\Log;
1515
use Joomla\CMS\Plugin\CMSPlugin;
16-
use Joomla\Event\Dispatcher;
16+
use Joomla\Event\DispatcherInterface;
1717
use Joomla\Plugin\Authentication\Ldap\Factory\LdapFactoryInterface;
1818
use Symfony\Component\Ldap\Entry;
1919
use Symfony\Component\Ldap\Exception\ConnectionException;
@@ -50,7 +50,7 @@ final class Ldap extends CMSPlugin
5050
*
5151
* @since 4.3.0
5252
*/
53-
public function __construct(LdapFactoryInterface $factory, Dispatcher $dispatcher, $config = [])
53+
public function __construct(LdapFactoryInterface $factory, DispatcherInterface $dispatcher, array $config = [])
5454
{
5555
parent::__construct($dispatcher, $config);
5656

plugins/behaviour/taggable/services/provider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ public function register(Container $container)
3232
$container->set(
3333
PluginInterface::class,
3434
function (Container $container) {
35-
$dispatcher = $container->get(DispatcherInterface::class);
3635
$plugin = new Taggable(
37-
$dispatcher,
36+
$container->get(DispatcherInterface::class),
3837
(array) PluginHelper::getPlugin('behaviour', 'taggable')
3938
);
4039

plugins/behaviour/versionable/services/provider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ public function register(Container $container)
3535
$container->set(
3636
PluginInterface::class,
3737
function (Container $container) {
38-
$dispatcher = $container->get(DispatcherInterface::class);
3938
$plugin = new Versionable(
40-
$dispatcher,
39+
$container->get(DispatcherInterface::class),
4140
(array) PluginHelper::getPlugin('behaviour', 'versionable'),
4241
new InputFilter(),
4342
new CMSHelper()

0 commit comments

Comments
 (0)