Revert "[TASK] Avoid slow array functions in loops"
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / ResourceCompressor.php
index 3e42d5a..2d0dae8 100644 (file)
@@ -142,7 +142,7 @@ class ResourceCompressor
                 'allWrap' => ''
             ];
             // place the merged stylesheet on top of the stylesheets
-            $cssFiles[$targetFile] = $concatenatedOptions;
+            $cssFiles = array_merge($cssFiles, [$targetFile => $concatenatedOptions]);
         }
         return $cssFiles;
     }
@@ -194,7 +194,7 @@ class ResourceCompressor
                     'async' => $concatenatedJsFileIsAsync && $allFilesToConcatenateAreAsync,
                 ];
                 // place the merged javascript on top of the JS files
-                $jsFiles[$targetFile] = $concatenatedOptions;
+                $jsFiles = array_merge([$targetFile => $concatenatedOptions], $jsFiles);
             }
         }
         return $jsFiles;