@@ -72,7 +72,7 @@ protected function parse()
7272 $ this ->parseArgument ($ token );
7373 } elseif ($ parseOptions && '-- ' == $ token ) {
7474 $ parseOptions = false ;
75- } elseif ($ parseOptions && 0 === strpos ($ token , '-- ' )) {
75+ } elseif ($ parseOptions && str_starts_with ($ token , '-- ' )) {
7676 $ this ->parseLongOption ($ token );
7777 } elseif ($ parseOptions && '- ' === $ token [0 ] && '- ' !== $ token ) {
7878 $ this ->parseShortOption ($ token );
@@ -264,7 +264,7 @@ public function getFirstArgument()
264264 $ isOption = false ;
265265 foreach ($ this ->tokens as $ i => $ token ) {
266266 if ($ token && '- ' === $ token [0 ]) {
267- if (false !== strpos ($ token , '= ' ) || !isset ($ this ->tokens [$ i + 1 ])) {
267+ if (str_contains ($ token , '= ' ) || !isset ($ this ->tokens [$ i + 1 ])) {
268268 continue ;
269269 }
270270
@@ -306,8 +306,8 @@ public function hasParameterOption($values, bool $onlyParams = false)
306306 // Options with values:
307307 // For long options, test for '--option=' at beginning
308308 // For short options, test for '-o' at beginning
309- $ leading = 0 === strpos ($ value , '-- ' ) ? $ value .'= ' : $ value ;
310- if ($ token === $ value || '' !== $ leading && 0 === strpos ($ token , $ leading )) {
309+ $ leading = str_starts_with ($ value , '-- ' ) ? $ value .'= ' : $ value ;
310+ if ($ token === $ value || '' !== $ leading && str_starts_with ($ token , $ leading )) {
311311 return true ;
312312 }
313313 }
@@ -337,8 +337,8 @@ public function getParameterOption($values, $default = false, bool $onlyParams =
337337 // Options with values:
338338 // For long options, test for '--option=' at beginning
339339 // For short options, test for '-o' at beginning
340- $ leading = 0 === strpos ($ value , '-- ' ) ? $ value .'= ' : $ value ;
341- if ('' !== $ leading && 0 === strpos ($ token , $ leading )) {
340+ $ leading = str_starts_with ($ value , '-- ' ) ? $ value .'= ' : $ value ;
341+ if ('' !== $ leading && str_starts_with ($ token , $ leading )) {
342342 return substr ($ token , \strlen ($ leading ));
343343 }
344344 }
0 commit comments