@@ -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 );
@@ -254,7 +254,7 @@ public function getFirstArgument()
254254 $ isOption = false ;
255255 foreach ($ this ->tokens as $ i => $ token ) {
256256 if ($ token && '- ' === $ token [0 ]) {
257- if (false !== strpos ($ token , '= ' ) || !isset ($ this ->tokens [$ i + 1 ])) {
257+ if (str_contains ($ token , '= ' ) || !isset ($ this ->tokens [$ i + 1 ])) {
258258 continue ;
259259 }
260260
@@ -296,8 +296,8 @@ public function hasParameterOption($values, bool $onlyParams = false)
296296 // Options with values:
297297 // For long options, test for '--option=' at beginning
298298 // For short options, test for '-o' at beginning
299- $ leading = 0 === strpos ($ value , '-- ' ) ? $ value .'= ' : $ value ;
300- if ($ token === $ value || '' !== $ leading && 0 === strpos ($ token , $ leading )) {
299+ $ leading = str_starts_with ($ value , '-- ' ) ? $ value .'= ' : $ value ;
300+ if ($ token === $ value || '' !== $ leading && str_starts_with ($ token , $ leading )) {
301301 return true ;
302302 }
303303 }
@@ -327,8 +327,8 @@ public function getParameterOption($values, $default = false, bool $onlyParams =
327327 // Options with values:
328328 // For long options, test for '--option=' at beginning
329329 // For short options, test for '-o' at beginning
330- $ leading = 0 === strpos ($ value , '-- ' ) ? $ value .'= ' : $ value ;
331- if ('' !== $ leading && 0 === strpos ($ token , $ leading )) {
330+ $ leading = str_starts_with ($ value , '-- ' ) ? $ value .'= ' : $ value ;
331+ if ('' !== $ leading && str_starts_with ($ token , $ leading )) {
332332 return substr ($ token , \strlen ($ leading ));
333333 }
334334 }
0 commit comments