@@ -75,7 +75,7 @@ protected function parse()
7575 $ this ->parseArgument ($ token );
7676 } elseif ($ parseOptions && '-- ' == $ token ) {
7777 $ parseOptions = false ;
78- } elseif ($ parseOptions && 0 === strpos ($ token , '-- ' )) {
78+ } elseif ($ parseOptions && str_starts_with ($ token , '-- ' )) {
7979 $ this ->parseLongOption ($ token );
8080 } elseif ($ parseOptions && '- ' === $ token [0 ] && '- ' !== $ token ) {
8181 $ this ->parseShortOption ($ token );
@@ -243,7 +243,7 @@ public function getFirstArgument()
243243 $ isOption = false ;
244244 foreach ($ this ->tokens as $ i => $ token ) {
245245 if ($ token && '- ' === $ token [0 ]) {
246- if (false !== strpos ($ token , '= ' ) || !isset ($ this ->tokens [$ i + 1 ])) {
246+ if (str_contains ($ token , '= ' ) || !isset ($ this ->tokens [$ i + 1 ])) {
247247 continue ;
248248 }
249249
@@ -285,8 +285,8 @@ public function hasParameterOption($values, $onlyParams = false)
285285 // Options with values:
286286 // For long options, test for '--option=' at beginning
287287 // For short options, test for '-o' at beginning
288- $ leading = 0 === strpos ($ value , '-- ' ) ? $ value .'= ' : $ value ;
289- if ($ token === $ value || '' !== $ leading && 0 === strpos ($ token , $ leading )) {
288+ $ leading = str_starts_with ($ value , '-- ' ) ? $ value .'= ' : $ value ;
289+ if ($ token === $ value || '' !== $ leading && str_starts_with ($ token , $ leading )) {
290290 return true ;
291291 }
292292 }
@@ -316,8 +316,8 @@ public function getParameterOption($values, $default = false, $onlyParams = fals
316316 // Options with values:
317317 // For long options, test for '--option=' at beginning
318318 // For short options, test for '-o' at beginning
319- $ leading = 0 === strpos ($ value , '-- ' ) ? $ value .'= ' : $ value ;
320- if ('' !== $ leading && 0 === strpos ($ token , $ leading )) {
319+ $ leading = str_starts_with ($ value , '-- ' ) ? $ value .'= ' : $ value ;
320+ if ('' !== $ leading && str_starts_with ($ token , $ leading )) {
321321 return substr ($ token , \strlen ($ leading ));
322322 }
323323 }
0 commit comments