Skip to content

Commit

Permalink
Fix type errors in interactive package selection, fixes composer#10712
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek authored and emahorvat52 committed Jan 18, 2023
1 parent 723e2d3 commit df55659
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Composer/Command/PackageDiscoveryTrait.php
Expand Up @@ -184,7 +184,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 @@ -216,13 +216,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 @@ -232,7 +232,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 df55659

Please sign in to comment.