Skip to content

Commit 28e7360

Browse files
committed
Merge branch '3.4' into 4.2
* 3.4: refactored code
2 parents c381423 + ad26ac2 commit 28e7360

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

Helper/QuestionHelper.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,19 +328,17 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
328328

329329
private function mostRecentlyEnteredValue($entered)
330330
{
331-
$tempEntered = $entered;
332-
333331
// Determine the most recent value that the user entered
334-
if (false !== strpos($entered, ',')) {
335-
$choices = explode(',', $entered);
336-
$lastChoice = trim($choices[\count($choices) - 1]);
332+
if (false === strpos($entered, ',')) {
333+
return $entered;
334+
}
337335

338-
if (\strlen($lastChoice) > 0) {
339-
$tempEntered = $lastChoice;
340-
}
336+
$choices = explode(',', $entered);
337+
if (\strlen($lastChoice = trim($choices[\count($choices) - 1])) > 0) {
338+
return $lastChoice;
341339
}
342340

343-
return $tempEntered;
341+
return $entered;
344342
}
345343

346344
/**

0 commit comments

Comments
 (0)