File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,15 +30,16 @@ $modified = [];
3030$ file = __DIR__ . DIRECTORY_SEPARATOR . 'composer.json ' ;
3131
3232if (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
You can’t perform that action at this time.
0 commit comments