Skip to content

Commit 3483833

Browse files
committed
bug #721 Fix: Remove trailing whitespace if value is empty (OskarStark)
This PR was squashed before being merged into the 1.9-dev branch. Discussion ---------- Fix: Remove trailing whitespace if value is empty This is the case if someone wants to add a blank line. ```diff # IMPORTANT: Comment -# +# # FOO_BAR=baz ``` Commits ------- 9eaece7 Fix: Remove trailing whitespace if value is empty
2 parents e385202 + 9eaece7 commit 3483833

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Configurator/EnvConfigurator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ private function configureEnvDist(Recipe $recipe, $vars, bool $update)
5151
foreach ($vars as $key => $value) {
5252
$value = $this->evaluateValue($value);
5353
if ('#' === $key[0] && is_numeric(substr($key, 1))) {
54-
$data .= '# '.$value."\n";
54+
if ('' === $value) {
55+
$data .= "#\n";
56+
} else {
57+
$data .= '# '.$value."\n";
58+
}
5559

5660
continue;
5761
}

0 commit comments

Comments
 (0)