Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit 9b90fde

Browse files
samsonasikweierophinney
authored andcommitted
use PHP 5.5, remove $self = $this
1 parent b4e2bd2 commit 9b90fde

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/AbstractPluginManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ public function __construct(ConfigInterface $configuration = null)
6363
{
6464
parent::__construct($configuration);
6565
$self = $this;
66-
$this->addInitializer(function ($instance) use ($self) {
66+
$this->addInitializer(function ($instance) {
6767
if ($instance instanceof ServiceLocatorAwareInterface) {
68-
$instance->setServiceLocator($self);
68+
$instance->setServiceLocator($this);
6969
}
7070
});
7171
}

src/ServiceManager.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -610,12 +610,10 @@ public function create($name)
610610
*/
611611
private function createDelegatorCallback($delegatorFactory, $rName, $cName, $creationCallback)
612612
{
613-
$serviceManager = $this;
614-
615-
return function () use ($serviceManager, $delegatorFactory, $rName, $cName, $creationCallback) {
613+
return function () use ($delegatorFactory, $rName, $cName, $creationCallback) {
616614
return $delegatorFactory instanceof DelegatorFactoryInterface
617-
? $delegatorFactory->createDelegatorWithName($serviceManager, $cName, $rName, $creationCallback)
618-
: $delegatorFactory($serviceManager, $cName, $rName, $creationCallback);
615+
? $delegatorFactory->createDelegatorWithName($this, $cName, $rName, $creationCallback)
616+
: $delegatorFactory($this, $cName, $rName, $creationCallback);
619617
};
620618
}
621619

@@ -628,9 +626,8 @@ private function createDelegatorCallback($delegatorFactory, $rName, $cName, $cre
628626
* @return bool|mixed|null|object
629627
* @throws Exception\ServiceNotFoundException
630628
*
631-
* @internal this method is internal because of PHP 5.3 compatibility - do not explicitly use it
632629
*/
633-
public function doCreate($rName, $cName)
630+
protected function doCreate($rName, $cName)
634631
{
635632
$instance = null;
636633

@@ -1188,10 +1185,9 @@ protected function checkNestedContextStop($force = false)
11881185
*/
11891186
protected function createDelegatorFromFactory($canonicalName, $requestedName)
11901187
{
1191-
$serviceManager = $this;
11921188
$delegatorsCount = count($this->delegators[$canonicalName]);
1193-
$creationCallback = function () use ($serviceManager, $requestedName, $canonicalName) {
1194-
return $serviceManager->doCreate($requestedName, $canonicalName);
1189+
$creationCallback = function () use ($requestedName, $canonicalName) {
1190+
return $this->doCreate($requestedName, $canonicalName);
11951191
};
11961192

11971193
for ($i = 0; $i < $delegatorsCount; $i += 1) {
@@ -1220,7 +1216,7 @@ protected function createDelegatorFromFactory($canonicalName, $requestedName)
12201216
);
12211217
}
12221218

1223-
return $creationCallback($serviceManager, $canonicalName, $requestedName, $creationCallback);
1219+
return $creationCallback($this, $canonicalName, $requestedName, $creationCallback);
12241220
}
12251221

12261222
/**

0 commit comments

Comments
 (0)