Fix PhpDoc summary and description split for CRLF files (#1271)

This commit is contained in:
dualfroz committed 2026-09-13 20:06:22 +03:00
1 parent 4b7e0fc012
commit e6f2982a99
2 files changed
+23

No files matched your search

+1
View File
@@ -85,6 +85,7 @@ class PhpDoc
->implode("\n"); ->implode("\n");
$text = Str::of($text) $text = Str::of($text)
->replace("\r\n", "\n")
->trim() ->trim()
->explode("\n\n", 2); ->explode("\n\n", 2);
+22
View File
@@ -0,0 +1,22 @@
<?php
use Dedoc\Scramble\Support\PhpDoc;
it('extracts summary and description', function (string $eol) {
$phpDoc = str_replace("\n", $eol, <<<'EOD'
/**
* This is summary.
*
* This is a description.
* It can span multiple lines.
*/
EOD);
$node = PhpDoc::parse($phpDoc);
expect($node->getAttribute('summary'))->toBe('This is summary.')
->and($node->getAttribute('description'))->toBe("This is a description.\nIt can span multiple lines.");
})->with([
'LF' => ["\n"],
'CRLF' => ["\r\n"],
]);