diff --git a/packages/BetterPhpDocParser/src/PhpDocParser/BetterPhpDocParser.php b/packages/BetterPhpDocParser/src/PhpDocParser/BetterPhpDocParser.php index 5b4c70fe080e..8c722b2bb276 100644 --- a/packages/BetterPhpDocParser/src/PhpDocParser/BetterPhpDocParser.php +++ b/packages/BetterPhpDocParser/src/PhpDocParser/BetterPhpDocParser.php @@ -5,9 +5,7 @@ use Nette\Utils\Strings; use PHPStan\PhpDocParser\Ast\Node; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode; -use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode; -use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode; use PHPStan\PhpDocParser\Lexer\Lexer; use PHPStan\PhpDocParser\Parser\ConstExprParser; use PHPStan\PhpDocParser\Parser\ParserException; @@ -15,9 +13,7 @@ use PHPStan\PhpDocParser\Parser\TokenIterator; use PHPStan\PhpDocParser\Parser\TypeParser; use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory; -use Rector\BetterPhpDocParser\Attributes\Ast\PhpDoc\AttributeAwareGenericTagValueNode; use Rector\BetterPhpDocParser\Attributes\Ast\PhpDoc\AttributeAwarePhpDocNode; -use Rector\BetterPhpDocParser\Attributes\Ast\PhpDoc\AttributeAwarePhpDocTagNode; use Rector\BetterPhpDocParser\Attributes\Attribute\Attribute; use Rector\BetterPhpDocParser\Data\StartEndInfo; use Rector\BetterPhpDocParser\Printer\MultilineSpaceFormatPreserver; diff --git a/packages/BetterPhpDocParser/src/Printer/PhpDocInfoPrinter.php b/packages/BetterPhpDocParser/src/Printer/PhpDocInfoPrinter.php index fc8cf01474b9..2d74b635f239 100644 --- a/packages/BetterPhpDocParser/src/Printer/PhpDocInfoPrinter.php +++ b/packages/BetterPhpDocParser/src/Printer/PhpDocInfoPrinter.php @@ -231,8 +231,12 @@ private function printPhpDocTagNode( if ($phpDocTagNode->getAttribute(Attribute::HAS_DESCRIPTION_WITH_ORIGINAL_SPACES)) { if (property_exists($phpDocTagNode->value, 'description') && $phpDocTagNode->value->description) { - $pattern = Strings::replace($phpDocTagNode->value->description, '#[\s]+#', '\s+'); - $nodeOutput = Strings::replace($nodeOutput, '#' . preg_quote($pattern, '#') . '#', $phpDocTagNode->value->description); + $pattern = Strings::replace(preg_quote($phpDocTagNode->value->description, '#'), '#[\s]+#', '\s+'); + $nodeOutput = Strings::replace( + $nodeOutput, + '#' . $pattern . '#', + $phpDocTagNode->value->description + ); if (substr_count($nodeOutput, "\n")) { $nodeOutput = Strings::replace($nodeOutput, "#\n#", PHP_EOL . ' * '); } diff --git a/src/Console/Option/LevelOptionResolver.php b/src/Console/Option/LevelOptionResolver.php index d6feea1c48d4..183259b30fc9 100644 --- a/src/Console/Option/LevelOptionResolver.php +++ b/src/Console/Option/LevelOptionResolver.php @@ -127,13 +127,14 @@ private function findNearestMatchingFiles(string $configDirectory, string $level foreach ($configFiles as $configFile) { // only similar configs, not too far // this allows to match "Symfony.40" to "symfony40" config - $distance = levenshtein($configFile->getFilenameWithoutExtension(), $levelName); + $fileNameWithoutExtension = pathinfo($configFile->getFilename(), PATHINFO_FILENAME); + $distance = levenshtein($fileNameWithoutExtension, $levelName); if ($distance > 2) { continue; } if ($levelVersion) { - $fileVersion = $this->matchVersionInTheEnd($configFile->getFilenameWithoutExtension()); + $fileVersion = $this->matchVersionInTheEnd($fileNameWithoutExtension); if ($levelVersion !== $fileVersion) { // not a version match continue;