Skip to content

Commit f574de9

Browse files
authored
Merge pull request #82 from kelunik/issue-81
Escape literal "%" because of vsprintf
2 parents e4a6e49 + 4e19318 commit f574de9

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)