Skip to content

Commit

Permalink
Dynamic initializer discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed May 30, 2024
1 parent 6274903 commit 8f7ffcb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Discovery/InitializerDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use ReflectionClass;
use Tempest\Container\Container;
use Tempest\Container\DynamicInitializer;
use Tempest\Container\GenericContainer;
use Tempest\Container\Initializer;

Expand All @@ -20,9 +21,13 @@ public function __construct(

public function discover(ReflectionClass $class): void
{
if (! $class->isInstantiable()) {
return;
}

if (
! $class->isInstantiable()
|| ! $class->implementsInterface(Initializer::class)
! $class->implementsInterface(Initializer::class)
&& ! $class->implementsInterface(DynamicInitializer::class)
) {
return;
}
Expand Down

0 comments on commit 8f7ffcb

Please sign in to comment.