File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ public function getTags(): array
9494 public function render (?Formatter $ formatter = null ): string
9595 {
9696 if ($ this ->tags === []) {
97- return $ this ->bodyTemplate ;
97+ return vsprintf ( $ this ->bodyTemplate , []) ;
9898 }
9999
100100 if ($ formatter === null ) {
Original file line number Diff line number Diff line change @@ -142,4 +142,31 @@ public function testDescriptionMultipleTagsCanBeCastToString(): void
142142 . 'inverseJoinColumns={@JoinColumn (name="column_id_2", referencedColumnName="id")}) ' ;
143143 $ this ->assertSame ($ expected , (string ) $ fixture );
144144 }
145+
146+ /**
147+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
148+ *
149+ * @covers ::__construct
150+ * @covers ::render
151+ * @covers ::__toString
152+ */
153+ public function testDescriptionWithEscapedCharactersAndNoTagsCanBeCastToString (): void
154+ {
155+ //% chars are escaped in \phpDocumentor\Reflection\DocBlock\DescriptionFactory::create
156+ $ body = <<<'EOT'
157+ {%% for user in users %%}
158+ {{ user.name }}
159+ {%% endfor %%}';
160+ EOT;
161+
162+ $ expected = <<<'EOT'
163+ {% for user in users %}
164+ {{ user.name }}
165+ {% endfor %}';
166+ EOT;
167+
168+ $ fixture = new Description ($ body , []);
169+
170+ $ this ->assertSame ($ expected , (string ) $ fixture );
171+ }
145172}
You can’t perform that action at this time.
0 commit comments