fix: support the php-code-coverage 14.3 line coverage shape - #39
Open
maks-oleksyuk wants to merge 1 commit into
Open
fix: support the php-code-coverage 14.3 line coverage shape#39maks-oleksyuk wants to merge 1 commit into
maks-oleksyuk wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 7, 2026
|
would be great to have this merged. the error is |
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.
php-code-coverage 14.3 changed the shape of
ProcessedCodeCoverageData::lineCoverage(). A line used to hold the list of test ids covering it; it now holds hit counts keyed by an index into a separate list returned bytestIds().Mutation testing reads that structure to work out which tests cover a mutation. Against 14.3 it receives integers where strings are expected, and every run aborts on the first covered mutation with
preg_match(): Argument #2 ($subject) must be of type string, int given.phpunit/phpunitallowsphpunit/php-code-coverage: ^14.2.3, so both shapes are in circulation and both have to keep working.What changed
MutationTestRunner::coveredLines()normalises the coverage data into[file => [line => [testId, ...]]]before anything consumes it.testIdsCoveringLine()tells the two shapes apart by their structure rather than by a version check: a string value is a test id from 14.2 and earlier, an integer key is an index into the ids reported by 14.3.This also clears the two pre-existing PHPStan errors on
MutationTestRunner, which were the same mismatch surfacing statically.Testing
tests/Unit/Tester/MutationTestRunnerTest.phpcovers both shapes, an index with no matching test id, and a line nothing covers.Follow-ups
Mutation sharding builds on this fix in #40 and #41, and on pestphp/pest#1829.