Skip to content

Commit fa63eea

Browse files
committed
bug #896 Fix keys not found when surrounded by quotes (valentinloiseau)
This PR was merged into the 1.0-dev branch. Discussion ---------- Fix keys not found when surrounded by quotes Fix bug reported in #796 : running ``make:message`` cannot find existing messages when configuring with quotes according to [documentation](https://symfony.com/doc/current/messenger.html#routing-messages-to-a-transport). Commits ------- 630a97b Fix keys not found when surrounded by quotes
2 parents 5b5e044 + 630a97b commit fa63eea

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/Util/YamlSourceManipulator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ private function getEndOfPreviousKeyPosition($key): int
684684

685685
private function getKeyRegex($key)
686686
{
687-
return sprintf('#\b%s( )*:#', preg_quote($key));
687+
return sprintf('#\b%s\'?( )*:#', preg_quote($key));
688688
}
689689

690690
private function updateContents(string $newContents, array $newData, int $newPosition)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
framework:
2+
messenger:
3+
routing:
4+
# route all messages that extend this example base class or interface
5+
'App\Message\AbstractAsyncMessage': async
6+
'App\Message\AsyncMessageInterface': async
7+
8+
'My\Message\ToBeSentToTwoSenders': [async, audit]
9+
===
10+
11+
===
12+
framework:
13+
messenger:
14+
routing:
15+
# route all messages that extend this example base class or interface
16+
'App\Message\AbstractAsyncMessage': async
17+
'App\Message\AsyncMessageInterface': async
18+
19+
'My\Message\ToBeSentToTwoSenders': [async, audit]

0 commit comments

Comments
 (0)