@@ -211,7 +211,7 @@ private function displayGeneralText(SymfonyStyle $io, string $filter = null)
211
211
foreach ($ types as $ index => $ type ) {
212
212
$ items = [];
213
213
foreach ($ this ->twig ->{'get ' .ucfirst ($ type )}() as $ name => $ entity ) {
214
- if (!$ filter || false !== strpos ($ name , $ filter )) {
214
+ if (!$ filter || str_contains ($ name , $ filter )) {
215
215
$ items [$ name ] = $ name .$ this ->getPrettyMetadata ($ type , $ entity , $ decorated );
216
216
}
217
217
}
@@ -245,7 +245,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
245
245
$ data = [];
246
246
foreach ($ types as $ type ) {
247
247
foreach ($ this ->twig ->{'get ' .ucfirst ($ type )}() as $ name => $ entity ) {
248
- if (!$ filter || false !== strpos ($ name , $ filter )) {
248
+ if (!$ filter || str_contains ($ name , $ filter )) {
249
249
$ data [$ type ][$ name ] = $ this ->getMetadata ($ type , $ entity );
250
250
}
251
251
}
@@ -395,7 +395,7 @@ private function findWrongBundleOverrides(): array
395
395
$ folders = glob ($ this ->twigDefaultPath .'/bundles/* ' , \GLOB_ONLYDIR );
396
396
$ relativePath = ltrim (substr ($ this ->twigDefaultPath .'/bundles/ ' , \strlen ($ this ->projectDir )), \DIRECTORY_SEPARATOR );
397
397
$ bundleNames = array_reduce ($ folders , function ($ carry , $ absolutePath ) use ($ relativePath ) {
398
- if (0 === strpos ($ absolutePath , $ this ->projectDir )) {
398
+ if (str_starts_with ($ absolutePath , $ this ->projectDir )) {
399
399
$ name = basename ($ absolutePath );
400
400
$ path = ltrim ($ relativePath .$ name , \DIRECTORY_SEPARATOR );
401
401
$ carry [$ name ] = $ path ;
@@ -525,7 +525,7 @@ private function findAlternatives(string $name, array $collection): array
525
525
$ alternatives = [];
526
526
foreach ($ collection as $ item ) {
527
527
$ lev = levenshtein ($ name , $ item );
528
- if ($ lev <= \strlen ($ name ) / 3 || false !== strpos ($ item , $ name )) {
528
+ if ($ lev <= \strlen ($ name ) / 3 || str_contains ($ item , $ name )) {
529
529
$ alternatives [$ item ] = isset ($ alternatives [$ item ]) ? $ alternatives [$ item ] - $ lev : $ lev ;
530
530
}
531
531
}
@@ -539,7 +539,7 @@ private function findAlternatives(string $name, array $collection): array
539
539
540
540
private function getRelativePath (string $ path ): string
541
541
{
542
- if (null !== $ this ->projectDir && 0 === strpos ($ path , $ this ->projectDir )) {
542
+ if (null !== $ this ->projectDir && str_starts_with ($ path , $ this ->projectDir )) {
543
543
return ltrim (substr ($ path , \strlen ($ this ->projectDir )), \DIRECTORY_SEPARATOR );
544
544
}
545
545
0 commit comments