Skip to content

Commit

Permalink
Fix type errors in interactive package selection, fixes #10712
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Apr 7, 2022
1 parent 58e1351 commit 0efb557
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Composer/Command/PackageDiscoveryTrait.php
Expand Up @@ -186,7 +186,7 @@ final protected function determineRequirements(InputInterface $input, OutputInte
$io->writeError($choices);
$io->writeError('');

$validator = function ($selection) use ($matches, $versionParser) {
$validator = function (string $selection) use ($matches, $versionParser) {
if ('' === $selection) {
return false;
}
Expand Down Expand Up @@ -218,13 +218,13 @@ final protected function determineRequirements(InputInterface $input, OutputInte
'Enter package # to add, or the complete package name if it is not listed: ',
$validator,
3,
false
''
);
}

// no constraint yet, determine the best version automatically
if (false !== $package && false === strpos($package, ' ')) {
$validator = function ($input) {
$validator = function (string $input) {
$input = trim($input);

return strlen($input) > 0 ? $input : false;
Expand All @@ -234,7 +234,7 @@ final protected function determineRequirements(InputInterface $input, OutputInte
'Enter the version constraint to require (or leave blank to use the latest version): ',
$validator,
3,
false
''
);

if (false === $constraint) {
Expand Down

0 comments on commit 0efb557

Please sign in to comment.