Skip to content

Commit eb778f8

Browse files
committed
Use default license/PHP requirement values from composer.json
1 parent 88e5b0d commit eb778f8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Command/Markdown/GeneratorCommand.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ private function promptDescription(SymfonyStyle $io): string
160160

161161
private function promptRequirements(SymfonyStyle $io): string
162162
{
163-
$requirements = $io->ask('Requirements / Installation?');
163+
$phpRequirement = !empty($this->composerData['require']['php']) ? $this->composerData['require']['php'] : null;
164+
$requirements = $io->ask('Requirements / Installation?', $phpRequirement);
164165

165166
if (!$this->isFieldFilled($requirements)) {
166167
throw new EmptyFieldException('What are the requirements/Installation steps for this project?');
@@ -171,7 +172,7 @@ private function promptRequirements(SymfonyStyle $io): string
171172

172173
private function promptAuthor(SymfonyStyle $io): string
173174
{
174-
$authorName = !empty($this->composerData['authors'][0]['name']) ? $this->composerData['authors'][0]['name'] : null;
175+
$authorName = !empty($this->composerData['authors'][0]['name']) ? $this->composerData['authors'][0]['name'] : DefaultValue::AUTHOR;
175176
$authorName = $io->ask('Author Name', $authorName);
176177

177178
if (!$this->isFieldFilled($authorName)) {
@@ -183,7 +184,7 @@ private function promptAuthor(SymfonyStyle $io): string
183184

184185
private function promptEmail(SymfonyStyle $io): string
185186
{
186-
$email = !empty($this->composerData['authors'][0]['email']) ? $this->composerData['authors'][0]['email'] : null;
187+
$email = !empty($this->composerData['authors'][0]['email']) ? $this->composerData['authors'][0]['email'] : DefaultValue::EMAIL;
187188
$email = $io->ask('Valid Author Email (will also be used for your gravatar)', $email);
188189

189190
if (!$this->isFieldFilled($email)) {
@@ -244,8 +245,10 @@ private function promptGithub(SymfonyStyle $io): string
244245

245246
private function promptLicense(HelperInterface $helper, InputInterface $input, OutputInterface $output): string
246247
{
248+
$defaultLicense = !empty($this->composerData['license']) ? $this->composerData['license'] : DefaultValue::LICENSE_CODE;
249+
247250
$question = new ChoiceQuestion(
248-
sprintf('License [%s]', DefaultValue::LICENSE_CODE),
251+
sprintf('License [%s]', $defaultLicense),
249252
License::CODES,
250253
DefaultValue::LICENSE_CODE
251254
);

0 commit comments

Comments
 (0)