@@ -225,7 +225,7 @@ private function displayGeneralText(SymfonyStyle $io, string $filter = null)
225
225
foreach ($ types as $ index => $ type ) {
226
226
$ items = [];
227
227
foreach ($ this ->twig ->{'get ' .ucfirst ($ type )}() as $ name => $ entity ) {
228
- if (!$ filter || false !== strpos ($ name , $ filter )) {
228
+ if (!$ filter || str_contains ($ name , $ filter )) {
229
229
$ items [$ name ] = $ name .$ this ->getPrettyMetadata ($ type , $ entity , $ decorated );
230
230
}
231
231
}
@@ -259,7 +259,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
259
259
$ data = [];
260
260
foreach ($ types as $ type ) {
261
261
foreach ($ this ->twig ->{'get ' .ucfirst ($ type )}() as $ name => $ entity ) {
262
- if (!$ filter || false !== strpos ($ name , $ filter )) {
262
+ if (!$ filter || str_contains ($ name , $ filter )) {
263
263
$ data [$ type ][$ name ] = $ this ->getMetadata ($ type , $ entity );
264
264
}
265
265
}
@@ -409,7 +409,7 @@ private function findWrongBundleOverrides(): array
409
409
$ folders = glob ($ this ->rootDir .'/Resources/*/views ' , \GLOB_ONLYDIR );
410
410
$ relativePath = ltrim (substr ($ this ->rootDir .\DIRECTORY_SEPARATOR .'Resources/ ' , \strlen ($ this ->projectDir )), \DIRECTORY_SEPARATOR );
411
411
$ bundleNames = array_reduce ($ folders , function ($ carry , $ absolutePath ) use ($ relativePath ) {
412
- if (0 === strpos ($ absolutePath , $ this ->projectDir )) {
412
+ if (str_starts_with ($ absolutePath , $ this ->projectDir )) {
413
413
$ name = basename (\dirname ($ absolutePath ));
414
414
$ path = ltrim ($ relativePath .$ name , \DIRECTORY_SEPARATOR );
415
415
$ carry [$ name ] = $ path ;
@@ -425,7 +425,7 @@ private function findWrongBundleOverrides(): array
425
425
$ folders = glob ($ this ->twigDefaultPath .'/bundles/* ' , \GLOB_ONLYDIR );
426
426
$ relativePath = ltrim (substr ($ this ->twigDefaultPath .'/bundles/ ' , \strlen ($ this ->projectDir )), \DIRECTORY_SEPARATOR );
427
427
$ bundleNames = array_reduce ($ folders , function ($ carry , $ absolutePath ) use ($ relativePath ) {
428
- if (0 === strpos ($ absolutePath , $ this ->projectDir )) {
428
+ if (str_starts_with ($ absolutePath , $ this ->projectDir )) {
429
429
$ name = basename ($ absolutePath );
430
430
$ path = ltrim ($ relativePath .$ name , \DIRECTORY_SEPARATOR );
431
431
$ carry [$ name ] = $ path ;
@@ -555,7 +555,7 @@ private function findAlternatives(string $name, array $collection): array
555
555
$ alternatives = [];
556
556
foreach ($ collection as $ item ) {
557
557
$ lev = levenshtein ($ name , $ item );
558
- if ($ lev <= \strlen ($ name ) / 3 || false !== strpos ($ item , $ name )) {
558
+ if ($ lev <= \strlen ($ name ) / 3 || str_contains ($ item , $ name )) {
559
559
$ alternatives [$ item ] = isset ($ alternatives [$ item ]) ? $ alternatives [$ item ] - $ lev : $ lev ;
560
560
}
561
561
}
@@ -569,7 +569,7 @@ private function findAlternatives(string $name, array $collection): array
569
569
570
570
private function getRelativePath (string $ path ): string
571
571
{
572
- if (null !== $ this ->projectDir && 0 === strpos ($ path , $ this ->projectDir )) {
572
+ if (null !== $ this ->projectDir && str_starts_with ($ path , $ this ->projectDir )) {
573
573
return ltrim (substr ($ path , \strlen ($ this ->projectDir )), \DIRECTORY_SEPARATOR );
574
574
}
575
575
0 commit comments