Parcourir la source

ConsoleIO::select for a single option, fixes #7106, closes #7107

dmsmidt il y a 7 ans
Parent
commit
556148510b
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  1. 4 0
      src/Composer/IO/ConsoleIO.php

+ 4 - 0
src/Composer/IO/ConsoleIO.php

@@ -291,6 +291,10 @@ class ConsoleIO extends BaseIO
 
         $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
 
+        if (!is_array($result)) {
+            return (string) array_search($result, $choices, true);
+        }
+
         $results = array();
         foreach ($choices as $index => $choice) {
             if (in_array($choice, $result, true)) {