Skip to content

Commit

Permalink
Tweak regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyubomir Grozdanov committed Jul 2, 2021
1 parent 9daea17 commit da120f1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Util/YamlSourceManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ private function getEndOfPreviousKeyPosition($key): int

private function getKeyRegex($key)
{
return sprintf('#\b%s\'?( )*:#', preg_quote($key));
return sprintf('#(?<!\w)\$?%s\'?( )*:#', preg_quote($key));
}
private function updateContents(string $newContents, array $newData, int $newPosition)
Expand Down
28 changes: 28 additions & 0 deletions tests/Util/yaml_fixtures/add_item_on_config_with_bind.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
services:
_defaults:
autowire: true
autoconfigure: true
bind:
$httpClient: '@http.client'

app.service:
class: App\Services\Service
arguments:
- argument_1: something
argument_2: something
===
$data['services']['app.service']['arguments']['argument_3'] = 'something_new';
===
services:
_defaults:
autowire: true
autoconfigure: true
bind:
$httpClient: '@http.client'

app.service:
class: App\Services\Service
arguments:
- argument_1: something
argument_2: something
argument_3: something_new

0 comments on commit da120f1

Please sign in to comment.