Skip to content

Commit 9931208

Browse files
authored
Merge pull request #910 from lubo13/bugfix/yaml-source-manipulator-key-regex
[YamlSourceManipulator] Tweak regex pattern for regex key
2 parents 1f20a8c + 85ce7c5 commit 9931208

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-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('#(?<!\w)\$?%s\'?( )*:#', preg_quote($key));
688688
}
689689

690690
private function updateContents(string $newContents, array $newData, int $newPosition)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
services:
2+
_defaults:
3+
autowire: true
4+
autoconfigure: true
5+
bind:
6+
$httpClient: '@http.client'
7+
8+
app.service:
9+
class: App\Services\Service
10+
arguments:
11+
- argument_1: something
12+
argument_2: something
13+
14+
===
15+
$data['services']['app.service']['arguments'][0]['argument_3'] = 'something_new';
16+
===
17+
services:
18+
_defaults:
19+
autowire: true
20+
autoconfigure: true
21+
bind:
22+
$httpClient: '@http.client'
23+
24+
app.service:
25+
class: App\Services\Service
26+
arguments:
27+
- argument_1: something
28+
argument_2: something
29+
argument_3: something_new

0 commit comments

Comments
 (0)