Skip to content

Extract CommonOptions, composed by analysis-running commands#655

Merged
fain182 merged 1 commit into
mainfrom
claude/application-class-design-d4dfes
Jul 17, 2026
Merged

Extract CommonOptions, composed by analysis-running commands#655
fain182 merged 1 commit into
mainfrom
claude/application-class-design-d4dfes

Conversation

@fain182

@fain182 fain182 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Improvement

Q A
New Feature no
BC Break no
Issue Prepares #648 and #649

Summary

First step of a three-PR series toward the *-baseline command family (#648, #649): a pure refactoring of check, with no behavior change.

The upcoming generate-baseline and prune-baseline commands 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(), and typed readers (configFilePath(), targetPhpVersion(), …) 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 object.

check's --help output is identical apart from option ordering; the whole test suite passes unchanged.

Series: this PR → add generate-baseline as a new command while keeping the old flag working (#648, additive) → turn check --generate-baseline into 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

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.29%. Comparing base (47201fd) to head (1508839).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             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              
Files with missing lines Coverage Δ
src/CLI/Command/Check.php 100.00% <100.00%> (ø)
src/CLI/Command/CommonOptions.php 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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
fain182 force-pushed the claude/application-class-design-d4dfes branch from 6ccec84 to 1508839 Compare July 17, 2026 13:53
@fain182 fain182 changed the title WIP: Promote --generate-baseline to a first-class generate-baseline command Extract CommonOptions, composed by analysis-running commands Jul 17, 2026
@fain182
fain182 marked this pull request as ready for review July 17, 2026 13:55
@fain182
fain182 merged commit 557c44b into main Jul 17, 2026
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants