Skip to content

Commit a9ad35e

Browse files
Merge pull request #53 from matthiasnoback/fix
Fix type issues
2 parents e4cc062 + c6042de commit a9ad35e

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

bin/composer

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@
22

33
set -eu
44

5-
# Copy user and group ID into .env file
6-
printf "HOST_UID=%s\nHOST_GID=%s\n" "$(id -u)" "$(id -g)" > .env
7-
8-
docker-compose run --rm composer --ignore-platform-reqs "$@"
5+
docker-compose run --rm composer "$@"

bin/install

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo "Pulling Docker images"
99
docker-compose pull
1010

1111
echo "Installing Composer dependencies"
12-
docker-compose run --rm composer install --ignore-platform-reqs --prefer-dist
12+
docker-compose run --rm composer update --prefer-dist
1313

1414
echo ""
1515
echo "Done"

src/Console/Helper/Question/AlwaysReturnKeyOfChoiceQuestion.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct($question, array $choiceViews, $default = null)
4242
/**
4343
* @param bool $multiselect
4444
*/
45-
public function setMultiselect($multiselect)
45+
public function setMultiselect(bool $multiselect): static
4646
{
4747
$this->_multiselect = $multiselect;
4848

@@ -52,17 +52,17 @@ public function setMultiselect($multiselect)
5252
/**
5353
* @param string $errorMessage
5454
*/
55-
public function setErrorMessage($errorMessage)
55+
public function setErrorMessage(string $errorMessage): static
5656
{
5757
$this->_errorMessage = $errorMessage;
5858

5959
return parent::setErrorMessage($errorMessage);
6060
}
6161

6262
/**
63-
* @return callable
63+
* @return callable|null
6464
*/
65-
public function getValidator()
65+
public function getValidator(): ?callable
6666
{
6767
return function ($selected) {
6868
// Collapse all spaces.

src/Console/Input/FormBasedInputDefinitionFactory.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function createForFormType(string $formType, array &$resources = []): Inp
4141
}
4242

4343
$type = InputOption::VALUE_REQUIRED;
44-
$default = $field->getConfig()->getOption('data', null);
44+
$default = $this->resolveDefaultValue($field);
4545
$description = FormUtil::label($field);
4646

4747
$inputDefinition->addOption(new InputOption($name, null, $type, $description, $default));
@@ -62,4 +62,15 @@ private function isFormFieldSupported(FormInterface $field): bool
6262

6363
return true;
6464
}
65+
66+
private function resolveDefaultValue(FormInterface $field): string | bool | int | float | array | null
67+
{
68+
$default = $field->getConfig()->getOption('data', null);
69+
70+
if (is_scalar($default) || is_null($default)) {
71+
return $default;
72+
}
73+
74+
return null;
75+
}
6576
}

0 commit comments

Comments
 (0)