mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
Preserve newlines in docblock tags
This is especially important when using markdown. Adding a blank line between text introduces a new paragraph. Current implementation will result in all text staying in one paragraph and also other elements like lists and code do not get recognized in most cases.
This commit is contained in:
@@ -209,20 +209,16 @@ class DocBlock implements \Reflector
|
||||
);
|
||||
}
|
||||
foreach (explode("\n", $tags) as $tag_line) {
|
||||
if (trim($tag_line) === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($tag_line[0]) && ($tag_line[0] === '@')) {
|
||||
$result[] = $tag_line;
|
||||
} else {
|
||||
$result[count($result) - 1] .= PHP_EOL . $tag_line;
|
||||
$result[count($result) - 1] .= "\n" . $tag_line;
|
||||
}
|
||||
}
|
||||
|
||||
// create proper Tag objects
|
||||
foreach ($result as $key => $tag_line) {
|
||||
$result[$key] = Tag::createInstance($tag_line, $this);
|
||||
$result[$key] = Tag::createInstance(trim($tag_line), $this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user