From 1baf508db463573fff55d5aa66d3e61dd2b1fa9b Mon Sep 17 00:00:00 2001 From: Evert Harmeling Date: Fri, 17 Nov 2023 11:36:39 +0100 Subject: [PATCH] Fix config validation is keys are used defining the "root_sass" paths --- .../SymfonycastsSassExtension.php | 2 +- tests/ConfigurationTest.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/DependencyInjection/SymfonycastsSassExtension.php b/src/DependencyInjection/SymfonycastsSassExtension.php index c07d9a4..fdadc0e 100644 --- a/src/DependencyInjection/SymfonycastsSassExtension.php +++ b/src/DependencyInjection/SymfonycastsSassExtension.php @@ -61,7 +61,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->end() ->validate() ->ifTrue(static function (array $paths): bool { - if (1 === \count($paths)) { + if (1 === \count($paths) || !\array_is_list($paths)) { return false; } diff --git a/tests/ConfigurationTest.php b/tests/ConfigurationTest.php index f1b724e..0ca35fb 100644 --- a/tests/ConfigurationTest.php +++ b/tests/ConfigurationTest.php @@ -47,6 +47,18 @@ public function testMultipleSassRootPaths(): void ]); } + public function testMultipleSassRootPathsWithIdentifier(): void + { + $this->assertConfigurationIsValid([ + 'symfonycasts_sass' => [ + 'root_sass' => [ + 'website' => '%kernel.project_dir%/assets/scss/app.scss', + 'admin' => '%kernel.project_dir%/assets/admin/scss/app.scss', + ], + ], + ]); + } + public function testMultipleSassRootPathsWithSameFilename(): void { $this->assertConfigurationIsInvalid([