Add config generator for discovering autowire-eligible classes - #78
Draft
Firehed wants to merge 6 commits into
Draft
Add config generator for discovering autowire-eligible classes#78Firehed wants to merge 6 commits into
Firehed wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #78 +/- ##
============================================
+ Coverage 82.00% 82.05% +0.04% - Complexity 207 225 +18
============================================
Files 27 28 +1 Lines 617 663 +46 ============================================
+ Hits 506 544 +38 - Misses 111 119 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Introduces a ConfigGenerator service that scans directories for classes with autowire-compatible constructors and generates container config files. Includes a CLI tool (bin/generate-config) for easy use. Requires composer/class-map-generator which is added as a dev dependency and listed in suggest for production use. Closes#77 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
These internal PHP types cannot meaningfully be registered in a container, so classes requiring them as constructor parameters should not be considered autowire-eligible. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Simplify ConfigGenerator by delegating to Autowire::isEligible() instead of duplicating the eligibility logic. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Firehedforce-pushed
the
77/config-generator
branch
from
March 14, 2026 17:16
41581c2 to
85389d6CompareWhen checking autowire eligibility, some classes may fail to load due to side effects or broken dependencies at include-time. Instead of crashing, we now catch these errors and collect them for reporting. The CLI displays warnings for any classes that couldn't be checked, showing the class name and error message. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Suppress PHP warnings/deprecations during class scanning - Include file path in error output for easier debugging - Move error output to end so it's more visible after the generated config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ConfigGeneratorservice that scans directories for classes with autowire-compatible constructorsbin/generate-config) for easy command-line usagecomposer/class-map-generatorfor class discovery (added as dev dependency and insuggest)Usage
CLI:
Programmatic:
Eligibility criteria
A class is considered autowire-eligible if:
ClosureorGeneratortyped paramsCloses#77
Test plan
🤖 Generated with Claude Code