Fix PhpDoc summary and description split for CRLF files (#1271)
This commit is contained in:
1 parent
4b7e0fc012
commit
e6f2982a99
2 files changed
+23
No files matched your search
@@ -85,6 +85,7 @@ class PhpDoc
|
||||
->implode("\n");
|
||||
|
||||
$text = Str::of($text)
|
||||
->replace("\r\n", "\n")
|
||||
->trim()
|
||||
->explode("\n\n", 2);
|
||||
|
||||
|
||||
@@ -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"],
|
||||
]);
|
||||
Reference in new issue
Block a user