Skip to content

Add Psalm cross-check alongside PHPStan#56

Merged
mmucklo merged 1 commit intomasterfrom
quality/psalm
Apr 20, 2026
Merged

Add Psalm cross-check alongside PHPStan#56
mmucklo merged 1 commit intomasterfrom
quality/psalm

Conversation

@mmucklo
Copy link
Copy Markdown
Owner

@mmucklo mmucklo commented Apr 20, 2026

Summary

Adds Psalm level 3 as a secondary static-analysis tool alongside PHPStan level 8. Both are now green.

Findings

Psalm found no genuinely new bugs that PHPStan level 8 missed. All 66 baseline entries are:

Category Count Status
PossiblyUnusedMethod (public API) 48 False positive — Psalm only scans src/, not test callers
PossiblyUndefinedArrayOffset 7 False positive — buildEmailAddressArray() initializes all keys
TypeDoesNotContainType / RedundantCondition 5 Duplicate of PHPStan baseline (state-machine tautologies)
UnusedFunctionCall (mb_regex_encoding) 2 Save/restore pattern; return value intentionally unused
PossiblyInvalidCast/Argument 2 str_replace return on typed-string input; false positive
MissingOverrideAttribute 1 PHP 8.3+ only; not applicable at ^8.1
InvalidScalarArgument 1 mb_regex_encoding($origEncoding) type — already guarded

Value: cross-check safety net. New code that triggers a Psalm error outside the baseline will surface during review even if PHPStan doesn't flag it.

Also

Dependabot alert #1 (PHPUnit GHSA-qrr6-mg7r-m243) dismissed as tolerable risk: dev-only dependency, vulnerability requires process-isolation mode which we don't use, fix requires PHP 8.3+ which would drop our 8.1/8.2 support.

New files

  • psalm.xml — level 3, scans src/
  • psalm-baseline.xml — 66 entries
  • composer psalm script

Test plan

  • composer ci passes (84 tests / 3,271 assertions)
  • composer psalm passes with zero errors above baseline
  • composer stan still passes at level 8

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.11%. Comparing base (2450702) to head (beef412).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #56      +/-   ##
============================================
+ Coverage     92.80%   93.11%   +0.30%     
  Complexity      382      382              
============================================
  Files             6        6              
  Lines           987      987              
============================================
+ Hits            916      919       +3     
+ Misses           71       68       -3     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mmucklo mmucklo force-pushed the quality/psalm branch 4 times, most recently from 6441c31 to 4a1b302 Compare April 20, 2026 07:55
Psalm level 3 with a 66-entry baseline. All findings are either false
positives (PossiblyUnusedMethod for public API methods Psalm can't see
callers for), duplicates of existing PHPStan baseline entries
(TypeDoesNotContainType, RedundantCondition for state-machine tautologies),
or already-handled edge cases (mb_regex_encoding return type).

Found no genuinely new bugs that PHPStan level 8 missed. Value is as a
cross-check: new code that triggers a Psalm error outside the baseline
will surface during review even if PHPStan doesn't flag it.

Also dismisses Dependabot alert #1 (PHPUnit GHSA-qrr6-mg7r-m243) as
tolerable risk: dev-only dependency, vulnerability requires process
isolation mode which we don't use, fix requires PHP 8.3+ which would
drop our 8.1/8.2 support, no backport to PHPUnit 9.x.

New: composer psalm script, psalm.xml config, psalm-baseline.xml.
ROADMAP: Psalm item flipped to [x].
@mmucklo mmucklo merged commit 7fd7790 into master Apr 20, 2026
11 checks passed
@mmucklo mmucklo deleted the quality/psalm branch April 20, 2026 09:32
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