From 8b40ab731ed70916acf31129303988355e572131 Mon Sep 17 00:00:00 2001 From: Tom Wright Date: Thu, 9 Nov 2023 17:32:23 +0000 Subject: [PATCH] Simplified ArchetypeResolve Initialization Signed-off-by: Tom Wright --- CHANGELOG.md | 2 ++ src/Handler.php | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a48d4d..20184f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Simplified ArchetypeResolve Initialization + ## v0.2.20 (2023-11-08) * Added unique option to register() * Added getResolvers() and getNormalizers() to Handler diff --git a/src/Handler.php b/src/Handler.php index 6d67683..9b4f935 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -409,7 +409,9 @@ protected function ensureResolver( string $interface ): void { if (!isset($this->resolvers[$interface])) { - if (!$class = $this->resolve(Resolver::class, $interface)) { + if ($interface === Resolver::class) { + $class = ArchetypeResolver::class; + } elseif (!$class = $this->resolve(Resolver::class, $interface)) { throw Exceptional::NotFound('Interface ' . $interface . ' has no Archetype resolver'); } @@ -422,6 +424,3 @@ protected function ensureResolver( // Register the Veneer facade Veneer::register(Handler::class, Archetype::class); - -// Load Archetype Resolver -Archetype::register(new ArchetypeResolver());