diff --git a/src/DI/Loader/AbstractContainerLoader.php b/src/DI/Loader/AbstractContainerLoader.php index 1b05868c..5f123d06 100644 --- a/src/DI/Loader/AbstractContainerLoader.php +++ b/src/DI/Loader/AbstractContainerLoader.php @@ -27,14 +27,4 @@ protected function findControllers(): array return $this->builder->findByType(IController::class); } - /** - * @param ServiceDefinition[] $definitions - */ - protected function addDependencies(array $definitions): void - { - foreach ($definitions as $def) { - $this->builder->addDependency($def->getType()); - } - } - } diff --git a/src/DI/Loader/DoctrineAnnotationLoader.php b/src/DI/Loader/DoctrineAnnotationLoader.php index e059dd77..e4c16752 100644 --- a/src/DI/Loader/DoctrineAnnotationLoader.php +++ b/src/DI/Loader/DoctrineAnnotationLoader.php @@ -42,9 +42,6 @@ public function load(SchemaBuilder $builder): SchemaBuilder // Find all controllers by type (interface, annotation) $controllers = $this->findControllers(); - // Add controllers as dependencies to DIC - $this->addDependencies($controllers); - // Iterate over all controllers foreach ($controllers as $def) { $type = $def->getType(); diff --git a/tests/cases/DI/Loader/DoctrineAnnotationLoader.phpt b/tests/cases/DI/Loader/DoctrineAnnotationLoader.phpt index cab1535e..fa453455 100644 --- a/tests/cases/DI/Loader/DoctrineAnnotationLoader.phpt +++ b/tests/cases/DI/Loader/DoctrineAnnotationLoader.phpt @@ -18,7 +18,7 @@ use Tests\Fixtures\Controllers\InvalidGroupAnnotationController; use Tests\Fixtures\Controllers\InvalidGroupPathAnnotationController; use Tests\Fixtures\Controllers\PrefixedAnnotationController; -// Check if controller is found and add as dependency to DIC +// Check if controller is found test(function (): void { $builder = Mockery::mock(ContainerBuilder::class); $builder->shouldReceive('findByType') @@ -32,10 +32,6 @@ test(function (): void { return $controllers; }); - $builder->shouldReceive('addDependency') - ->once() - ->with(FoobarController::class); - $loader = new DoctrineAnnotationLoader($builder); $schemaBuilder = $loader->load(new SchemaBuilder());