fix unescaped regular (#1549)

fix unescaped regular
This commit is contained in:
Tomáš Votruba 2019-06-04 13:25:01 +03:00 committed by GitHub
commit de22d86962
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -232,8 +232,7 @@ final class PhpDocInfoPrinter
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, '#' . $pattern . '#', $phpDocTagNode->value->description);
$nodeOutput = Strings::replace($nodeOutput, '#' . preg_quote($pattern, '#') . '#', $phpDocTagNode->value->description);
if (substr_count($nodeOutput, "\n")) {
$nodeOutput = Strings::replace($nodeOutput, "#\n#", PHP_EOL . ' * ');
}

View File

@ -0,0 +1,3 @@
/**
* @param bool $setTicketAuthor @see self::create()
*/

View File

@ -66,6 +66,7 @@ final class PhpDocInfoPrinterTest extends AbstractKernelTestCase
yield [__DIR__ . '/PhpDocInfoPrinterSource/doc11.txt'];
yield [__DIR__ . '/PhpDocInfoPrinterSource/doc12.txt'];
yield [__DIR__ . '/PhpDocInfoPrinterSource/doc13.txt'];
yield [__DIR__ . '/PhpDocInfoPrinterSource/doc14.txt'];
}
public function provideMultiline(): Iterator