Skip to content

Commit

Permalink
Check for a space / end before surrounding keys with quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
bennothommo committed Mar 28, 2022
1 parent 7633fd9 commit cd4b82d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Parse/Processor/Symfony3Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public function preprocess($text)

foreach ($lines as &$line) {
// Surround array keys with quotes if not already
$line = preg_replace_callback('/^( *)([\'"]{0}[^\'"\n\r:#]+[\'"]{0})\s*:/m', function ($matches) {
return $matches[1] . "'" . trim($matches[2]) . "':";
$line = preg_replace_callback('/^( *)([\'"]{0}[^\'"\n\r\-#]+[\'"]{0})\s*:(\s|$)/m', function ($matches) {
return $matches[1] . "'" . trim($matches[2]) . "':" . $matches[3];
}, rtrim($line));
}

Expand Down

0 comments on commit cd4b82d

Please sign in to comment.