mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 11:44:14 +01:00
cleanup extra space in doc print
This commit is contained in:
parent
3125cc38c8
commit
13dff989c9
@ -102,6 +102,9 @@ final class PhpDocInfoPrinter
|
||||
|
||||
$phpDocString = $this->printPhpDocNode($this->attributeAwarePhpDocNode);
|
||||
|
||||
// replace extra space after *
|
||||
$phpDocString = Strings::replace($phpDocString, '#([^*])\*[ \t]+$#sm', '$1*');
|
||||
|
||||
// hotfix of extra space with callable ()
|
||||
return Strings::replace($phpDocString, '#callable(\s+)\(#', 'callable(');
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Test.
|
||||
*
|
||||
* @param string $param
|
||||
*/
|
@ -22,6 +22,18 @@ final class PhpDocInfoPrinterTest extends AbstractPhpDocInfoPrinterTest
|
||||
$this->assertSame($docComment, $this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo));
|
||||
}
|
||||
|
||||
public function testRemoveSpace(): void
|
||||
{
|
||||
$docComment = FileSystem::read(__DIR__ . '/FixtureChanged/with_space.txt');
|
||||
$phpDocInfo = $this->createPhpDocInfoFromDocCommentAndNode($docComment, new Nop());
|
||||
|
||||
$expectedDocComment = FileSystem::read(__DIR__ . '/FixtureChanged/with_space_expected.txt.inc');
|
||||
|
||||
$printedDocComment = $this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo);
|
||||
|
||||
$this->assertSame($expectedDocComment, $printedDocComment);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/FixtureBasic', '*.txt');
|
||||
|
Loading…
x
Reference in New Issue
Block a user