Skip to content

Commit 9afba84

Browse files
committed
Add fix in PhpdocNoSuperfluousParamFixer
1 parent 41825bd commit 9afba84

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

src/Fixer/PhpdocNoSuperfluousParamFixer.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use PhpCsFixer\FixerDefinition\CodeSample;
1616
use PhpCsFixer\FixerDefinition\FixerDefinition;
1717
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
18-
use PhpCsFixer\Preg;
1918
use PhpCsFixer\Tokenizer\Token;
2019
use PhpCsFixer\Tokenizer\Tokens;
2120

@@ -122,7 +121,7 @@ private static function getFilteredDocComment(string $comment, array $paramNames
122121

123122
$foundParamNames = [];
124123
foreach ($doc->getAnnotationsOfType('param') as $annotation) {
125-
$paramName = self::getParamName($annotation->getContent());
124+
$paramName = $annotation->getVariableName();
126125

127126
if (\in_array($paramName, $paramNames, true) && !\in_array($paramName, $foundParamNames, true)) {
128127
$foundParamNames[] = $paramName;
@@ -134,18 +133,4 @@ private static function getFilteredDocComment(string $comment, array $paramNames
134133

135134
return $doc->getContent();
136135
}
137-
138-
private static function getParamName(string $annotation): ?string
139-
{
140-
Preg::match('/@param\\s+(?:[^\\$]+)?\\s*(\\$[a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*)\\b/', $annotation, $matches);
141-
142-
if (!\array_key_exists(1, $matches)) {
143-
return null;
144-
}
145-
146-
// @phpstan-ignore function.alreadyNarrowedType
147-
\assert(\is_string($matches[1]));
148-
149-
return $matches[1];
150-
}
151136
}

0 commit comments

Comments
 (0)