From 1752d1da4e2e06286413eeed207632c2eae9b8d5 Mon Sep 17 00:00:00 2001 From: Nathanael Esayeas Date: Tue, 6 Feb 2024 12:55:15 -0600 Subject: [PATCH] Alias ContainerInterface Signed-off-by: Nathanael Esayeas --- src/Container.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Container.php b/src/Container.php index 1b23835..350140d 100644 --- a/src/Container.php +++ b/src/Container.php @@ -58,7 +58,9 @@ final class Container implements ContainerInterface /** * @var array */ - private array $aliases = []; + private array $aliases = [ + ContainerInterface::class => self::class, + ]; /** * @var array> @@ -114,10 +116,7 @@ private function __construct() $this->parameterBuilder = ParameterBuilder::new($this); - $this->instantiator = Instantiator::new( - $this->reflector, - $this->parameterBuilder - ); + $this->instantiator = Instantiator::new($this->reflector, $this->parameterBuilder); } /** @@ -400,6 +399,7 @@ public function factory(string $service, string $serviceFactory): void public function get(string $service): object { $class = $this->resolve($service); + if (is_a($service, ContainerInterface::class, true)) { return $this; }