roave/infection-static-analysis-plugin
Adds a wrapper around infection/infection that runs Psalm on generated mutants. Mutations that would cause type errors are marked killed, improving mutation score. Run vendor/bin/roave-infection-static-analysis-plugin; supports Infection args plus --psalm-config.
infection’s CLI binary, requiring minimal architectural changes. It hooks into Infection’s workflow without modifying core Laravel components, adhering to dependency inversion principles.composer require --dev roave/infection-static-analysis-plugin).vendor/bin/infection with vendor/bin/roave-infection-static-analysis-plugin.infection/infection:0.32.0), risking breakage if Laravel’s dev dependencies update. Mitigation:
composer.json (e.g., infection/infection:^0.32.0).Container).@psalm-suppress annotations) or exclude problematic paths.--only-tests flag).spatie/laravel-psalm) makes this plugin a natural extension.RefreshDatabase).composer require --dev infection/infection)../vendor/bin/infection.composer require --dev roave/infection-static-analysis-plugin.phpunit.xml, CI configs) to use roave-infection-static-analysis-plugin.--psalm-config=config/psalm.xml to CLI args.>90%).| Component | Compatibility | Mitigation |
|---|---|---|
| Laravel Version | All (8.0+) | Test with target Laravel version. |
| PHP Version | 8.1–8.5 (plugin supports 8.5; Laravel drops 8.1 in 11.x) | Pin PHP version in CI. |
| Infection Version | Pinned to 0.32.0 (check latest plugin release for updates) |
Lock version in composer.json. |
| Psalm/PHPStan | Psalm required (PHPStan planned for future) | Ensure Psalm is configured. |
| CI/CD Systems | GitHub Actions, GitLab CI, CircleCI (any CLI-compatible system) | Adjust timeout limits if needed. |
| Custom Laravel Code | May trigger false positives (e.g., dynamic method calls) | Use @psalm-suppress or exclude paths. |
infection/infection by removing the plugin and updating scripts.composer remove roave/infection-static-analysis-plugin to revert.psalm.xml) may need adjustments as Laravel’s codebase evolves (e.g., new type-hinted methods).composer update. Major updates may require testing.Container).--verbose flags for detailed logs.How can I help you explore Laravel packages today?