Repository navigation
Make named arguments passed to @no-named-arguments callables fixable - #6910
Merged
Merged
Conversation
The fix passes the arguments positionally in parameter order and fills skipped optional parameters with their default values. Amp-Thread-ID: https://ampcode.com/threads/T-01a19c14-ede5-7153-b7e4-e784ff94be68
…lizer Also replaces the match expression the PHP 7.4 downgrade does not handle. Amp-Thread-ID: https://ampcode.com/threads/T-01a19c14-ede5-7153-b7e4-e784ff94be68
reorderArgs() is lenient for analysis purposes (appends unknown names, drops duplicates, moves named variadic arguments), so the fix maps arguments to parameter positions itself again. Keeps the if-chain that replaced the match expression the PHP 7.4 downgrade does not handle. Amp-Thread-ID: https://ampcode.com/threads/T-01a19c14-ede5-7153-b7e4-e784ff94be68
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.
The
argument.namederror reported for calls to@no-named-argumentsfunctions, methods and constructors is now fixable: the fix removes the argument names, reorders the arguments by parameter position and fills skipped optional parameters with their default values.Not fixed: calls with unpacked arguments, named arguments collected by a variadic parameter, unknown or duplicate names, attributes, and skipped parameters that are by-reference or have a default that is not a scalar, null, bool or
[].Note that reordering changes the evaluation order of the argument expressions.