@@ -104,7 +104,7 @@ public function __construct($message, array $trace, $file, $languageDeprecation
104
104
$ this ->getOriginalFilesStack ();
105
105
array_splice ($ this ->originalFilesStack , 0 , $ j , [$ this ->triggeringFile ]);
106
106
107
- 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 ))) {
107
+ 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 ))) {
108
108
$ this ->triggeringFile = (new \ReflectionClass ($ m [1 ]))->getFileName ();
109
109
array_unshift ($ this ->originalFilesStack , $ this ->triggeringFile );
110
110
}
@@ -142,7 +142,7 @@ public function __construct($message, array $trace, $file, $languageDeprecation
142
142
return ;
143
143
}
144
144
145
- if (!isset ($ line ['class ' ], $ trace [$ i - 2 ]['function ' ]) || ! str_starts_with ($ line ['class ' ], SymfonyTestsListenerFor::class)) {
145
+ if (!isset ($ line ['class ' ], $ trace [$ i - 2 ]['function ' ]) || 0 !== strpos ($ line ['class ' ], SymfonyTestsListenerFor::class)) {
146
146
$ this ->originClass = isset ($ line ['object ' ]) ? \get_class ($ line ['object ' ]) : $ line ['class ' ];
147
147
$ this ->originMethod = $ line ['function ' ];
148
148
@@ -169,7 +169,7 @@ private function lineShouldBeSkipped(array $line)
169
169
}
170
170
$ class = $ line ['class ' ];
171
171
172
- return 'ReflectionMethod ' === $ class || str_starts_with ($ class , 'PHPUnit \\' );
172
+ return 'ReflectionMethod ' === $ class || 0 === strpos ($ class , 'PHPUnit \\' );
173
173
}
174
174
175
175
/**
@@ -211,7 +211,7 @@ public function originatingClass()
211
211
212
212
$ class = $ this ->originClass ;
213
213
214
- return str_contains ($ class , "@anonymous \0" ) ? (get_parent_class ($ class ) ?: key (class_implements ($ class )) ?: 'class ' ).'@anonymous ' : $ class ;
214
+ return false !== strpos ($ class , "@anonymous \0" ) ? (get_parent_class ($ class ) ?: key (class_implements ($ class )) ?: 'class ' ).'@anonymous ' : $ class ;
215
215
}
216
216
217
217
/**
@@ -246,9 +246,9 @@ public function isLegacy()
246
246
$ method = $ this ->originatingMethod ();
247
247
$ groups = class_exists (Groups::class, false ) ? [new Groups (), 'groups ' ] : [Test::class, 'getGroups ' ];
248
248
249
- return str_starts_with ($ method , 'testLegacy ' )
250
- || str_starts_with ($ method , 'provideLegacy ' )
251
- || str_starts_with ($ method , 'getLegacy ' )
249
+ return 0 === strpos ($ method , 'testLegacy ' )
250
+ || 0 === strpos ($ method , 'provideLegacy ' )
251
+ || 0 === strpos ($ method , 'getLegacy ' )
252
252
|| strpos ($ this ->originClass , '\Legacy ' )
253
253
|| \in_array ('legacy ' , $ groups ($ this ->originClass , $ method ), true );
254
254
}
@@ -262,10 +262,10 @@ public function isMuted()
262
262
return false ;
263
263
}
264
264
if (isset ($ this ->trace [1 ]['class ' ])) {
265
- return str_starts_with ($ this ->trace [1 ]['class ' ], 'PHPUnit \\' );
265
+ return 0 === strpos ($ this ->trace [1 ]['class ' ], 'PHPUnit \\' );
266
266
}
267
267
268
- return str_contains ($ this ->triggeringFile , \DIRECTORY_SEPARATOR .'vendor ' .\DIRECTORY_SEPARATOR .'phpunit ' .\DIRECTORY_SEPARATOR );
268
+ return false !== strpos ($ this ->triggeringFile , \DIRECTORY_SEPARATOR .'vendor ' .\DIRECTORY_SEPARATOR .'phpunit ' .\DIRECTORY_SEPARATOR );
269
269
}
270
270
271
271
/**
@@ -340,7 +340,7 @@ private function getPackage($path)
340
340
{
341
341
$ path = realpath ($ path ) ?: $ path ;
342
342
foreach (self ::getVendors () as $ vendorRoot ) {
343
- if (str_starts_with ($ path , $ vendorRoot )) {
343
+ if (0 === strpos ($ path , $ vendorRoot )) {
344
344
$ relativePath = substr ($ path , \strlen ($ vendorRoot ) + 1 );
345
345
$ vendor = strstr ($ relativePath , \DIRECTORY_SEPARATOR , true );
346
346
if (false === $ vendor ) {
@@ -366,7 +366,7 @@ private static function getVendors()
366
366
self ::$ vendors [] = \dirname ((new \ReflectionClass (DebugClassLoader::class))->getFileName ());
367
367
}
368
368
foreach (get_declared_classes () as $ class ) {
369
- if ('C ' === $ class [0 ] && str_starts_with ($ class , 'ComposerAutoloaderInit ' )) {
369
+ if ('C ' === $ class [0 ] && 0 === strpos ($ class , 'ComposerAutoloaderInit ' )) {
370
370
$ r = new \ReflectionClass ($ class );
371
371
$ v = \dirname ($ r ->getFileName (), 2 );
372
372
if (file_exists ($ v .'/composer/installed.json ' )) {
@@ -381,7 +381,7 @@ private static function getVendors()
381
381
}
382
382
foreach ($ paths as $ path ) {
383
383
foreach (self ::$ vendors as $ vendor ) {
384
- if (! str_starts_with ($ path , $ vendor )) {
384
+ if (0 !== strpos ($ path , $ vendor )) {
385
385
self ::$ internalPaths [] = $ path ;
386
386
}
387
387
}
@@ -416,13 +416,13 @@ private function getPathType($path)
416
416
return self ::PATH_TYPE_UNDETERMINED ;
417
417
}
418
418
foreach (self ::getVendors () as $ vendor ) {
419
- if (str_starts_with ($ realPath , $ vendor ) && false !== strpbrk (substr ($ realPath , \strlen ($ vendor ), 1 ), '/ ' .\DIRECTORY_SEPARATOR )) {
419
+ if (0 === strpos ($ realPath , $ vendor ) && false !== strpbrk (substr ($ realPath , \strlen ($ vendor ), 1 ), '/ ' .\DIRECTORY_SEPARATOR )) {
420
420
return self ::PATH_TYPE_VENDOR ;
421
421
}
422
422
}
423
423
424
424
foreach (self ::$ internalPaths as $ internalPath ) {
425
- if (str_starts_with ($ realPath , $ internalPath )) {
425
+ if (0 === strpos ($ realPath , $ internalPath )) {
426
426
return self ::PATH_TYPE_SELF ;
427
427
}
428
428
}
0 commit comments