@@ -225,7 +225,7 @@ private function displayGeneralText(SymfonyStyle $io, string $filter = null)
225225 foreach ($ types as $ index => $ type ) {
226226 $ items = [];
227227 foreach ($ this ->twig ->{'get ' .ucfirst ($ type )}() as $ name => $ entity ) {
228- if (!$ filter || false !== strpos ($ name , $ filter )) {
228+ if (!$ filter || str_contains ($ name , $ filter )) {
229229 $ items [$ name ] = $ name .$ this ->getPrettyMetadata ($ type , $ entity , $ decorated );
230230 }
231231 }
@@ -259,7 +259,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
259259 $ data = [];
260260 foreach ($ types as $ type ) {
261261 foreach ($ this ->twig ->{'get ' .ucfirst ($ type )}() as $ name => $ entity ) {
262- if (!$ filter || false !== strpos ($ name , $ filter )) {
262+ if (!$ filter || str_contains ($ name , $ filter )) {
263263 $ data [$ type ][$ name ] = $ this ->getMetadata ($ type , $ entity );
264264 }
265265 }
@@ -409,7 +409,7 @@ private function findWrongBundleOverrides(): array
409409 $ folders = glob ($ this ->rootDir .'/Resources/*/views ' , \GLOB_ONLYDIR );
410410 $ relativePath = ltrim (substr ($ this ->rootDir .\DIRECTORY_SEPARATOR .'Resources/ ' , \strlen ($ this ->projectDir )), \DIRECTORY_SEPARATOR );
411411 $ bundleNames = array_reduce ($ folders , function ($ carry , $ absolutePath ) use ($ relativePath ) {
412- if (0 === strpos ($ absolutePath , $ this ->projectDir )) {
412+ if (str_starts_with ($ absolutePath , $ this ->projectDir )) {
413413 $ name = basename (\dirname ($ absolutePath ));
414414 $ path = ltrim ($ relativePath .$ name , \DIRECTORY_SEPARATOR );
415415 $ carry [$ name ] = $ path ;
@@ -425,7 +425,7 @@ private function findWrongBundleOverrides(): array
425425 $ folders = glob ($ this ->twigDefaultPath .'/bundles/* ' , \GLOB_ONLYDIR );
426426 $ relativePath = ltrim (substr ($ this ->twigDefaultPath .'/bundles/ ' , \strlen ($ this ->projectDir )), \DIRECTORY_SEPARATOR );
427427 $ bundleNames = array_reduce ($ folders , function ($ carry , $ absolutePath ) use ($ relativePath ) {
428- if (0 === strpos ($ absolutePath , $ this ->projectDir )) {
428+ if (str_starts_with ($ absolutePath , $ this ->projectDir )) {
429429 $ name = basename ($ absolutePath );
430430 $ path = ltrim ($ relativePath .$ name , \DIRECTORY_SEPARATOR );
431431 $ carry [$ name ] = $ path ;
@@ -555,7 +555,7 @@ private function findAlternatives(string $name, array $collection): array
555555 $ alternatives = [];
556556 foreach ($ collection as $ item ) {
557557 $ lev = levenshtein ($ name , $ item );
558- if ($ lev <= \strlen ($ name ) / 3 || false !== strpos ($ item , $ name )) {
558+ if ($ lev <= \strlen ($ name ) / 3 || str_contains ($ item , $ name )) {
559559 $ alternatives [$ item ] = isset ($ alternatives [$ item ]) ? $ alternatives [$ item ] - $ lev : $ lev ;
560560 }
561561 }
@@ -569,7 +569,7 @@ private function findAlternatives(string $name, array $collection): array
569569
570570 private function getRelativePath (string $ path ): string
571571 {
572- if (null !== $ this ->projectDir && 0 === strpos ($ path , $ this ->projectDir )) {
572+ if (null !== $ this ->projectDir && str_starts_with ($ path , $ this ->projectDir )) {
573573 return ltrim (substr ($ path , \strlen ($ this ->projectDir )), \DIRECTORY_SEPARATOR );
574574 }
575575
0 commit comments