Skip to content

Commit

Permalink
fix: formatting of values when they are nullable, fixes #52
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Feb 22, 2023
1 parent ffc9a1f commit 08bb57d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Component/Generator/QuestionHandler/GenericHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public function handle(Definition $definition, SymfonyStyle $io, string $name, s
} else if(strlen((string) $answer) && $parameter->hasType()) {
$parameterType = (string) ($parameter->getType() ? $parameter->getType()->getName() : null);

if ($parameterType === 'int') {
if ($parameterType === 'int' || $parameterType === '?int') {
$answer = (int) $answer;
} else if($parameterType === 'float') {
} else if($parameterType === 'float' || $parameterType === '?float') {
$answer = (float) $answer;
}
}
Expand Down

0 comments on commit 08bb57d

Please sign in to comment.