Skip to content

Commit dc6038e

Browse files
Lyubomir Grozdanovjrushlow
Lyubomir Grozdanov
authored andcommitted
Tweak regex pattern
1 parent 1f20a8c commit dc6038e

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+
$data['services']['app.service']['arguments'][0]['argument_3'] = 'something_new';
15+
===
16+
services:
17+
_defaults:
18+
autowire: true
19+
autoconfigure: true
20+
bind:
21+
$httpClient: '@http.client'
22+
23+
app.service:
24+
class: App\Services\Service
25+
arguments:
26+
- argument_1: something
27+
argument_2: something
28+
argument_3: something_new
29+

0 commit comments

Comments
 (0)