Skip to content

Commit 4e19318

Browse files
authored
Escape literal "%" because of vsprintf
Fixes #81.
1 parent 9270140 commit 4e19318

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/DocBlock/DescriptionFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,10 @@ private function parse($tokens, TypeContext $context)
129129

130130
//In order to allow "literal" inline tags, the otherwise invalid
131131
//sequence "{@}" is changed to "@", and "{}" is changed to "}".
132+
//"%" is escaped to "%%" because of vsprintf.
132133
//See unit tests for examples.
133134
for ($i = 0; $i < $count; $i += 2) {
134-
$tokens[$i] = str_replace(['{@}', '{}'], ['@', '}'], $tokens[$i]);
135+
$tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]);
135136
}
136137

137138
return [implode('', $tokens), $tags];

0 commit comments

Comments
 (0)