@@ -99,7 +99,7 @@ public function __construct(string $message, array $trace, string $file, bool $l
99
99
$ this ->getOriginalFilesStack ();
100
100
array_splice ($ this ->originalFilesStack , 0 , $ j , [$ this ->triggeringFile ]);
101
101
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 ))) {
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 ))) {
103
103
$ this ->triggeringFile = (new \ReflectionClass ($ m [1 ]))->getFileName ();
104
104
array_unshift ($ this ->originalFilesStack , $ this ->triggeringFile );
105
105
}
@@ -137,7 +137,7 @@ public function __construct(string $message, array $trace, string $file, bool $l
137
137
return ;
138
138
}
139
139
140
- if (!isset ($ line ['class ' ], $ trace [$ i - 2 ]['function ' ]) || ! str_starts_with ($ line ['class ' ], SymfonyTestsListenerFor::class)) {
140
+ if (!isset ($ line ['class ' ], $ trace [$ i - 2 ]['function ' ]) || 0 !== strpos ($ line ['class ' ], SymfonyTestsListenerFor::class)) {
141
141
$ this ->originClass = isset ($ line ['object ' ]) ? \get_class ($ line ['object ' ]) : $ line ['class ' ];
142
142
$ this ->originMethod = $ line ['function ' ];
143
143
@@ -161,7 +161,7 @@ private function lineShouldBeSkipped(array $line): bool
161
161
}
162
162
$ class = $ line ['class ' ];
163
163
164
- return 'ReflectionMethod ' === $ class || str_starts_with ($ class , 'PHPUnit \\' );
164
+ return 'ReflectionMethod ' === $ class || 0 === strpos ($ class , 'PHPUnit \\' );
165
165
}
166
166
167
167
public function originatesFromDebugClassLoader (): bool
@@ -191,7 +191,7 @@ public function originatingClass(): string
191
191
192
192
$ class = $ this ->originClass ;
193
193
194
- return str_contains ($ class , "@anonymous \0" ) ? (get_parent_class ($ class ) ?: key (class_implements ($ class )) ?: 'class ' ).'@anonymous ' : $ class ;
194
+ return false !== strpos ($ class , "@anonymous \0" ) ? (get_parent_class ($ class ) ?: key (class_implements ($ class )) ?: 'class ' ).'@anonymous ' : $ class ;
195
195
}
196
196
197
197
public function originatingMethod (): string
@@ -217,9 +217,9 @@ public function isLegacy(): bool
217
217
$ method = $ this ->originatingMethod ();
218
218
$ groups = class_exists (Groups::class, false ) ? [new Groups (), 'groups ' ] : [Test::class, 'getGroups ' ];
219
219
220
- return str_starts_with ($ method , 'testLegacy ' )
221
- || str_starts_with ($ method , 'provideLegacy ' )
222
- || str_starts_with ($ method , 'getLegacy ' )
220
+ return 0 === strpos ($ method , 'testLegacy ' )
221
+ || 0 === strpos ($ method , 'provideLegacy ' )
222
+ || 0 === strpos ($ method , 'getLegacy ' )
223
223
|| strpos ($ this ->originClass , '\Legacy ' )
224
224
|| \in_array ('legacy ' , $ groups ($ this ->originClass , $ method ), true );
225
225
}
@@ -230,10 +230,10 @@ public function isMuted(): bool
230
230
return false ;
231
231
}
232
232
if (isset ($ this ->trace [1 ]['class ' ])) {
233
- return str_starts_with ($ this ->trace [1 ]['class ' ], 'PHPUnit \\' );
233
+ return 0 === strpos ($ this ->trace [1 ]['class ' ], 'PHPUnit \\' );
234
234
}
235
235
236
- return str_contains ($ this ->triggeringFile , \DIRECTORY_SEPARATOR .'vendor ' .\DIRECTORY_SEPARATOR .'phpunit ' .\DIRECTORY_SEPARATOR );
236
+ return false !== strpos ($ this ->triggeringFile , \DIRECTORY_SEPARATOR .'vendor ' .\DIRECTORY_SEPARATOR .'phpunit ' .\DIRECTORY_SEPARATOR );
237
237
}
238
238
239
239
/**
@@ -302,7 +302,7 @@ private function getPackage(string $path): string
302
302
{
303
303
$ path = realpath ($ path ) ?: $ path ;
304
304
foreach (self ::getVendors () as $ vendorRoot ) {
305
- if (str_starts_with ($ path , $ vendorRoot )) {
305
+ if (0 === strpos ($ path , $ vendorRoot )) {
306
306
$ relativePath = substr ($ path , \strlen ($ vendorRoot ) + 1 );
307
307
$ vendor = strstr ($ relativePath , \DIRECTORY_SEPARATOR , true );
308
308
if (false === $ vendor ) {
@@ -328,7 +328,7 @@ private static function getVendors(): array
328
328
self ::$ vendors [] = \dirname ((new \ReflectionClass (DebugClassLoader::class))->getFileName ());
329
329
}
330
330
foreach (get_declared_classes () as $ class ) {
331
- if ('C ' === $ class [0 ] && str_starts_with ($ class , 'ComposerAutoloaderInit ' )) {
331
+ if ('C ' === $ class [0 ] && 0 === strpos ($ class , 'ComposerAutoloaderInit ' )) {
332
332
$ r = new \ReflectionClass ($ class );
333
333
$ v = \dirname ($ r ->getFileName (), 2 );
334
334
if (file_exists ($ v .'/composer/installed.json ' )) {
@@ -343,7 +343,7 @@ private static function getVendors(): array
343
343
}
344
344
foreach ($ paths as $ path ) {
345
345
foreach (self ::$ vendors as $ vendor ) {
346
- if (! str_starts_with ($ path , $ vendor )) {
346
+ if (0 !== strpos ($ path , $ vendor )) {
347
347
self ::$ internalPaths [] = $ path ;
348
348
}
349
349
}
@@ -373,13 +373,13 @@ private function getPathType(string $path): string
373
373
return self ::PATH_TYPE_UNDETERMINED ;
374
374
}
375
375
foreach (self ::getVendors () as $ vendor ) {
376
- if (str_starts_with ($ realPath , $ vendor ) && false !== strpbrk (substr ($ realPath , \strlen ($ vendor ), 1 ), '/ ' .\DIRECTORY_SEPARATOR )) {
376
+ if (0 === strpos ($ realPath , $ vendor ) && false !== strpbrk (substr ($ realPath , \strlen ($ vendor ), 1 ), '/ ' .\DIRECTORY_SEPARATOR )) {
377
377
return self ::PATH_TYPE_VENDOR ;
378
378
}
379
379
}
380
380
381
381
foreach (self ::$ internalPaths as $ internalPath ) {
382
- if (str_starts_with ($ realPath , $ internalPath )) {
382
+ if (0 === strpos ($ realPath , $ internalPath )) {
383
383
return self ::PATH_TYPE_SELF ;
384
384
}
385
385
}
0 commit comments