Skip to content

Commit 4b6a97d

Browse files
committed
Fix method signature autoescaping issue
1 parent d909db1 commit 4b6a97d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/Example/Pizza.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Pizza extends AbstractProduct implements ProductInterface, JsonSerializabl
4444
* @param float $price Product price.
4545
* @param Base|null $base Pizza base.
4646
*/
47-
public function __construct(string $name, float $price, ?Base $base = null)
47+
public function __construct(string $name = '', float $price = 10.0, ?Base $base = null)
4848
{
4949
$this->name = $name;
5050
$this->price = $price;

tests/Functional/expected/classes/PhpDocumentorMarkdown/Example/Pizza.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Property base description
5353
Constructor title
5454

5555
```php
56-
public __construct(string $name, float $price, \PhpDocumentorMarkdown\Example\Pizza\Base|null $base = null): mixed
56+
public __construct(string $name = '', float $price = 10.0, \PhpDocumentorMarkdown\Example\Pizza\Base|null $base = null): mixed
5757
```
5858

5959
Constructor description

themes/markdown/method.md.twig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77

88
{# Method signature #}
99
```php
10-
{% if method.final %}{{ 'final' ~ ' ' }}{% endif %}{{ method.visibility ~ ' ' }}{%if method.static%}{{ 'static' ~ ' ' }}{% endif %}{{ method.name }}({% for argument in method.arguments %}
10+
{% autoescape false %}
11+
{% if method.final %}{{ 'final' ~ ' ' }}{% endif %}{{ method.visibility ~ ' ' }}{% if method.static %}{{ 'static' ~ ' ' }}{% endif %}{{ method.name }}({% for argument in method.arguments %}
1112
{{- argument.type }}
1213
{{- argument.byReference ? '&' }} $
13-
{{- argument.name }}{{ argument.default ? ' = '~argument.default }}
14+
{{- argument.name }}{{ argument.default ? ' = ' ~ argument.default | raw }}
1415
{%- if not loop.last %}, {% endif %}
1516
{%- endfor %})
1617
{{- method.response.type ? ': ' ~ method.response.type }}
18+
{% endautoescape %}
1719
```
1820
{% include 'partials/description.md.twig' with { node: method } %}
1921
{% if method.static or method.abstract or method.final or method.deprecated %}

0 commit comments

Comments
 (0)