@@ -99,7 +99,7 @@ public function __construct(string $message, array $trace, string $file, bool $l
9999 $ this ->getOriginalFilesStack ();
100100 array_splice ($ this ->originalFilesStack , 0 , $ j , [$ this ->triggeringFile ]);
101101
102- if (preg_match ('/(?|"([^"]++)" that is deprecated|should implement method "(?:static )?([^:]++))/ ' , $ message , $ m ) || (false === strpos ($ message , '()" will return ' ) && false === strpos ($ message , 'native return type declaration ' ) && preg_match ('/^(?:The|Method) "([^":]++)/ ' , $ message , $ m ))) {
102+ if (preg_match ('/(?|"([^"]++)" that is deprecated|should implement method "(?:static )?([^:]++))/ ' , $ message , $ m ) || (! str_contains ($ message , '()" will return ' ) && ! str_contains ($ message , 'native return type declaration ' ) && preg_match ('/^(?:The|Method) "([^":]++)/ ' , $ message , $ m ))) {
103103 $ this ->triggeringFile = (new \ReflectionClass ($ m [1 ]))->getFileName ();
104104 array_unshift ($ this ->originalFilesStack , $ this ->triggeringFile );
105105 }
@@ -137,7 +137,7 @@ public function __construct(string $message, array $trace, string $file, bool $l
137137 return ;
138138 }
139139
140- if (!isset ($ line ['class ' ], $ trace [$ i - 2 ]['function ' ]) || 0 !== strpos ($ line ['class ' ], SymfonyTestsListenerFor::class)) {
140+ if (!isset ($ line ['class ' ], $ trace [$ i - 2 ]['function ' ]) || ! str_starts_with ($ line ['class ' ], SymfonyTestsListenerFor::class)) {
141141 $ this ->originClass = isset ($ line ['object ' ]) ? \get_class ($ line ['object ' ]) : $ line ['class ' ];
142142 $ this ->originMethod = $ line ['function ' ];
143143
@@ -161,7 +161,7 @@ private function lineShouldBeSkipped(array $line): bool
161161 }
162162 $ class = $ line ['class ' ];
163163
164- return 'ReflectionMethod ' === $ class || 0 === strpos ($ class , 'PHPUnit \\' );
164+ return 'ReflectionMethod ' === $ class || str_starts_with ($ class , 'PHPUnit \\' );
165165 }
166166
167167 public function originatesFromDebugClassLoader (): bool
@@ -191,7 +191,7 @@ public function originatingClass(): string
191191
192192 $ class = $ this ->originClass ;
193193
194- return false !== strpos ($ class , "@anonymous \0" ) ? (get_parent_class ($ class ) ?: key (class_implements ($ class )) ?: 'class ' ).'@anonymous ' : $ class ;
194+ return str_contains ($ class , "@anonymous \0" ) ? (get_parent_class ($ class ) ?: key (class_implements ($ class )) ?: 'class ' ).'@anonymous ' : $ class ;
195195 }
196196
197197 public function originatingMethod (): string
@@ -217,9 +217,9 @@ public function isLegacy(): bool
217217 $ method = $ this ->originatingMethod ();
218218 $ groups = class_exists (Groups::class, false ) ? [new Groups (), 'groups ' ] : [Test::class, 'getGroups ' ];
219219
220- return 0 === strpos ($ method , 'testLegacy ' )
221- || 0 === strpos ($ method , 'provideLegacy ' )
222- || 0 === strpos ($ method , 'getLegacy ' )
220+ return str_starts_with ($ method , 'testLegacy ' )
221+ || str_starts_with ($ method , 'provideLegacy ' )
222+ || str_starts_with ($ method , 'getLegacy ' )
223223 || strpos ($ this ->originClass , '\Legacy ' )
224224 || \in_array ('legacy ' , $ groups ($ this ->originClass , $ method ), true );
225225 }
@@ -230,10 +230,10 @@ public function isMuted(): bool
230230 return false ;
231231 }
232232 if (isset ($ this ->trace [1 ]['class ' ])) {
233- return 0 === strpos ($ this ->trace [1 ]['class ' ], 'PHPUnit \\' );
233+ return str_starts_with ($ this ->trace [1 ]['class ' ], 'PHPUnit \\' );
234234 }
235235
236- return false !== strpos ($ this ->triggeringFile , \DIRECTORY_SEPARATOR .'vendor ' .\DIRECTORY_SEPARATOR .'phpunit ' .\DIRECTORY_SEPARATOR );
236+ return str_contains ($ this ->triggeringFile , \DIRECTORY_SEPARATOR .'vendor ' .\DIRECTORY_SEPARATOR .'phpunit ' .\DIRECTORY_SEPARATOR );
237237 }
238238
239239 /**
@@ -302,7 +302,7 @@ private function getPackage(string $path): string
302302 {
303303 $ path = realpath ($ path ) ?: $ path ;
304304 foreach (self ::getVendors () as $ vendorRoot ) {
305- if (0 === strpos ($ path , $ vendorRoot )) {
305+ if (str_starts_with ($ path , $ vendorRoot )) {
306306 $ relativePath = substr ($ path , \strlen ($ vendorRoot ) + 1 );
307307 $ vendor = strstr ($ relativePath , \DIRECTORY_SEPARATOR , true );
308308 if (false === $ vendor ) {
@@ -328,7 +328,7 @@ private static function getVendors(): array
328328 self ::$ vendors [] = \dirname ((new \ReflectionClass (DebugClassLoader::class))->getFileName ());
329329 }
330330 foreach (get_declared_classes () as $ class ) {
331- if ('C ' === $ class [0 ] && 0 === strpos ($ class , 'ComposerAutoloaderInit ' )) {
331+ if ('C ' === $ class [0 ] && str_starts_with ($ class , 'ComposerAutoloaderInit ' )) {
332332 $ r = new \ReflectionClass ($ class );
333333 $ v = \dirname ($ r ->getFileName (), 2 );
334334 if (file_exists ($ v .'/composer/installed.json ' )) {
@@ -343,7 +343,7 @@ private static function getVendors(): array
343343 }
344344 foreach ($ paths as $ path ) {
345345 foreach (self ::$ vendors as $ vendor ) {
346- if (0 !== strpos ($ path , $ vendor )) {
346+ if (! str_starts_with ($ path , $ vendor )) {
347347 self ::$ internalPaths [] = $ path ;
348348 }
349349 }
@@ -373,13 +373,13 @@ private function getPathType(string $path): string
373373 return self ::PATH_TYPE_UNDETERMINED ;
374374 }
375375 foreach (self ::getVendors () as $ vendor ) {
376- if (0 === strpos ($ realPath , $ vendor ) && false !== strpbrk (substr ($ realPath , \strlen ($ vendor ), 1 ), '/ ' .\DIRECTORY_SEPARATOR )) {
376+ if (str_starts_with ($ realPath , $ vendor ) && false !== strpbrk (substr ($ realPath , \strlen ($ vendor ), 1 ), '/ ' .\DIRECTORY_SEPARATOR )) {
377377 return self ::PATH_TYPE_VENDOR ;
378378 }
379379 }
380380
381381 foreach (self ::$ internalPaths as $ internalPath ) {
382- if (0 === strpos ($ realPath , $ internalPath )) {
382+ if (str_starts_with ($ realPath , $ internalPath )) {
383383 return self ::PATH_TYPE_SELF ;
384384 }
385385 }
0 commit comments