-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
- Loading branch information
1 parent
d699d8e
commit 10aceb7
Showing
1 changed file
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,33 +247,33 @@ public function bind( | |
*/ | ||
public function build(string $service, array $arguments = []): object | ||
{ | ||
$class = $this->resolve($service); | ||
|
||
if (is_a($service, ContainerInterface::class, true)) { | ||
return $this; | ||
} | ||
|
||
$service = $this->resolve($service); | ||
|
||
if (array_key_exists($service, $this->dependencies)) { | ||
if (array_key_exists($class, $this->dependencies)) { | ||
throw new CircularDependencyException(sprintf( | ||
'Class: %s -> %s', | ||
implode(' -> ', array_keys($this->dependencies)), | ||
$service | ||
$class | ||
)); | ||
} | ||
|
||
$this->dependencies[$service] = true; | ||
$this->dependencies[$class] = true; | ||
Check warning on line 264 in src/Container.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
|
||
|
||
/** @var TService $instance */ | ||
$instance = $this->instantiator->instantiate($service, $arguments); | ||
$instance = $this->instantiator->instantiate($class, $arguments); | ||
|
||
$this->instances[$service] = $instance; | ||
$this->instances[$class] = $instance; | ||
|
||
if (array_key_exists($service, $this->dependencies)) { | ||
unset($this->dependencies[$service]); | ||
if (array_key_exists($class, $this->dependencies)) { | ||
unset($this->dependencies[$class]); | ||
} | ||
|
||
foreach (array_keys($this->extensions) as $serviceName) { | ||
if ($serviceName !== $service || ! is_a($instance, $serviceName, true)) { | ||
if ($serviceName !== $class || ! is_a($instance, $serviceName, true)) { | ||
Check warning on line 276 in src/Container.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
|
||
continue; | ||
Check warning on line 277 in src/Container.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
|
||
} | ||
|
||
|
@@ -282,7 +282,7 @@ public function build(string $service, array $arguments = []): object | |
} | ||
} | ||
|
||
return $this->instances[$service] = $instance; | ||
return $this->instances[$class] = $instance; | ||
} | ||
|
||
/** | ||
|