Ignore ProtectedVisibility on ClockSensitive PHPUnit hooks#26
Merged
paulbalandan merged 1 commit into1.xfrom May 4, 2026
Merged
Ignore ProtectedVisibility on ClockSensitive PHPUnit hooks#26paulbalandan merged 1 commit into1.xfrom
paulbalandan merged 1 commit into1.xfrom
Conversation
The `saveClock` and `restoreClock` methods in the `ClockSensitive` trait are invoked by PHPUnit via `#[Before]` and `#[After]` attributes, so visibility does not affect their invocation. PHPUnit's per-test line coverage (with either Xdebug or PCOV) does not record attribute or method-signature lines, so infection cannot link any test to those lines and reports the mutants as "Not Covered" — `--with-uncovered` only generates them, it does not run tests against them. The full test suite would actually catch the mutation (changing visibility to `private` causes 41 errors), but infection cannot reach those tests for these specific lines. Add the entry to `InfectionConfigBuilder::PER_MUTATOR_IGNORE` and regenerate `infection.json5` via `bin/build-infection`, matching the existing pattern used for other false-positive mutators.
f232a9b to
b48f5cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mutation Testsworkflow has been failing every night since 2026-04-26 (runs #52 through #60). MSI was 99.56% (below the required 100%) due to twoProtectedVisibilitymutants escaping insrc/Nexus/Clock/Extension/ClockSensitive.php—saveClock(line 29) andrestoreClock(line 35).#[Before]/#[After]hooks invoked via reflection, soprotectedvsprivateis invisible at the call site. PHPUnit's per-test line coverage (with either Xdebug or PCOV) does not record attribute or method-signature lines, so infection cannot link any test to those lines and reports the mutants as "Not Covered" —--with-uncoveredonly generates them, it does not run tests against them. (The full test suite would actually catch the mutation: changing visibility toprivatecauses 41 errors when runningphpunit --group=unit-test.)ProtectedVisibilityentry toInfectionConfigBuilder::PER_MUTATOR_IGNOREfor these two methods, then regenerateinfection.json5viabin/build-infection. This matches the existing pattern used for other false-positive mutators (AssignCoalesce,LogicalAnd,LogicalNot,ReturnRemoval, etc.). After this change, infection reports MSI 100% / Covered Code MSI 100% locally.Test plan
composer test:unit— 319 tests passcomposer test:auto-review—InfectionConfigTest::testInfectionJsonIsUpdatedconfirmsinfection.json5is in sync withInfectionConfigBuildercomposer mutation:check— MSI 100% (450 mutants generated; 443 killed by tests, 5 caught by static analysis, 2 errors)https://claude.ai/code/session_01Gdocn8KuDw4y2q4995r9Si
Generated by Claude Code