Repository navigation
Add named-argument colon spacing to blink - #243
Merged
Merged
Conversation
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.
Problem
blink left
foo(name:$x)unchanged, while PHP ECS normalizes a named-argument colon to a single space after it (foo(name: $x)). This showed up on the laravel corpus:Http::response('...', status:500)->status: 500->andReturn(m:mock(X::class))->m: mock(X::class)Finding
The task assumed
MethodArgumentSpaceFixerowns this. It does not - the vendoredMethodArgumentSpaceFixeronly handles commas. The real owner isSingleSpaceAroundConstructFixervia itsnamed_argumentvirtual construct (CT::T_NAMED_ARGUMENT_COLON), confirmed by running ECS on an isolated snippet (onlySingleSpaceAroundConstructFixeris attributed) and byNamedArgumentTransformer. ECS keeps the space before the colon and only ensures a single space after - matching that here.Change
SingleSpaceAroundConstructnow handles thenamed_argumentconstruct. A colon is a named-argument colon when its previous meaningful token is a name and the one before that is(or,- exactly php-cs-fixer'sNamedArgumentTransformerrule, which excludes::, ternary?:, return-type): Type, goto labels and colons inside strings/comments. The space after is collapsed to one; the space before is left as-is.Validation
constructs_config_test.go(space after, second argument, multiple-space collapse, keep-space-before, and left-untouched for::, ternary, return-type colon, string colon, and off-by-default).ExceptionHandlerTest.phpis now identical;ContextualAttributeBindingTest.phpnamed-arg lines now match (its two unrelated divergences - anew X()->new Xand an attribute-array expansion - remain, as expected).