Skip to content

Migrate to PHPStan, inline code-quality-pack deps, add Infection & tests#7

Merged
loevgaard merged 3 commits into
masterfrom
chore/phpstan-infection-tooling
Jun 15, 2026
Merged

Migrate to PHPStan, inline code-quality-pack deps, add Infection & tests#7
loevgaard merged 3 commits into
masterfrom
chore/phpstan-infection-tooling

Conversation

@loevgaard

Copy link
Copy Markdown
Member

Summary

Reworks the dev tooling and test suite while keeping PHP >= 8.1 support.

Keep PHP >= 8.1

  • composer.json still requires "php": ">=8.1".
  • PHPUnit held at ^10.5 (PHPUnit 11 needs 8.2); Infection pinned to ^0.27 || ^0.28 (0.29+ needs 8.2).
  • PHPStan analyzes against the full 8.1–8.4 range (phpVersion.min/max).

Inline latest code-quality-pack deps

  • Replaced setono/code-quality-pack with its individual v3.4.0 tools in require-dev: PHPStan + doctrine/symfony/phpunit/strict-rules/webmozart extensions, jangregor/phpstan-prophecy, Rector 2, sylius-labs/coding-standard 4.5, ergebnis/composer-normalize, shipmonk/composer-dependency-analyser, Infection, phpspec/prophecy-phpunit.
  • Added phpspec/prophecy directly (the new tests use Prophecy\Argument, flagged by the dependency analyser).

Replace Psalm with PHPStan

  • Deleted psalm.xml, added phpstan.neon.dist (level: max, extensions auto-loaded via phpstan/extension-installer).
  • Removed all @psalm-suppress annotations and fixed the underlying issues (explicit nullable types, generic phpdoc on the Doctrine event arg, aligned entity metadata types to upstream setono/client v1.1.2).
  • One narrow, documented ignore remains for the Symfony LazyGhostTrait __construct() idiom.
  • Updated rector.php to the Rector 2 API; CI now runs phpstan instead of psalm.

Add missing tests

  • From 3 to 16 test files / 49 tests / 105 assertions, covering every previously-untested class.
  • Calibrated with Infection to 100% MSI and 100% mutation code coverage; added a CI mutation-testing job gating at --min-msi=100 --min-covered-msi=100.

Misc

  • Bumped LICENSE copyright year to 2026.

Test plan

  • composer analyse (PHPStan) ✅
  • composer phpunit (49 tests) ✅
  • composer check-style (ECS) ✅
  • vendor/bin/composer-dependency-analyser
  • vendor/bin/rector process --dry-run (clean) ✅
  • composer validate --strict / composer normalize --dry-run
  • composer infection (100% MSI) ✅

Note: on PHP 8.4, the transitive dev dep thecodingmachine/safe emits E_DEPRECATED notices that break Infection's initial run (absent on CI's 8.1/8.2). Run locally with --initial-tests-php-options="-d error_reporting=24575". Documented in CLAUDE.md.

- Keep PHP >=8.1 (hold PHPUnit at ^10.5; pin Infection to ^0.27 || ^0.28)
- Replace setono/code-quality-pack meta-package with its individual latest
  deps (PHPStan stack, Rector 2, sylius-labs/coding-standard, shipmonk
  analyser, ergebnis normalize, Infection, prophecy)
- Replace Psalm with PHPStan (level max, phpVersion 8.1-8.4); remove
  psalm.xml and @psalm-suppress annotations, fixing the underlying issues
- Update rector.php to the Rector 2 API; update CI (psalm->phpstan, add
  mutation-testing job)
- Add tests for previously-untested classes: 100% MSI / 100% mutation
  code coverage (49 tests)
- Bump LICENSE copyright year to 2026
Comment thread phpstan.neon.dist Outdated
…rices resolve

Composer 2.10 blocks installing package versions with active security
advisories during update. That breaks the --prefer-lowest jobs and the
EOL Symfony ~7.0.0 matrix (all 7.0.x http-foundation releases carry
advisories), which must install old versions by design. Set
config.policy.advisories.block=false (root-only, affects this repo's CI
only).
@loevgaard loevgaard merged commit ffd7403 into master Jun 15, 2026
18 checks passed
@loevgaard loevgaard deleted the chore/phpstan-infection-tooling branch June 15, 2026 12:36
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