Skip to content

Commit

Permalink
bug #3924 FullyQualifiedStrictTypesFixer - space bug (dmvdbrugge)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.12 branch.

Discussion
----------

FullyQualifiedStrictTypesFixer - space bug

This fixes #3861

Commits
-------

51d1199 Fix ArgumentsAnalyzer
  • Loading branch information
keradus committed Aug 10, 2018
2 parents 1c10240 + 51d1199 commit b64651d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
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

0 comments on commit b64651d

Please sign in to comment.