From 11eff7bbb6fcafded623d0ef7f87a0a61ce3d586 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:36:53 +0000 Subject: [PATCH 1/4] Initial plan From ada586ee82e90df9df972aec34949cce6bc8b99b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:39:56 +0000 Subject: [PATCH 2/4] Improve DI fallback: catch specific exception and add logging Co-authored-by: ArnaudLigny <80580+ArnaudLigny@users.noreply.github.com> --- src/Builder.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Builder.php b/src/Builder.php index 9d8ec570a..27e2f4db7 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -19,6 +19,7 @@ use Cecil\Generator\GeneratorManager; use Cecil\Logger\PrintLogger; use DI\Container; +use DI\NotFoundException; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Finder\Finder; @@ -280,11 +281,18 @@ public function build(array $options): self $steps = []; // init... foreach (self::STEPS as $step) { - // Use DI container to create steps + // Use DI container to create steps with dependency injection. + // All steps defined in config/dependencies.php should be resolved from the container. + // Falls back to direct instantiation only if a step is not registered in the container. try { $stepObject = $this->container->get($step); - } catch (\Exception $e) { + } catch (NotFoundException $e) { // Fallback for steps not declared in the container + // This should rarely happen as all steps in STEPS constant are defined in config/dependencies.php + $this->getLogger()->warning(\sprintf( + 'Step %s not found in DI container, using direct instantiation as fallback', + $step + )); $stepObject = new $step($this); } $stepObject->init($this->options); From 077b4bbb5f10053599ce365b22471223ac03a900 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:41:47 +0000 Subject: [PATCH 3/4] Fix Parsedown DI config to explicitly inject Builder Co-authored-by: ArnaudLigny <80580+ArnaudLigny@users.noreply.github.com> --- config/dependencies.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/dependencies.php b/config/dependencies.php index ec38e514f..3aea3da68 100644 --- a/config/dependencies.php +++ b/config/dependencies.php @@ -25,6 +25,7 @@ */ // Parsedown: injects Config and Builder \Cecil\Converter\Parsedown::class => autowire() + ->constructorParameter('builder', get(\Cecil\Builder::class)) ->constructorParameter('config', get(\Cecil\Config::class)) ->constructorParameter('options', null), // Converter: automatically injects Parsedown From b49f74a9f0afd213e83402e7b5c5f4b23b641be4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:42:36 +0000 Subject: [PATCH 4/4] Address code review feedback: improve comments and remove unnecessary namespace prefix Co-authored-by: ArnaudLigny <80580+ArnaudLigny@users.noreply.github.com> --- src/Builder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Builder.php b/src/Builder.php index 27e2f4db7..f9e651cfc 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -282,14 +282,14 @@ public function build(array $options): self // init... foreach (self::STEPS as $step) { // Use DI container to create steps with dependency injection. - // All steps defined in config/dependencies.php should be resolved from the container. + // All steps defined in the DI container configuration should be resolved from the container. // Falls back to direct instantiation only if a step is not registered in the container. try { $stepObject = $this->container->get($step); } catch (NotFoundException $e) { // Fallback for steps not declared in the container - // This should rarely happen as all steps in STEPS constant are defined in config/dependencies.php - $this->getLogger()->warning(\sprintf( + // This should rarely happen as all steps in STEPS constant are defined in the DI container configuration + $this->getLogger()->warning(sprintf( 'Step %s not found in DI container, using direct instantiation as fallback', $step ));