Skip to content

Commit fcba489

Browse files
committed
Support attributes in parameter and on methods
1 parent 60f9d8a commit fcba489

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

src/Templates/highlight.php/php.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@
252252
"relevance": 0
253253
}
254254
]
255+
},
256+
{
257+
"$ref": "#contains.0"
258+
},
259+
{
260+
"$ref": "#contains.1"
255261
}
256262
]
257263
}

tests/fixtures/expected/blocks/code-blocks/php-attributes.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div translate="no" data-loc="54" class="notranslate codeblock codeblock-length-md codeblock-php-attributes codeblock-php">
1+
<div translate="no" data-loc="65" class="notranslate codeblock codeblock-length-md codeblock-php-attributes codeblock-php">
22
<div class="codeblock-scroll">
33
<pre class="codeblock-lines">1
44
2
@@ -53,7 +53,18 @@
5353
51
5454
52
5555
53
56-
54</pre>
56+
54
57+
55
58+
56
59+
57
60+
58
61+
59
62+
60
63+
61
64+
62
65+
63
66+
64
67+
65</pre>
5768
<pre class="codeblock-code">
5869
<code>
5970
<span class="hljs-comment">// src/SomePath/SomeClass.php</span>
@@ -135,6 +146,16 @@
135146
<span class="hljs-variable">
136147
<span class="hljs-variable-other-marker">$</span> property12</span>
137148
;
149+
<span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">__construct</span><span class="hljs-params">(
150+
<span class="hljs-meta">#[TaggedIterator</span>(<span class="hljs-string">'app.handlers'</span>)<span class="hljs-meta">]</span>
151+
iterable <span class="hljs-variable"><span class="hljs-variable-other-marker">$</span>handlers</span>,
152+
)</span></span>{
153+
}
154+
155+
<span class="hljs-meta">#[AsController]</span>
156+
<span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-title">someAction</span><span class="hljs-params">(<span class="hljs-meta">#[CurrentUser]</span> User <span class="hljs-variable"><span class="hljs-variable-other-marker">$</span>user</span>)</span></span>
157+
{
158+
}
138159
}</code></pre>
139160
</div>
140161
</div>

tests/fixtures/source/blocks/code-blocks/php-attributes.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,15 @@
5353
new Assert\Length(min: 10),
5454
])]
5555
private $property12;
56+
57+
public function __construct(
58+
#[TaggedIterator('app.handlers')]
59+
iterable $handlers,
60+
) {
61+
}
62+
63+
#[AsController]
64+
public function someAction(#[CurrentUser] User $user)
65+
{
66+
}
5667
}

0 commit comments

Comments
 (0)