1
0
Fork 0

Warn when init is being used non-interactively without any args passed in, instead of silently overwriting the file

pull/9465/head
Jordi Boggiano 2020-11-11 17:08:23 +01:00
parent 53412a3299
commit 6a2f9870a7
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 6 additions and 0 deletions

View File

@ -129,6 +129,12 @@ EOT
return 1;
}
} else {
if (json_encode($options) === '{"require":{}}') {
throw new \RuntimeException('You have to run this command in interactive mode, or specify at least some data using --name, --require, etc.');
}
$io->writeError('Writing composer.json');
}
$file->write($options);