Skip to content

fix: use DI container to instantiate layout components#29

Merged
markshust merged 1 commit intodevelopfrom
feature/layout-processor-di
Apr 14, 2026
Merged

fix: use DI container to instantiate layout components#29
markshust merged 1 commit intodevelopfrom
feature/layout-processor-di

Conversation

@markshust
Copy link
Copy Markdown
Collaborator

Summary

  • LayoutProcessor was using new $className() to create component instances, bypassing the DI container
  • Any component with constructor dependencies (like a repository) would fail with "Too few arguments"
  • Now injects ContainerInterface and uses $container->get() so dependencies are auto-resolved
  • Extracted shared test stub container to Helpers.php to keep tests DRY

Test plan

  • All 124 layout package tests passing
  • Existing component rendering behavior unchanged (zero-arg components still work)
  • Stub container extracted to shared helper, used by both processor test files

🤖 Generated with Claude Code

LayoutProcessor was using `new $className()` which bypasses the DI
container, breaking any component with constructor dependencies.
Now injects ContainerInterface and uses `$container->get()` so
component dependencies (like repositories) are auto-resolved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@markshust markshust merged commit cd89269 into develop Apr 14, 2026
1 check passed
@github-actions github-actions Bot added the bug Something isn't working label Apr 14, 2026
@markshust markshust deleted the feature/layout-processor-di branch April 14, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant