Skip to content

Commit 81f573a

Browse files
authored
[Annotation] Skip multiple @var on variable definition on RemovePropertyVariableNameDescriptionFixer (#71)
* [Annotation] Skip multiple @var on variable definition on RemovePropertyVariableNameDescriptionFixer * Fix * eol * Fix
1 parent e5a5093 commit 81f573a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/Fixer/Annotation/RemovePropertyVariableNameDescriptionFixer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ public function fix(SplFileInfo $fileInfo, Tokens $tokens): void
7575
// skip if not setter or getter
7676
$originalDocContent = $token->getContent();
7777

78+
preg_match_all(self::VAR_REGEX, $originalDocContent, $matches);
79+
80+
if (count($matches[0]) !== 1) {
81+
continue;
82+
}
83+
7884
$hasChanged = false;
7985

8086
$docblockLines = explode("\n", $originalDocContent);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Symplify\CodingStandard\Tests\Fixer\Annotation\RemovePropertyVariableNameDescriptionFixer\Fixture;
4+
5+
use PhpParser\Node\Arg;
6+
use PhpParser\Node\Expr\FuncCall;
7+
8+
final class SkipMultipleVar
9+
{
10+
public function run()
11+
{
12+
/**
13+
* @var FuncCall $firstArgumentValue
14+
* @var array<Arg> $args
15+
**/
16+
$args = $firstArgumentValue->getArgs();
17+
}
18+
}

0 commit comments

Comments
 (0)