Skip to content

Commit 86b0a00

Browse files
authored
Fix PhpDocNode end newline print
1 parent b2169b6 commit 86b0a00

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/Ast/PhpDoc/PhpDocNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public function getTypeAliasImportTagValues(string $tagName = '@phpstan-import-t
271271

272272
public function __toString(): string
273273
{
274-
return "/**\n * " . implode("\n * ", $this->children) . '*/';
274+
return "/**\n * " . implode("\n * ", $this->children) . "\n */";
275275
}
276276

277277
}
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
4+
5+
use PHPStan\PhpDocParser\Ast\Node;
6+
use PHPUnit\Framework\TestCase;
7+
8+
final class NodePrintTest extends TestCase
9+
{
10+
11+
/**
12+
* @dataProvider providePhpDocData
13+
*/
14+
public function testPrintMultiline(Node $node, string $expectedPrinted): void
15+
{
16+
$this->assertSame($expectedPrinted, (string) $node);
17+
}
18+
19+
20+
public function providePhpDocData(): \Iterator
21+
{
22+
yield [
23+
new PhpDocNode([
24+
new PhpDocTextNode('It works'),
25+
]),
26+
'/**
27+
* It works
28+
*/',
29+
];
30+
}
31+
32+
}

0 commit comments

Comments
 (0)