Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FullyQualifiedStrictTypesFixer - space bug #3924

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Tokenizer/Analyzer/ArgumentsAnalyzer.php
Expand Up @@ -107,7 +107,7 @@ public function getArgumentInfo(Tokens $tokens, $argumentStart, $argumentEnd)
$sawName = false;
for ($index = $argumentStart; $index <= $argumentEnd; ++$index) {
$token = $tokens[$index];
if ($token->isComment() || $token->isWhitespace() || $token->isGivenKind(T_ELLIPSIS)) {
if ($token->isComment() || $token->isWhitespace() || $token->isGivenKind(T_ELLIPSIS) || $token->equals('&')) {
continue;
}
if ($token->isGivenKind(T_VARIABLE)) {
Expand Down
7 changes: 7 additions & 0 deletions tests/Fixer/Import/FullyQualifiedStrictTypesFixerTest.php
Expand Up @@ -371,6 +371,13 @@ public function doSomething(
){}
}',
],
// Test reference
[
'<?php
function withReference(Exception &$e) {}',
'<?php
function withReference(\Exception &$e) {}',
],
];
}
}
10 changes: 10 additions & 0 deletions tests/Tokenizer/Analyzer/ArgumentsAnalyzerTest.php
Expand Up @@ -116,6 +116,16 @@ public function provideArgumentsInfoCases()
3
)
)],
['<?php function(array &$a = array()){};', 3, 12, new ArgumentAnalysis(
'$a',
6,
'array()',
new TypeAnalysis(
'array',
3,
3
)
)],
['<?php function(array ... $a){};', 3, 7, new ArgumentAnalysis(
'$a',
7,
Expand Down