Extract CommonOptions, composed by analysis-running commands#655
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #655 +/- ##
============================================
+ Coverage 98.28% 98.29% +0.01%
- Complexity 719 724 +5
============================================
Files 89 90 +1
Lines 2038 2050 +12
============================================
+ Hits 2003 2015 +12
Misses 35 35
🚀 New features to boost your workflow:
|
The upcoming baseline commands (#648, #649) need the same --config, --target-php-version, --autoload and --ignore-baseline-linenumbers options as check. Defining them per command would let names, shortcuts, defaults and parsing drift apart, so they move to CommonOptions, a collaborator each command composes: addTo() defines the options in configure(), the typed readers parse them from the InputInterface. CommonOptions also owns requireAutoload(), the behavior attached to its autoload option — the require_once side effect stays in the command layer, out of the unit-testable handlers. Composition is deliberate (no base command class, no trait): commands keep their flat structure and the shared surface is an explicit, testable object. No behavior change; check's --help output is identical apart from option ordering. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015K1TKiwtwkW7twBCTz758P
fain182
force-pushed
the
claude/application-class-design-d4dfes
branch
from
July 17, 2026 13:53
6ccec84 to
1508839
Compare
fain182
marked this pull request as ready for review
July 17, 2026 13:55
This was referenced Jul 17, 2026
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 free
to 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.
Improvement
Summary
First step of a three-PR series toward the
*-baselinecommand family (#648, #649): a pure refactoring ofcheck, with no behavior change.The upcoming
generate-baselineandprune-baselinecommands need the same--config,--target-php-version,--autoloadand--ignore-baseline-linenumbersoptions ascheck. Defining them per command would let names, shortcuts, defaults and parsing drift apart, so they move toCommonOptions, a collaborator each command composes:addTo()defines the options inconfigure(), and typed readers (configFilePath(),targetPhpVersion(), …) parse them from theInputInterface.CommonOptionsalso ownsrequireAutoload(), the behavior attached to its autoload option — therequire_onceside effect stays in the command layer, out of the unit-testable handlers.Composition is deliberate (no base command class, no trait): commands keep their flat structure and the shared surface is an explicit object.
check's--helpoutput is identical apart from option ordering; the whole test suite passes unchanged.Series: this PR → add
generate-baselineas a new command while keeping the old flag working (#648, additive) → turncheck --generate-baselineinto a fail-fast pointer to the new command (#648, the only BC-breaking step, isolated for discussion).🤖 Generated with Claude Code
https://claude.ai/code/session_015K1TKiwtwkW7twBCTz758P