diff --git a/Helper/QuestionHelper.php b/Helper/QuestionHelper.php index 09e284860..4c8c8e166 100644 --- a/Helper/QuestionHelper.php +++ b/Helper/QuestionHelper.php @@ -328,19 +328,17 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu private function mostRecentlyEnteredValue($entered) { - $tempEntered = $entered; - // Determine the most recent value that the user entered - if (false !== strpos($entered, ',')) { - $choices = explode(',', $entered); - $lastChoice = trim($choices[\count($choices) - 1]); + if (false === strpos($entered, ',')) { + return $entered; + } - if (\strlen($lastChoice) > 0) { - $tempEntered = $lastChoice; - } + $choices = explode(',', $entered); + if (\strlen($lastChoice = trim($choices[\count($choices) - 1])) > 0) { + return $lastChoice; } - return $tempEntered; + return $entered; } /**