@@ -33,13 +33,15 @@ public function process(ContainerBuilder $container): void
3333 }
3434
3535 $ themesPathMap = [
36- '_override ' => $ container ->getParameter ('ibexa.design.templates.override_paths ' ),
36+ '_override ' => ( array ) $ container ->getParameter ('ibexa.design.templates.override_paths ' ),
3737 ];
3838 $ finder = new Finder ();
3939 // Look for themes in bundles.
40- foreach ($ container ->getParameter ('kernel.bundles ' ) as $ bundleName => $ bundleClass ) {
40+ foreach (( array ) $ container ->getParameter ('kernel.bundles ' ) as $ bundleName => $ bundleClass ) {
4141 $ bundleReflection = new ReflectionClass ($ bundleClass );
42- $ bundleViewsDir = \dirname ($ bundleReflection ->getFileName ()) . '/Resources/views ' ;
42+ $ filename = $ bundleReflection ->getFileName ();
43+ assert (is_string ($ filename ));
44+ $ bundleViewsDir = \dirname ($ filename ) . '/Resources/views ' ;
4345 $ themeDir = $ bundleViewsDir . '/themes ' ;
4446 if (!is_dir ($ themeDir )) {
4547 continue ;
@@ -53,9 +55,9 @@ public function process(ContainerBuilder $container): void
5355
5456 $ twigLoaderDef = $ container ->findDefinition (TwigThemeLoader::class);
5557 // Now look for themes at application level
56- $ appLevelThemesDir = $ container ->getParameterBag ()-> resolveValue (
57- $ container -> getParameter ( ' twig.default_path ' ) . ' /themes '
58- );
58+ $ twigDefaultPath = $ container ->getParameter ( ' twig.default_path ' );
59+ assert ( is_string ( $ twigDefaultPath ));
60+ $ appLevelThemesDir = $ container -> getParameterBag ()-> resolveValue ( $ twigDefaultPath . ' /themes ' );
5961
6062 if (is_dir ($ appLevelThemesDir )) {
6163 foreach ((new Finder ())->directories ()->in ($ appLevelThemesDir )->depth ('== 0 ' ) as $ directoryInfo ) {
@@ -69,14 +71,17 @@ public function process(ContainerBuilder $container): void
6971
7072 // Now merge with already configured template theme paths
7173 // Template theme paths defined via config will always have less priority than convention based paths
72- $ themesPathMap = array_merge_recursive ($ themesPathMap , $ container ->getParameter ('ibexa.design.templates.path_map ' ));
74+ $ themesPathMap = array_merge_recursive (
75+ $ themesPathMap ,
76+ (array )$ container ->getParameter ('ibexa.design.templates.path_map ' ),
77+ );
7378
7479 // De-duplicate the map
7580 foreach ($ themesPathMap as $ theme => &$ paths ) {
7681 $ paths = array_unique ($ paths );
7782 }
7883
79- foreach ($ container ->getParameter ('ibexa.design.list ' ) as $ designName => $ themeFallback ) {
84+ foreach (( array ) $ container ->getParameter ('ibexa.design.list ' ) as $ designName => $ themeFallback ) {
8085 // Always add _override theme first.
8186 array_unshift ($ themeFallback , '_override ' );
8287 foreach ($ themeFallback as $ theme ) {
@@ -91,7 +96,7 @@ public function process(ContainerBuilder $container): void
9196 }
9297 }
9398
94- $ themesList = $ container ->getParameter ('ibexa.design.themes.list ' );
99+ $ themesList = ( array ) $ container ->getParameter ('ibexa.design.themes.list ' );
95100 $ container ->setParameter (
96101 'ibexa.design.themes.list ' ,
97102 array_unique (
0 commit comments