diff --git a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php index b3461e3ab4a22..fd06e20c5c7d7 100644 --- a/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php +++ b/app/code/Magento/Deploy/Package/Processor/PreProcessor/Css.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Deploy\Package\Processor\PreProcessor; use Magento\Deploy\Console\DeployStaticOptions; @@ -92,8 +93,7 @@ public function process(Package $package, array $options) } /** - * Checks if there are imports of CSS files or images within the given CSS file - * which exists in the current package + * Checks if there are imports of CSS files or images within the given CSS file which exists in the current package. * * @param PackageFile $parentFile * @param Package $package @@ -180,11 +180,13 @@ private function buildMap($packagePath, $filePath, $fullPath) */ private function collectFileMap($fileName) { - $result = isset($this->map[$fileName]) ? $this->map[$fileName] : []; + $result = [$this->map[$fileName] ?? []]; + foreach ($result as $path) { - $result = array_merge($result, $this->collectFileMap($path)); + $result[] = $this->collectFileMap($path); } - return array_unique($result); + + return array_unique(array_merge(...$result)); } /**