@@ -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
@@ -147,7 +147,7 @@ public function __construct(string $message, array $trace, string $file, bool $l
147147 $ test = $ line ['args ' ][0 ] ?? null ;
148148
149149 if (($ test instanceof TestCase || $ test instanceof TestSuite) && ('trigger_error ' !== $ trace [$ i - 2 ]['function ' ] || isset ($ trace [$ i - 2 ]['class ' ]))) {
150- $ this ->originClass = \get_class ( $ test) ;
150+ $ this ->originClass = $ test::class ;
151151 $ this ->originMethod = $ test ->getName ();
152152 }
153153 }
@@ -159,7 +159,7 @@ private function lineShouldBeSkipped(array $line): bool
159159 }
160160 $ class = $ line ['class ' ];
161161
162- return 'ReflectionMethod ' === $ class || 0 === strpos ($ class , 'PHPUnit \\' );
162+ return 'ReflectionMethod ' === $ class || str_starts_with ($ class , 'PHPUnit \\' );
163163 }
164164
165165 public function originatesFromDebugClassLoader (): bool
@@ -189,7 +189,7 @@ public function originatingClass(): string
189189
190190 $ class = $ this ->originClass ;
191191
192- return false !== strpos ($ class , "@anonymous \0" ) ? (get_parent_class ($ class ) ?: key (class_implements ($ class )) ?: 'class ' ).'@anonymous ' : $ class ;
192+ return str_contains ($ class , "@anonymous \0" ) ? (get_parent_class ($ class ) ?: key (class_implements ($ class )) ?: 'class ' ).'@anonymous ' : $ class ;
193193 }
194194
195195 public function originatingMethod (): string
@@ -215,9 +215,9 @@ public function isLegacy(): bool
215215 $ method = $ this ->originatingMethod ();
216216 $ groups = class_exists (Groups::class, false ) ? [new Groups (), 'groups ' ] : [Test::class, 'getGroups ' ];
217217
218- return 0 === strpos ($ method , 'testLegacy ' )
219- || 0 === strpos ($ method , 'provideLegacy ' )
220- || 0 === strpos ($ method , 'getLegacy ' )
218+ return str_starts_with ($ method , 'testLegacy ' )
219+ || str_starts_with ($ method , 'provideLegacy ' )
220+ || str_starts_with ($ method , 'getLegacy ' )
221221 || strpos ($ this ->originClass , '\Legacy ' )
222222 || \in_array ('legacy ' , $ groups ($ this ->originClass , $ method ), true );
223223 }
@@ -228,10 +228,10 @@ public function isMuted(): bool
228228 return false ;
229229 }
230230 if (isset ($ this ->trace [1 ]['class ' ])) {
231- return 0 === strpos ($ this ->trace [1 ]['class ' ], 'PHPUnit \\' );
231+ return str_starts_with ($ this ->trace [1 ]['class ' ], 'PHPUnit \\' );
232232 }
233233
234- return false !== strpos ($ this ->triggeringFile , \DIRECTORY_SEPARATOR .'vendor ' .\DIRECTORY_SEPARATOR .'phpunit ' .\DIRECTORY_SEPARATOR );
234+ return str_contains ($ this ->triggeringFile , \DIRECTORY_SEPARATOR .'vendor ' .\DIRECTORY_SEPARATOR .'phpunit ' .\DIRECTORY_SEPARATOR );
235235 }
236236
237237 /**
@@ -300,7 +300,7 @@ private function getPackage(string $path): string
300300 {
301301 $ path = realpath ($ path ) ?: $ path ;
302302 foreach (self ::getVendors () as $ vendorRoot ) {
303- if (0 === strpos ($ path , $ vendorRoot )) {
303+ if (str_starts_with ($ path , $ vendorRoot )) {
304304 $ relativePath = substr ($ path , \strlen ($ vendorRoot ) + 1 );
305305 $ vendor = strstr ($ relativePath , \DIRECTORY_SEPARATOR , true );
306306 if (false === $ vendor ) {
@@ -326,7 +326,7 @@ private static function getVendors(): array
326326 self ::$ vendors [] = \dirname ((new \ReflectionClass (DebugClassLoader::class))->getFileName ());
327327 }
328328 foreach (get_declared_classes () as $ class ) {
329- if ('C ' === $ class [0 ] && 0 === strpos ($ class , 'ComposerAutoloaderInit ' )) {
329+ if ('C ' === $ class [0 ] && str_starts_with ($ class , 'ComposerAutoloaderInit ' )) {
330330 $ r = new \ReflectionClass ($ class );
331331 $ v = \dirname ($ r ->getFileName (), 2 );
332332 if (file_exists ($ v .'/composer/installed.json ' )) {
@@ -341,7 +341,7 @@ private static function getVendors(): array
341341 }
342342 foreach ($ paths as $ path ) {
343343 foreach (self ::$ vendors as $ vendor ) {
344- if (0 !== strpos ($ path , $ vendor )) {
344+ if (! str_starts_with ($ path , $ vendor )) {
345345 self ::$ internalPaths [] = $ path ;
346346 }
347347 }
@@ -371,13 +371,13 @@ private function getPathType(string $path): string
371371 return self ::PATH_TYPE_UNDETERMINED ;
372372 }
373373 foreach (self ::getVendors () as $ vendor ) {
374- if (0 === strpos ($ realPath , $ vendor ) && false !== strpbrk (substr ($ realPath , \strlen ($ vendor ), 1 ), '/ ' .\DIRECTORY_SEPARATOR )) {
374+ if (str_starts_with ($ realPath , $ vendor ) && false !== strpbrk (substr ($ realPath , \strlen ($ vendor ), 1 ), '/ ' .\DIRECTORY_SEPARATOR )) {
375375 return self ::PATH_TYPE_VENDOR ;
376376 }
377377 }
378378
379379 foreach (self ::$ internalPaths as $ internalPath ) {
380- if (0 === strpos ($ realPath , $ internalPath )) {
380+ if (str_starts_with ($ realPath , $ internalPath )) {
381381 return self ::PATH_TYPE_SELF ;
382382 }
383383 }
0 commit comments