Skip to content

Commit 1a048f9

Browse files
committed
Other optimizations
1 parent ef47af4 commit 1a048f9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

admin/starter/builds

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ $modified = [];
3030
$file = __DIR__ . DIRECTORY_SEPARATOR . 'composer.json';
3131

3232
if (is_file($file)) {
33-
if ($contents = file_get_contents($file)) {
34-
if ($array = json_decode($contents, true)) {
33+
$contents = file_get_contents($file);
34+
35+
if ((string) $contents !== '') {
36+
$array = json_decode($contents, true);
37+
38+
if (is_array($array)) {
3539
if ($dev) {
3640
$array['minimum-stability'] = 'dev';
3741
$array['prefer-stable'] = true;
38-
39-
if (! isset($array['repositories'])) {
40-
$array['repositories'] = [];
41-
}
42+
$array['repositories'] = $array['repositories'] ?? [];
4243

4344
$found = false;
4445

@@ -111,8 +112,8 @@ foreach ($files as $file) {
111112
}
112113
}
113114

114-
if (empty($modified)) {
115-
echo 'No files modified' . PHP_EOL;
115+
if ($modified !== []) {
116+
echo 'No files modified.' . PHP_EOL;
116117
} else {
117118
echo 'The following files were modified:' . PHP_EOL;
118119

0 commit comments

Comments
 (0)