Skip to content

Commit 0624454

Browse files
committed
Add a newline at the end of generated composer.json
It is frustrating that every time I edit `composer.json` with a text editor, I get "generated files are out of sync" errors due to `generator` _not_ putting a newline there (FWIW, POSIX says that text files should always end with a newline character too)
1 parent de722d9 commit 0624454

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@
108108
"cs-fix": "phpcbf",
109109
"cs-check": "phpcs"
110110
}
111-
}
111+
}

generator/src/Generator/ComposerJsonEditor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static function editComposerFileForGeneration(array $modules): void
2323
$composerJson = \json_decode($composerContent, true);
2424
$composerJson['autoload']['files'] = self::editFilesListForGeneration($composerJson['autoload']['files'], $modules);
2525

26-
$newContent = \json_encode($composerJson, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES);
26+
$newContent = \json_encode($composerJson, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES) . "\n";
2727
\file_put_contents(FileCreator::getSafeRootDir() . '/composer.json', $newContent);
2828
}
2929

0 commit comments

Comments
 (0)