Skip to content

Commit 8ee16d1

Browse files
committed
Fix for @var with two variables
1 parent 42e36ae commit 8ee16d1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Fixer/PhpdocVarAnnotationCorrectOrderFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function fix(\SplFileInfo $file, Tokens $tokens) : void
3939
}
4040

4141
$newContent = \preg_replace(
42-
'/(@var\s*)(\$\S+)(\s+)(\S+)\b/i',
42+
'/(@var\s*)(\$\S+)(\s+)([^\$]\S*)\b/i',
4343
'$1$4$3$2',
4444
$token->getContent()
4545
);

tests/Fixer/PhpdocVarAnnotationCorrectOrderFixerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public function provideFixCases() : \Iterator
4343
',
4444
];
4545

46+
yield [
47+
'<?php
48+
/** @var $foo $bar */
49+
',
50+
];
51+
4652
yield [
4753
'<?php
4854
/**

0 commit comments

Comments
 (0)