Skip to content

Assorted small clean-ups - #170

Merged
DaveLiddament merged 1 commit into
masterfrom
chore/small-cleanups
Nov 6, 2026
Merged

DaveLiddament merged 1 commit into
masterfrom
chore/small-cleanups

Conversation

@DaveLiddament

Copy link
Copy Markdown
Owner

A collection of small fixes from a codebase review — none change matching/baselining behaviour:

  • sarb remove is now a real alias of remove-baseline-results. The documented short form only worked via Symfony's unambiguous-abbreviation matching, so adding any future remove-* command would have silently broken every user's CI.
  • list-static-analysis-tools printed commands that fail — both the create and remove examples were missing the mandatory baseline-file argument (verified: copy/pasting them yields Not enough arguments).
  • --clean-up sampled from the wrong set — its help says "issues in the baseline to fix" but it sampled from all latest issues, including the brand-new ones just reported above it. Now samples from input-minus-pruned via a new PrunedResults::getBaseLinedResults().
  • sarb --version printed "Console Tool" — the application now has a name and a version (via Composer\InstalledVersions).
  • FqcnRemover::removeRqcn() → removeFqcn() (long-standing typo).
  • StringUtils::endsWith() removed — unused in src, subtly wrong for an empty needle, and PHP 8 has str_ends_with. (startsWith kept for now — it has many diff-parser callers and PR Fix git diff handling for non-default git configurations #162 touches those files.)
  • InvalidOutputFormatterException now extends SarbException — ErrorReporter's catch-all comment assumes every exception does; this was the only Domain exception outside the hierarchy.
  • Container hygiene — exceptions and Domain\Common value objects are excluded from the autowiring sweep, so a newly type-hinted value object fails at compile time instead of at runtime.
  • New phpat rule — Domain must not depend on Symfony (currently clean; the rule stops erosion).
  • PhpstanJsonResultsParser docblock corrected (claimed general errors are "ignored"; SARB actually stops with an error).

Conflicts with open PRs

Full composer ci passes (100% coverage, PHPStan max incl. the new phpat rule, cs-fixer).

- Rename FqcnRemover::removeRqcn() to removeFqcn() (typo).
- Remove StringUtils::endsWith(): unused in src, subtly wrong for an
  empty needle, and PHP 8 provides str_ends_with.
- Register 'remove' as a real alias of remove-baseline-results. The
  documented 'sarb remove' only worked via Symfony's unambiguous
  abbreviation matching, so adding any future remove-* command would
  have silently broken every user's CI.
- list-static-analysis-tools printed copy/paste commands that fail:
  both were missing the mandatory baseline-file argument.
- --clean-up now picks its random sample from the issues that matched
  the baseline, as its help text says, rather than from all the latest
  issues (which included the new ones just reported).
- Set the console application name and version: sarb --version printed
  'Console Tool'.
- InvalidOutputFormatterException now extends SarbException (the error
  reporter assumes all exceptions do).
- Exclude value objects and exceptions from the service container
  sweep, so a newly type hinted value object fails at container compile
  time rather than at runtime.
- Add an architecture rule: Domain must not depend on Symfony (it is
  currently clean; this stops erosion).
- Fix the PhpstanJsonResultsParser docblock which claimed PHPStan's
  general errors are ignored (SARB stops with an error).

Co-authored-by: Dave Liddament <dave.liddament@gmail.com>
@DaveLiddament
DaveLiddament merged commit 75e1167 into master Nov 6, 2026
12 checks passed
@DaveLiddament
DaveLiddament deleted the chore/small-cleanups branch November 6, 2026 14:47
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.

1 participant