@@ -303,10 +303,10 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
303
303
if ($ numMatches > 0 && -1 !== $ ofs ) {
304
304
$ ret = $ matches [$ ofs ];
305
305
// Echo out remaining chars for current match
306
- $ remainingCharacters = substr ($ ret , strlen (trim ($ this ->mostRecentlyEnteredValue ($ fullChoice ))));
306
+ $ remainingCharacters = substr ($ ret , \ strlen (trim ($ this ->mostRecentlyEnteredValue ($ fullChoice ))));
307
307
$ output ->write ($ remainingCharacters );
308
308
$ fullChoice .= $ remainingCharacters ;
309
- $ i = strlen ($ fullChoice );
309
+ $ i = \ strlen ($ fullChoice );
310
310
}
311
311
312
312
if ("\n" === $ c ) {
@@ -330,9 +330,8 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
330
330
331
331
$ tempRet = $ ret ;
332
332
333
- if ($ question instanceof ChoiceQuestion && $ question ->isMultiselect ())
334
- {
335
- $ tempRet = $ this ->mostRecentlyEnteredValue ($ ret );
333
+ if ($ question instanceof ChoiceQuestion && $ question ->isMultiselect ()) {
334
+ $ tempRet = $ this ->mostRecentlyEnteredValue ($ fullChoice );
336
335
}
337
336
338
337
$ numMatches = 0 ;
@@ -353,7 +352,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
353
352
// Save cursor position
354
353
$ output ->write ("\0337 " );
355
354
// Write highlighted text, complete the partially entered response
356
- $ charactersEntered = strlen (trim ($ this ->mostRecentlyEnteredValue ($ ret )));
355
+ $ charactersEntered = \ strlen (trim ($ this ->mostRecentlyEnteredValue ($ fullChoice )));
357
356
$ output ->write ('<hl> ' .OutputFormatter::escapeTrailingBackslash (substr ($ matches [$ ofs ], $ charactersEntered )).'</hl> ' );
358
357
// Restore cursor position
359
358
$ output ->write ("\0338 " );
@@ -366,27 +365,28 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
366
365
return $ fullChoice ;
367
366
}
368
367
369
- /**
370
- * Determine the most recent value the user entered
371
- * @param $ret
372
- * @return string
373
- */
374
- private function mostRecentlyEnteredValue ($ ret )
375
- {
376
- $ tempRet = $ ret ;
377
-
378
- if (strpos ($ ret , ', ' ) !== false )
379
- {
380
- $ choices = explode (', ' , $ ret );
381
- $ lastChoice = trim ($ choices [count ($ choices ) - 1 ]);
382
- if (strlen ($ lastChoice ) > 0 )
383
- {
384
- $ tempRet = $ lastChoice ;
385
- }
386
- }
387
-
388
- return $ tempRet ;
389
- }
368
+ /**
369
+ * Determine the most recent value the user entered.
370
+ *
371
+ * @param $entered
372
+ *
373
+ * @return string
374
+ */
375
+ private function mostRecentlyEnteredValue ($ entered )
376
+ {
377
+ $ tempEntered = $ entered ;
378
+
379
+ if (false !== strpos ($ entered , ', ' )) {
380
+ $ choices = explode (', ' , $ entered );
381
+ $ lastChoice = trim ($ choices [\count ($ choices ) - 1 ]);
382
+
383
+ if (\strlen ($ lastChoice ) > 0 ) {
384
+ $ tempEntered = $ lastChoice ;
385
+ }
386
+ }
387
+
388
+ return $ tempEntered ;
389
+ }
390
390
391
391
/**
392
392
* Gets a hidden response from user.
0 commit comments