digitalrevolution/phpunit-file-coverage-inspection
Define per-file code coverage thresholds from Clover coverage.xml, with directory/file overrides and optional uncovered-method rules. Fails builds with checkstyle or GitLab formatted reports so a single file can’t hide behind high overall coverage.
--exit-code-on-failure).min="70" for src/Legacy/), then incrementally raising them.ignore-uncovered-methods for utility classes) while maintaining strict rules for high-impact areas.min="100".src/Api/ = 95%, src/Jobs/ = 85%).Adopt if:
Look elsewhere if:
*"This tool lets us enforce surgical precision in code quality—no more hiding under-covered critical files behind high-level metrics. By setting per-file coverage thresholds, we can:
*"This replaces vague ‘80% coverage’ goals with actionable, file-level enforcement. Key wins:
php vendor/bin/phpfci inspect coverage.xml --exit-code-on-failure
baseline command to temporarily lower thresholds for old code, then ramp up:
php vendor/bin/phpfci baseline old_coverage.xml --config phpfci.xml
<directory path="src/Core/" min="100"/>
<file path="src/Helpers/StringHelper.php" min="50"/>
Effort: 1–2 hours to configure. Impact: Fewer ‘oops’ in production, clearer quality standards."*
*"Tired of global coverage hiding your under-tested files? This tool:
src/Api/ = 95%, src/Jobs/ = 80%).composer.json:
composer require --dev digitalrevolution/phpunit-file-coverage-inspection
# .gitlab-ci.yml
test:
script:
- php vendor/bin/phpfci inspect coverage.xml --reportGitlab=gl-coverage.json
```"*
How can I help you explore Laravel packages today?