Skip to content

Commit 8f09af6

Browse files
committed
Highlight nested PHP comments
1 parent 6702f0d commit 8f09af6

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

tests/IntegrationTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ public function parserUnitBlockProvider()
294294
'blockName' => 'code-blocks/php-attributes',
295295
];
296296

297+
yield 'code-block-php-nested-comments' => [
298+
'blockName' => 'code-blocks/php-nested-comments',
299+
];
300+
297301
yield 'code-block-text' => [
298302
'blockName' => 'code-blocks/text',
299303
];
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<p>You can do that by adding a "stamp" to your message:</p>
2+
<div translate="no" data-loc="10" class="notranslate codeblock codeblock-length-md codeblock-php">
3+
<div class="codeblock-scroll">
4+
<pre class="codeblock-lines">1
5+
2
6+
3
7+
4
8+
5
9+
6
10+
7
11+
8
12+
9
13+
10</pre>
14+
<pre class="codeblock-code">
15+
<code>
16+
<span class="hljs-keyword">use</span>
17+
<span class="hljs-title">Symfony</span>
18+
\
19+
<span class="hljs-title">Component</span>
20+
\
21+
<span class="hljs-title">Messenger</span>
22+
\
23+
<span class="hljs-title">MessageBusInterface</span>
24+
;
25+
<span class="hljs-keyword">use</span>
26+
<span class="hljs-title">Symfony</span>
27+
\
28+
<span class="hljs-title">Component</span>
29+
\
30+
<span class="hljs-title">Messenger</span>
31+
\
32+
<span class="hljs-title">Stamp</span>
33+
\
34+
<span class="hljs-title">DelayStamp</span>
35+
;
36+
<span class="hljs-keyword">public</span>
37+
<span class="hljs-function">
38+
<span class="hljs-keyword">function</span>
39+
<span class="hljs-title">index</span>
40+
<span class="hljs-params">
41+
(MessageBusInterface
42+
<span class="hljs-variable">
43+
<span class="hljs-variable-other-marker">$</span>
44+
bus
45+
</span>
46+
)
47+
</span>
48+
</span>
49+
{
50+
<span class="hljs-variable">
51+
<span class="hljs-variable-other-marker">$</span>
52+
bus
53+
</span>
54+
-&gt;
55+
<span class="hljs-title invoke__">dispatch</span>
56+
(
57+
<span class="hljs-keyword">new</span>
58+
<span class="hljs-title invoke__">SmsNotification</span>
59+
(
60+
<span class="hljs-string">'...'</span>
61+
), [
62+
<span class="hljs-comment">// wait 5 seconds before processing</span>
63+
<span class="hljs-keyword">new</span>
64+
<span class="hljs-title invoke__">DelayStamp</span>
65+
(
66+
<span class="hljs-number">5000</span>
67+
), ]);
68+
}
69+
</code>
70+
</pre>
71+
</div>
72+
</div>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
You can do that by adding a "stamp" to your message::
2+
3+
use Symfony\Component\Messenger\MessageBusInterface;
4+
use Symfony\Component\Messenger\Stamp\DelayStamp;
5+
6+
public function index(MessageBusInterface $bus)
7+
{
8+
$bus->dispatch(new SmsNotification('...'), [
9+
// wait 5 seconds before processing
10+
new DelayStamp(5000),
11+
]);
12+
}

0 commit comments

Comments
 (0)