From 8f09af6ad644414af3ed60f40a473ae4d8340f4f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 Aug 2024 13:07:21 +0200 Subject: [PATCH] Highlight nested PHP comments --- tests/IntegrationTest.php | 4 ++ .../code-blocks/php-nested-comments.html | 72 +++++++++++++++++++ .../code-blocks/php-nested-comments.rst | 12 ++++ 3 files changed, 88 insertions(+) create mode 100644 tests/fixtures/expected/blocks/code-blocks/php-nested-comments.html create mode 100644 tests/fixtures/source/blocks/code-blocks/php-nested-comments.rst diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index f121ba3..95fef1d 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -294,6 +294,10 @@ public function parserUnitBlockProvider() 'blockName' => 'code-blocks/php-attributes', ]; + yield 'code-block-php-nested-comments' => [ + 'blockName' => 'code-blocks/php-nested-comments', + ]; + yield 'code-block-text' => [ 'blockName' => 'code-blocks/text', ]; diff --git a/tests/fixtures/expected/blocks/code-blocks/php-nested-comments.html b/tests/fixtures/expected/blocks/code-blocks/php-nested-comments.html new file mode 100644 index 0000000..e1f7078 --- /dev/null +++ b/tests/fixtures/expected/blocks/code-blocks/php-nested-comments.html @@ -0,0 +1,72 @@ +

You can do that by adding a "stamp" to your message:

+
+
+
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+
+            
+                use
+                Symfony
+                \
+                Component
+                \
+                Messenger
+                \
+                MessageBusInterface
+                ;
+                use
+                Symfony
+                \
+                Component
+                \
+                Messenger
+                \
+                Stamp
+                \
+                DelayStamp
+                ;
+                public
+                
+                    function
+                    index
+                    
+                        (MessageBusInterface
+                        
+                            $
+                            bus
+                        
+                        )
+                    
+                
+                {
+                
+                    $
+                    bus
+                
+                ->
+                dispatch
+                (
+                new
+                SmsNotification
+                (
+                '...'
+                ), [
+                // wait 5 seconds before processing
+                new
+                DelayStamp
+                (
+                5000
+                ), ]);
+}
+            
+        
+
+
diff --git a/tests/fixtures/source/blocks/code-blocks/php-nested-comments.rst b/tests/fixtures/source/blocks/code-blocks/php-nested-comments.rst new file mode 100644 index 0000000..ea8dc0f --- /dev/null +++ b/tests/fixtures/source/blocks/code-blocks/php-nested-comments.rst @@ -0,0 +1,12 @@ +You can do that by adding a "stamp" to your message:: + + use Symfony\Component\Messenger\MessageBusInterface; + use Symfony\Component\Messenger\Stamp\DelayStamp; + + public function index(MessageBusInterface $bus) + { + $bus->dispatch(new SmsNotification('...'), [ + // wait 5 seconds before processing + new DelayStamp(5000), + ]); + }