Skip to content

Commit f29eabe

Browse files
gandazgultheseer
authored andcommitted
Tweaked phpdoc line parser regex to accept single line docblock
e.g. /** @var Type */
1 parent b5bd586 commit f29eabe

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

src/docblock/Parser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected function prepare($block) {
9595
$block = str_replace(array("\r\n", "\r"), "\n", mb_substr($block, 3, -2));
9696
$raw = array();
9797
foreach(explode("\n", $block) as $line) {
98-
$line = preg_replace('/^\s*\* ?/', '', $line);
98+
$line = preg_replace('/^\s*\*? ?/', '', $line);
9999
$raw[] = rtrim($line, " \n\t*");
100100
}
101101
return $raw;

tests/Integration/docblock/parserTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function docblockSources() {
9696
array('var_full'),
9797
array('var_no_body'),
9898
array('var_only'),
99+
array('var_only_single_line'),
99100
array('version')
100101
);
101102
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/** @var string */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<docblock xmlns="http://xml.phpdox.net/src"><var type="string"/></docblock>

0 commit comments

Comments
 (0)