You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only the second argument is the counted expression, but this branch currently processes every call-like argument. For example, assertSame(count($expected), count($actual)) is rewritten to assertCount($expected, $actual), changing the expected count; call-like message arguments can also unnecessarily suppress the fix. Restrict this transformation to argument index 1 and add a regression case.
An unpacked argument is not equivalent to its underlying expression. For example, count(...$arrays) counts the unpacked array while the generated assertCount(..., $arrays) counts the outer array, so this auto-fix changes behavior. Treat an unpacked count argument as non-fixable.
Only the second ($actual) argument should be unwrapped. As written, every call-like argument is rewritten, so assertSame(count($expected), count($actual)) becomes assertCount($expected, $actual) instead of preserving count($expected) as the expected integer. Restrict this branch to index 1; this also avoids unnecessarily declining fixes when the expected value or message is another kind of call.
This rejects every two-argument count() call, although the rule already reports calls such as count($value, COUNT_NORMAL) (and calls whose inferred element type makes recursive mode equivalent). Those diagnostics therefore still have no auto-fix even though dropping the proven-normal mode is semantics-preserving; only malformed calls with more than two arguments need to remain unfixed.
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
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.
closes #249
skip named and splat args for auto-fixing. PHPUnit does not support named arguments for assert*.
see https://github.com/sebastianbergmann/phpunit/blob/bfa72f3d37a2fcb76ec57c87728f3623db06c035/src/Framework/Assert.php#L72-L74