Skip to content

Commit

Permalink
Added interface Archetype dereferencing
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wright <[email protected]>
  • Loading branch information
betterthanclay committed Dec 13, 2023
1 parent 1b12683 commit aeffd22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Added interface Archetype dereferencing

## v0.1.4 (2023-11-27)
* Improved type resolution stack ordering

Expand Down
11 changes: 7 additions & 4 deletions src/Slingshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
namespace DecodeLabs;

use Closure;
use DecodeLAbs\Dovetail;
use DecodeLabs\Pandora\Container as PandoraContainer;
use Psr\Container\ContainerInterface as Container;
use ReflectionClass;
Expand Down Expand Up @@ -580,9 +579,13 @@ public function newInstance(
array $parameters = []
): object {
if (!class_exists($class)) {
throw Exceptional::Logic(
'Class ' . $class . ' does not exist'
);
if (!interface_exists($class)) {
throw Exceptional::Logic(
'Class ' . $class . ' does not exist'
);
}

$class = Archetype::resolve($class);
}

$ref = new ReflectionClass($class);
Expand Down

0 comments on commit aeffd22

Please sign in to comment.