Accept the shared data provider's third argument in testOverridingFinalMethod - #6193
Merged
staabm merged 1 commit intoAug 7, 2026
Merged
Conversation
…alMethod dataOverridingFinalMethod() yields three values per set and is shared with testParle(), which uses all three. testOverridingFinalMethod() declared only two parameters, so PHPUnit 12 errors with "data set has more arguments (3) than the test method accepts (2)". Older PHPUnit tolerated the extra value, which is why it surfaced only once the PHPUnit 12 matrix picked up a stricter release. Declare the third parameter to match the provider; the method has no covariance assertion, so the value is unused there. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
thank you |
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.
dataOverridingFinalMethod()yields three values per set (phpVersion, a parameter-contravariance message, and a return-type-covariance message) and is shared by two tests.testParle()declares and uses all three;testOverridingFinalMethod()declared only two, so the third value went unused.Older PHPUnit tolerated the extra data-set value, but PHPUnit 12 treats it as an error:
It started failing on the
Tests PHPUnit 12.xmatrix once it picked up a stricter PHPUnit 12 release, which is why the base was green earlier. This declares the third parameter ontestOverridingFinalMethod()so its arity matches the shared provider. The method has no covariance assertion, so it does not use the value, but declaring it keeps the data set valid under PHPUnit 12.Verified locally on PHPUnit 11.5 (the test still passes) and via self-analysis and the coding standard. I could not run PHPUnit 12 locally, but the fix makes the data-set arity equal the parameter count, which is what PHPUnit 12 requires.