Revert "[TASK] Avoid slow array functions in loops" 15/61815/3
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 25 Sep 2019 16:37:53 +0000 (18:37 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 26 Sep 2019 06:18:55 +0000 (08:18 +0200)
This reverts commit e531ddce9a6874e5ad289ae58f6474565dab9218.

Reason for revert: immature merge

Change-Id: Ia31248587537a502ffdfc84761bacd7095999642
Resolves: #89276
Reverts: #89056
Releases: master
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61815
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
52 files changed:
typo3/sysext/backend/Classes/Clipboard/Clipboard.php
typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php
typo3/sysext/backend/Classes/Controller/Page/TreeController.php
typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaTypesShowitem.php
typo3/sysext/backend/Classes/Form/Wizard/SuggestWizardDefaultReceiver.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/backend/Classes/View/PageTreeView.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/ClassLoadingInformationGenerator.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php
typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php
typo3/sysext/core/Classes/Localization/Locales.php
typo3/sysext/core/Classes/Localization/LocalizationFactory.php
typo3/sysext/core/Classes/Resource/ResourceCompressor.php
typo3/sysext/core/Classes/Resource/Service/UserFileMountService.php
typo3/sysext/core/Classes/Routing/Enhancer/VariableProcessor.php
typo3/sysext/core/Classes/TypoScript/TemplateService.php
typo3/sysext/core/Classes/Utility/ArrayUtility.php
typo3/sysext/core/Resources/PHP/ClassMapGenerator.php
typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php
typo3/sysext/extbase/Classes/Reflection/PropertyInfo/Extractor/PhpDocPropertyTypeExtractor.php
typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php
typo3/sysext/extensionmanager/Classes/Service/ExtensionManagementService.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/form/Classes/Domain/Model/Renderable/AbstractCompositeRenderable.php
typo3/sysext/form/Classes/Mvc/Configuration/YamlSource.php
typo3/sysext/form/Classes/Service/TranslationService.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/AbstractTestCase.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerLinkGeneratorTest.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequestTest.php
typo3/sysext/frontend/Tests/Functional/Tca/ContentVisibleFieldsTest.php
typo3/sysext/install/Classes/Configuration/FeatureManager.php
typo3/sysext/install/Classes/FolderStructure/DirectoryNode.php
typo3/sysext/install/Classes/Service/LocalConfigurationValueService.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
typo3/sysext/recycler/Classes/Domain/Model/DeletedRecords.php
typo3/sysext/reports/Classes/Report/Status/Status.php
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/scheduler/Classes/Task/OptimizeDatabaseTableAdditionalFieldProvider.php
typo3/sysext/seo/Classes/XmlSitemap/RecordsXmlSitemapDataProvider.php
typo3/sysext/t3editor/Classes/Registry/AddonRegistry.php
typo3/sysext/t3editor/Classes/T3editor.php
typo3/sysext/workspaces/Classes/Dependency/ElementEntity.php
typo3/sysext/workspaces/Classes/Service/Dependency/CollectionService.php
typo3/sysext/workspaces/Classes/Service/GridDataService.php
typo3/sysext/workspaces/Classes/Service/RecordService.php

index d596903..9e5c3a3 100644 (file)
@@ -372,7 +372,7 @@ class Clipboard
      */
     public function getContentFromTab($pad)
     {
-        $lines = [[]];
+        $lines = [];
         if (is_array($this->clipData[$pad]['el'] ?? false)) {
             foreach ($this->clipData[$pad]['el'] as $k => $v) {
                 if ($v) {
@@ -434,7 +434,7 @@ class Clipboard
 
                             $localizationData = $this->getLocalizations($table, $rec);
                             if (!empty($localizationData)) {
-                                $lines[] = $localizationData;
+                                $lines = array_merge($lines, $localizationData);
                             }
                         } else {
                             unset($this->clipData[$pad]['el'][$k]);
@@ -445,7 +445,7 @@ class Clipboard
             }
         }
         $this->endClipboard();
-        return array_merge(...$lines);
+        return $lines;
     }
 
     /**
index 0c08047..87cd007 100644 (file)
@@ -360,7 +360,7 @@ class NewContentElementController
      */
     protected function getWizards(): array
     {
-        $wizardItems = [[]];
+        $wizardItems = [];
         if (is_array($this->config)) {
             $wizards = $this->config['wizardItems.'] ?? [];
             $appendWizards = $this->getAppendWizards($wizards['elements.'] ?? []);
@@ -393,14 +393,13 @@ class NewContentElementController
                         }
                     }
                     if (!empty($groupItems)) {
-                        $wizardItems[] = [$groupKey => $this->getWizardGroupHeader($wizardGroup)];
-                        $wizardItems[] = $groupItems;
+                        $wizardItems[$groupKey] = $this->getWizardGroupHeader($wizardGroup);
+                        $wizardItems = array_merge($wizardItems, $groupItems);
                     }
                 }
             }
         }
         // Remove elements where preset values are not allowed:
-        $wizardItems = array_merge(...$wizardItems);
         $this->removeInvalidWizardItems($wizardItems);
         return $wizardItems;
     }
index 51119e8..79f8c53 100644 (file)
@@ -193,12 +193,12 @@ class TreeController
         } else {
             $entryPoints = $this->getAllEntryPointPageTrees();
         }
-        $items = [[]];
+        $items = [];
         foreach ($entryPoints as $page) {
-            $items[] = $this->pagesToFlatArray($page, (int)$page['uid']);
+            $items = array_merge($items, $this->pagesToFlatArray($page, (int)$page['uid']));
         }
 
-        return new JsonResponse(array_merge(...$items));
+        return new JsonResponse($items);
     }
 
     /**
@@ -280,8 +280,8 @@ class TreeController
             $prefix = htmlspecialchars('[' . $pageId . '] ');
         }
 
-        $items = [[]];
-        $items[] = [[
+        $items = [];
+        $items[] = [
             // Used to track if the tree item is collapsed or not
             'stateIdentifier' => $identifier,
             'identifier' => $pageId,
@@ -305,13 +305,13 @@ class TreeController
             'isMountPoint' => $depth === 0,
             'mountPoint' => $entryPoint,
             'workspaceId' => !empty($page['t3ver_oid']) ? $page['t3ver_oid'] : $pageId,
-        ]];
+        ];
         if (!$stopPageTree) {
             foreach ($page['_children'] as $child) {
-                $items[] = $this->pagesToFlatArray($child, $entryPoint, $depth + 1, ['backgroundColor' => $backgroundColor]);
+                $items = array_merge($items, $this->pagesToFlatArray($child, $entryPoint, $depth + 1, ['backgroundColor' => $backgroundColor]));
             }
         }
-        return array_merge(...$items);
+        return $items;
     }
 
     /**
index 88454a5..6b2b8ca 100644 (file)
@@ -752,7 +752,7 @@ abstract class AbstractItemProvider
     protected function getExcludeFields()
     {
         $languageService = $this->getLanguageService();
-        $finalExcludeArray = [[]];
+        $finalExcludeArray = [];
 
         // Fetch translations for table names
         $tableToTranslation = [];
@@ -836,11 +836,11 @@ abstract class AbstractItemProvider
                     }
                     return 0;
                 });
-                $finalExcludeArray[] = $excludeArrayTable;
+                $finalExcludeArray = array_merge($finalExcludeArray, $excludeArrayTable);
             }
         }
 
-        return array_merge(...$finalExcludeArray);
+        return $finalExcludeArray;
     }
 
     /**
index 0756da2..4ff4294 100644 (file)
@@ -183,7 +183,7 @@ class TcaTypesShowitem implements FormDataProviderInterface
      */
     protected function removeFieldsByBitmaskExcludeBits(array $result, $bitmaskValue, $recordTypeValue)
     {
-        $removeListArray = [[]];
+        $removeListArray = [];
         $bitmaskValue = MathUtility::forceIntegerInRange($bitmaskValue, 0);
         $excludeListBitsArray = $this->processedTca['types'][$recordTypeValue]['bitmask_excludelist_bits'];
         foreach ($excludeListBitsArray as $bitKey => $excludeList) {
@@ -193,10 +193,9 @@ class TcaTypesShowitem implements FormDataProviderInterface
             if (!$isNegative && ($bitmaskValue & pow(2, $bit))
                 || $isNegative && !($bitmaskValue & pow(2, $bit))
             ) {
-                $removeListArray[] = GeneralUtility::trimExplode(',', $excludeList, true);
+                $removeListArray = array_merge($removeListArray, GeneralUtility::trimExplode(',', $excludeList, true));
             }
         }
-        $removeListArray = array_merge(...$removeListArray);
         $result = $this->removeFields($result, $removeListArray, $recordTypeValue);
         return $this->removeFieldsFromPalettes($result, $removeListArray);
     }
index 1ced64c..eadcbf7 100644 (file)
@@ -322,9 +322,9 @@ class SuggestWizardDefaultReceiver
             }
 
             $pageIds = array_keys($rows);
-            $pages[] = $pageIds;
+            $pages = array_merge($pages, $pageIds);
         }
-        return array_merge(...$pages);
+        return $pages;
     }
 
     /**
index 17c522c..dbfab63 100644 (file)
@@ -599,14 +599,14 @@ function jumpToUrl(URL) {
         if (is_array($GLOBALS['TBE_STYLES']['skins'])) {
             // loop over all registered skins
             foreach ($GLOBALS['TBE_STYLES']['skins'] as $skinExtKey => $skin) {
-                $skinStylesheetDirs = [$this->stylesheetsSkins];
+                $skinStylesheetDirs = $this->stylesheetsSkins;
                 // Skins can add custom stylesheetDirectories using
                 // $GLOBALS['TBE_STYLES']['skins']['your_extension_key']['stylesheetDirectories']
                 if (is_array($skin['stylesheetDirectories'])) {
-                    $skinStylesheetDirs[] = $skin['stylesheetDirectories'];
+                    $skinStylesheetDirs = array_merge($skinStylesheetDirs, $skin['stylesheetDirectories']);
                 }
                 // Add all registered directories
-                foreach (array_merge(...$skinStylesheetDirs) as $stylesheetDir) {
+                foreach ($skinStylesheetDirs as $stylesheetDir) {
                     // for EXT:myskin/stylesheets/ syntax
                     if (strpos($stylesheetDir, 'EXT:') === 0) {
                         list($extKey, $path) = explode('/', substr($stylesheetDir, 4), 2);
index a07c52e..d671cb7 100644 (file)
@@ -348,7 +348,7 @@ abstract class AbstractTreeView
         $this->initializePositionSaving();
         // Init done:
         $lastMountPointPid = 0;
-        $treeArr = [[]];
+        $treeArr = [];
         // Traverse mounts:
         foreach ($this->MOUNTS as $idx => $uid) {
             // Set first:
@@ -396,10 +396,10 @@ abstract class AbstractTreeView
                     $this->getTree($uid, 999, $depthData);
                 }
                 // Add tree:
-                $treeArr[] = $this->tree;
+                $treeArr = array_merge($treeArr, $this->tree);
             }
         }
-        return $this->printTree(array_merge(...$treeArr));
+        return $this->printTree($treeArr);
     }
 
     /**
index 01b55fe..bbdef5a 100644 (file)
@@ -266,14 +266,14 @@ class FolderTreeView extends AbstractTreeView
         // Get stored tree structure AND updating it if needed according to incoming PM GET var.
         $this->initializePositionSaving();
         // Init done:
-        $treeItems = [[]];
+        $treeItems = [];
         // Traverse mounts:
         foreach ($this->storages as $storageObject) {
             $this->getBrowseableTreeForStorage($storageObject);
             // Add tree:
-            $treeItems[] = $this->tree;
+            $treeItems = array_merge($treeItems, $this->tree);
         }
-        return $this->printTree(array_merge(...$treeItems));
+        return $this->printTree($treeItems);
     }
 
     /**
index 5468bc3..9061d9b 100644 (file)
@@ -3764,21 +3764,21 @@ class PageLayoutView implements LoggerAwareInterface
         $tree->init('AND ' . $perms_clause);
         $tree->makeHTML = 0;
         $tree->fieldArray = ['uid', 'php_tree_stop'];
-        $idList = [[]];
+        $idList = [];
 
         $allowedMounts = !$backendUser->isAdmin() && $id === 0
             ? $backendUser->returnWebmounts()
             : [$id];
 
         foreach ($allowedMounts as $allowedMount) {
-            $idList[] = [$allowedMount];
+            $idList[] = $allowedMount;
             if ($depth) {
                 $tree->getTree($allowedMount, $depth, '');
             }
-            $idList[] = $tree->ids;
+            $idList = array_merge($idList, $tree->ids);
         }
 
-        return array_merge(...$idList);
+        return $idList;
     }
 
     /**
index 051a7d9..bc901ce 100644 (file)
@@ -269,7 +269,7 @@ class PageTreeView extends BrowseTreeView
         // Get stored tree structure AND updating it if needed according to incoming PM GET var.
         $this->initializePositionSaving();
         // Init done:
-        $treeArr = [[]];
+        $treeArr = [];
         // Traverse mounts:
         $firstHtml = '';
         foreach ($this->MOUNTS as $idx => $uid) {
@@ -310,9 +310,9 @@ class PageTreeView extends BrowseTreeView
                     $this->getTree($uid);
                 }
                 // Add tree:
-                $treeArr[] = $this->tree;
+                $treeArr = array_merge($treeArr, $this->tree);
             }
         }
-        return $this->printTree(array_merge(...$treeArr));
+        return $this->printTree($treeArr);
     }
 }
index 7c55d3c..a59e5c7 100644 (file)
@@ -540,7 +540,6 @@ class Bootstrap
             // substr is necessary, because the php frontend wraps php code around the cache value
             $routesFromPackages = unserialize(substr($codeCache->get($cacheIdentifier), 6, -2));
         } else {
-            $routesFromPackages = [[]];
             // Loop over all packages and check for a Configuration/Backend/Routes.php file
             $packageManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Package\PackageManager::class);
             $packages = $packageManager->getActivePackages();
@@ -549,7 +548,7 @@ class Bootstrap
                 if (file_exists($routesFileNameForPackage)) {
                     $definedRoutesInPackage = require $routesFileNameForPackage;
                     if (is_array($definedRoutesInPackage)) {
-                        $routesFromPackages[] = $definedRoutesInPackage;
+                        $routesFromPackages = array_merge($routesFromPackages, $definedRoutesInPackage);
                     }
                 }
                 $routesFileNameForPackage = $package->getPackagePath() . 'Configuration/Backend/AjaxRoutes.php';
@@ -559,15 +558,12 @@ class Bootstrap
                         foreach ($definedRoutesInPackage as $routeIdentifier => $routeOptions) {
                             // prefix the route with "ajax_" as "namespace"
                             $routeOptions['path'] = '/ajax' . $routeOptions['path'];
-                            $routeOptions['ajax'] = true;
-                            $routesFromPackages[] = [
-                                'ajax_' . $routeIdentifier => $routeOptions,
-                            ];
+                            $routesFromPackages['ajax_' . $routeIdentifier] = $routeOptions;
+                            $routesFromPackages['ajax_' . $routeIdentifier]['ajax'] = true;
                         }
                     }
                 }
             }
-            $routesFromPackages = array_merge(...$routesFromPackages);
             // Store the data from all packages in the cache
             $codeCache->set($cacheIdentifier, serialize($routesFromPackages));
         }
index 42654ed..7902cbd 100644 (file)
@@ -69,14 +69,14 @@ class ClassLoadingInformationGenerator
      */
     public function buildClassLoadingInformationForPackage(PackageInterface $package, $useRelativePaths = false)
     {
-        $classMap = [[]];
+        $classMap = [];
         $psr4 = [];
         $packagePath = $package->getPackagePath();
         $manifest = $package->getValueFromComposerManifest();
 
         if (empty($manifest->autoload)) {
             // Legacy mode: Scan the complete extension directory for class files
-            $classMap[] = $this->createClassMap($packagePath, $useRelativePaths, !$this->isDevMode);
+            $classMap = $this->createClassMap($packagePath, $useRelativePaths, !$this->isDevMode);
         } else {
             $autoloadPsr4 = $this->getAutoloadSectionFromManifest($manifest, 'psr-4');
             if (!empty($autoloadPsr4)) {
@@ -91,7 +91,7 @@ class ClassLoadingInformationGenerator
                         }
                         if (!empty($namespaceRealPath) && is_dir($namespaceRealPath)) {
                             // Add all prs-4 classes to the class map for improved class loading performance
-                            $classMap[] = $this->createClassMap($namespacePath, $useRelativePaths, false, $namespacePrefix);
+                            $classMap = array_merge($classMap, $this->createClassMap($namespacePath, $useRelativePaths, false, $namespacePrefix));
                         }
                     }
                 }
@@ -99,12 +99,12 @@ class ClassLoadingInformationGenerator
             $autoloadClassmap = $this->getAutoloadSectionFromManifest($manifest, 'classmap');
             if (!empty($autoloadClassmap)) {
                 foreach ($autoloadClassmap as $path) {
-                    $classMap[] = $this->createClassMap($packagePath . $path, $useRelativePaths);
+                    $classMap = array_merge($classMap, $this->createClassMap($packagePath . $path, $useRelativePaths));
                 }
             }
         }
 
-        return ['classMap' => array_merge(...$classMap), 'psr-4' => $psr4];
+        return ['classMap' => $classMap, 'psr-4' => $psr4];
     }
 
     /**
@@ -219,15 +219,13 @@ class ClassLoadingInformationGenerator
 return array(
 
 EOF;
-        $classMap = [[]];
-        $psr4 = [[]];
+        $classMap = [];
+        $psr4 = [];
         foreach ($this->activeExtensionPackages as $package) {
             $classLoadingInformation = $this->buildClassLoadingInformationForPackage($package, true);
-            $classMap[] = $classLoadingInformation['classMap'];
-            $psr4[] = $classLoadingInformation['psr-4'];
+            $classMap = array_merge($classMap, $classLoadingInformation['classMap']);
+            $psr4 = array_merge($psr4, $classLoadingInformation['psr-4']);
         }
-        $classMap = array_merge(...$classMap);
-        $psr4 = array_merge(...$psr4);
 
         ksort($classMap);
         ksort($psr4);
@@ -290,16 +288,16 @@ EOF;
      */
     public function buildClassAliasMapFile()
     {
-        $aliasToClassNameMapping = [[]];
-        $classNameToAliasMapping = [[]];
+        $aliasToClassNameMapping = [];
+        $classNameToAliasMapping = [];
         foreach ($this->activeExtensionPackages as $package) {
             $aliasMappingForPackage = $this->buildClassAliasMapForPackage($package);
-            $aliasToClassNameMapping[] = $aliasMappingForPackage['aliasToClassNameMapping'];
-            $classNameToAliasMapping[] = $aliasMappingForPackage['classNameToAliasMapping'];
+            $aliasToClassNameMapping = array_merge($aliasToClassNameMapping, $aliasMappingForPackage['aliasToClassNameMapping']);
+            $classNameToAliasMapping = array_merge($classNameToAliasMapping, $aliasMappingForPackage['classNameToAliasMapping']);
         }
         $exportArray = [
-            'aliasToClassNameMapping' => array_merge(...$aliasToClassNameMapping),
-            'classNameToAliasMapping' => array_merge(...$classNameToAliasMapping)
+            'aliasToClassNameMapping' => $aliasToClassNameMapping,
+            'classNameToAliasMapping' => $classNameToAliasMapping
         ];
         $fileContent = '<?php' . chr(10) . 'return ';
         $fileContent .= var_export($exportArray, true);
index 1f0370d..72344cb 100644 (file)
@@ -7819,8 +7819,8 @@ class DataHandler implements LoggerAwareInterface
      */
     protected function processClearCacheQueue()
     {
-        $tagsToClear = [[]];
-        $clearCacheCommands = [[]];
+        $tagsToClear = [];
+        $clearCacheCommands = [];
 
         foreach (static::$recordsToClearCacheFor as $table => $uids) {
             foreach (array_unique($uids) as $uid) {
@@ -7832,18 +7832,18 @@ class DataHandler implements LoggerAwareInterface
                 foreach ($pageUids as $originalParent) {
                     list($tagsToClearFromPrepare, $clearCacheCommandsFromPrepare)
                         = $this->prepareCacheFlush($table, $uid, $originalParent);
-                    $tagsToClear[] = $tagsToClearFromPrepare;
-                    $clearCacheCommands[] = $clearCacheCommandsFromPrepare;
+                    $tagsToClear = array_merge($tagsToClear, $tagsToClearFromPrepare);
+                    $clearCacheCommands = array_merge($clearCacheCommands, $clearCacheCommandsFromPrepare);
                 }
             }
         }
 
         /** @var CacheManager $cacheManager */
         $cacheManager = $this->getCacheManager();
-        $cacheManager->flushCachesInGroupByTags('pages', array_keys(array_merge(...$tagsToClear)));
+        $cacheManager->flushCachesInGroupByTags('pages', array_keys($tagsToClear));
 
         // Filter duplicate cache commands from cacheQueue
-        $clearCacheCommands = array_unique(array_merge(...$clearCacheCommands));
+        $clearCacheCommands = array_unique($clearCacheCommands);
         // Execute collected clear cache commands from page TSConfig
         foreach ($clearCacheCommands as $command) {
             $this->clear_cacheCmd($command);
index 782f3d9..ed51e0e 100644 (file)
@@ -271,12 +271,14 @@ class DataMapProcessor
      */
     protected function sanitizeTranslationItem(DataMapItem $item)
     {
-        $fieldNames = [[]];
+        $fieldNames = [];
         foreach ($item->getApplicableScopes() as $scope) {
-            $fieldNames[] = $this->getFieldNamesForItemScope($item, $scope, false);
+            $fieldNames = array_merge(
+                $fieldNames,
+                $this->getFieldNamesForItemScope($item, $scope, false)
+            );
         }
 
-        $fieldNames = array_merge(...$fieldNames);
         $fieldNameMap = array_combine($fieldNames, $fieldNames);
         // separate fields, that are submitted in data-map, but not defined as custom
         $this->sanitizationMap[$item->getTableName()][$item->getId()] = array_intersect_key(
index dc7d153..d4a360e 100644 (file)
@@ -173,7 +173,7 @@ class SchemaMigrator
     {
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
         $tables = $this->parseCreateTableStatements($statements);
-        $result = [[]];
+        $result = [];
 
         foreach ($connectionPool->getConnectionNames() as $connectionName) {
             $connectionMigrator = ConnectionMigrator::create(
@@ -181,10 +181,11 @@ class SchemaMigrator
                 $tables
             );
 
-            $result[] = $connectionMigrator->install($createOnly);
+            $lastResult = $connectionMigrator->install($createOnly);
+            $result = array_merge($result, $lastResult);
         }
 
-        return array_merge(...$result);
+        return $result;
     }
 
     /**
index 2934c3f..abdefcb 100644 (file)
@@ -196,18 +196,18 @@ class Locales implements SingletonInterface
      */
     public function getLocaleDependencies($locale)
     {
-        $dependencies = [[]];
+        $dependencies = [];
         if (isset($this->localeDependencies[$locale])) {
-            $dependencies[] = $this->localeDependencies[$locale];
+            $dependencies = $this->localeDependencies[$locale];
             // Search for dependencies recursively
             $localeDependencies = $dependencies;
             foreach ($localeDependencies as $dependency) {
                 if (isset($this->localeDependencies[$dependency])) {
-                    $dependencies[] = $this->getLocaleDependencies($dependency);
+                    $dependencies = array_merge($dependencies, $this->getLocaleDependencies($dependency));
                 }
             }
         }
-        return array_merge(...$dependencies);
+        return $dependencies;
     }
 
     /**
index b7662f0..8e3c38f 100644 (file)
@@ -117,18 +117,16 @@ class LocalizationFactory implements \TYPO3\CMS\Core\SingletonInterface
      */
     protected function localizationOverride($fileReference, $languageKey, array &$LOCAL_LANG)
     {
-        $overrides = [[]];
+        $overrides = [];
         $fileReferenceWithoutExtension = $this->store->getFileReferenceWithoutExtension($fileReference);
         $locallangXMLOverride = $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'];
         foreach ($this->store->getSupportedExtensions() as $extension) {
             if (isset($locallangXMLOverride[$languageKey][$fileReferenceWithoutExtension . '.' . $extension]) && is_array($locallangXMLOverride[$languageKey][$fileReferenceWithoutExtension . '.' . $extension])) {
-                $overrides[] = $locallangXMLOverride[$languageKey][$fileReferenceWithoutExtension . '.' . $extension];
+                $overrides = array_merge($overrides, $locallangXMLOverride[$languageKey][$fileReferenceWithoutExtension . '.' . $extension]);
             } elseif (isset($locallangXMLOverride[$fileReferenceWithoutExtension . '.' . $extension]) && is_array($locallangXMLOverride[$fileReferenceWithoutExtension . '.' . $extension])) {
-                $overrides[] = $locallangXMLOverride[$fileReferenceWithoutExtension . '.' . $extension];
+                $overrides = array_merge($overrides, $locallangXMLOverride[$fileReferenceWithoutExtension . '.' . $extension]);
             }
         }
-
-        $overrides = array_merge(...$overrides);
         if (!empty($overrides)) {
             foreach ($overrides as $overrideFile) {
                 $languageOverrideFileName = GeneralUtility::getFileAbsFileName($overrideFile);
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;
index 501fcb1..ee85f1c 100644 (file)
@@ -121,7 +121,7 @@ class UserFileMountService
         if ($level > 99) {
             return [];
         }
-        $allFolderItems = [[$parentFolder]];
+        $allFolderItems = [$parentFolder];
         $subFolders = $parentFolder->getSubfolders();
         foreach ($subFolders as $subFolder) {
             try {
@@ -129,9 +129,9 @@ class UserFileMountService
             } catch (InsufficientFolderReadPermissionsException $e) {
                 $subFolderItems = [];
             }
-            $allFolderItems[] = $subFolderItems;
+            $allFolderItems = array_merge($allFolderItems, $subFolderItems);
         }
-        return array_merge(...$allFolderItems);
+        return $allFolderItems;
     }
 
     /**
index 75e46c2..6bc8838 100644 (file)
@@ -340,19 +340,22 @@ class VariableProcessor
             $prefix .= static::LEVEL_DELIMITER;
         }
 
-        $result = [[]];
+        $result = [];
         foreach ($array as $key => $value) {
             if (is_array($value)) {
-                $result[] = $this->deflateArray(
-                    $value,
-                    $prefix . $key . static::LEVEL_DELIMITER
+                $result = array_merge(
+                    $result,
+                    $this->deflateArray(
+                        $value,
+                        $prefix . $key . static::LEVEL_DELIMITER
+                    )
                 );
             } else {
                 $deflatedKey = $this->addHash($prefix . $key);
-                $result[] = [$deflatedKey => $value];
+                $result[$deflatedKey] = $value;
             }
         }
-        return array_merge(...$result);
+        return $result;
     }
 
     /**
index 707c516..9c99abb 100644 (file)
@@ -1084,22 +1084,21 @@ class TemplateService
         }
 
         $paths = $this->templateIncludePaths;
-        $files = [[]];
+        $files = [];
         foreach ($this->constants as &$value) {
             $includeData = Parser\TypoScriptParser::checkIncludeLines($value, 1, true, array_shift($paths));
-            $files[] = $includeData['files'];
+            $files = array_merge($files, $includeData['files']);
             $value = $includeData['typoscript'];
         }
         unset($value);
         $paths = $this->templateIncludePaths;
         foreach ($this->config as &$value) {
             $includeData = Parser\TypoScriptParser::checkIncludeLines($value, 1, true, array_shift($paths));
-            $files[] = $includeData['files'];
+            $files = array_merge($files, $includeData['files']);
             $value = $includeData['typoscript'];
         }
         unset($value);
 
-        $files = array_merge(...$files);
         if (!empty($files)) {
             $files = array_unique($files);
             foreach ($files as $file) {
index 8070122..55c02a6 100644 (file)
@@ -477,23 +477,23 @@ class ArrayUtility
      */
     public static function flatten(array $array, $prefix = '', bool $keepDots = false)
     {
-        $flatArray = [[]];
+        $flatArray = [];
         foreach ($array as $key => $value) {
             if ($keepDots === false) {
                 // Ensure there is no trailing dot:
                 $key = rtrim($key, '.');
             }
             if (!is_array($value)) {
-                $flatArray[] = [$prefix . $key => $value];
+                $flatArray[$prefix . $key] = $value;
             } else {
                 $newPrefix = $prefix . $key;
                 if ($keepDots === false) {
                     $newPrefix = $prefix . $key . '.';
                 }
-                $flatArray[] = self::flatten($value, $newPrefix, $keepDots);
+                $flatArray = array_merge($flatArray, self::flatten($value, $newPrefix, $keepDots));
             }
         }
-        return array_merge(...$flatArray);
+        return $flatArray;
     }
 
     /**
index 1dd6f0e..74b5561 100644 (file)
@@ -37,13 +37,13 @@ class ClassMapGenerator
      */
     public static function dump($dirs, $file)
     {
-        $maps = [[]];
+        $maps = [];
 
         foreach ($dirs as $dir) {
-            $maps[] = static::createMap($dir);
+            $maps = array_merge($maps, static::createMap($dir));
         }
 
-        file_put_contents($file, sprintf('<?php return %s;', var_export(array_merge(...$maps), true)));
+        file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
     }
 
     /**
index 49c8f28..5611fe4 100644 (file)
@@ -309,19 +309,18 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
     protected function untangleFilesArray(array $convolutedFiles)
     {
         $untangledFiles = [];
-        $fieldPaths = [[]];
+        $fieldPaths = [];
         foreach ($convolutedFiles as $firstLevelFieldName => $fieldInformation) {
             if (!is_array($fieldInformation['error'])) {
-                $fieldPaths[] = [[$firstLevelFieldName]];
+                $fieldPaths[] = [$firstLevelFieldName];
             } else {
                 $newFieldPaths = $this->calculateFieldPaths($fieldInformation['error'], $firstLevelFieldName);
                 array_walk($newFieldPaths, function (&$value, $key) {
                     $value = explode('/', $value);
                 });
-                $fieldPaths[] = $newFieldPaths;
+                $fieldPaths = array_merge($fieldPaths, $newFieldPaths);
             }
         }
-        $fieldPaths = array_merge(...$fieldPaths);
         foreach ($fieldPaths as $fieldPath) {
             if (count($fieldPath) === 1) {
                 $fileInformation = $convolutedFiles[$fieldPath[0]];
index 0305647..711a90a 100644 (file)
@@ -90,14 +90,13 @@ class PhpDocPropertyTypeExtractor implements PropertyTypeExtractorInterface
             return null;
         }
 
-        $types = [[]];
+        $types = [];
         /** @var Var_ $tag */
         foreach ($docBlock->getTagsByName('var') as $tag) {
             if ($tag && null !== $tag->getType()) {
-                $types[] = $this->phpDocTypeHelper->getTypes($tag->getType());
+                $types = array_merge($types, $this->phpDocTypeHelper->getTypes($tag->getType()));
             }
         }
-        $types = array_merge(...$types);
 
         if (!isset($types[0])) {
             return null;
index c12180d..3971dc5 100644 (file)
@@ -262,7 +262,7 @@ class LocalizationUtility
      */
     protected static function flattenTypoScriptLabelArray(array $labelValues, string $parentKey = ''): array
     {
-        $result = [[]];
+        $result = [];
         foreach ($labelValues as $key => $labelValue) {
             if (!empty($parentKey)) {
                 if ($key === '_typoScriptNodeValue') {
@@ -273,12 +273,12 @@ class LocalizationUtility
             }
             if (is_array($labelValue)) {
                 $labelValue = self::flattenTypoScriptLabelArray($labelValue, $key);
-                $result[] = $labelValue;
+                $result = array_merge($result, $labelValue);
             } else {
-                $result[] = [$key => $labelValue];
+                $result[$key] = $labelValue;
             }
         }
-        return array_merge(...$result);
+        return $result;
     }
 
     /**
index 8a4c0c7..25e587c 100644 (file)
@@ -180,9 +180,9 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface
             return false;
         }
 
-        $downloadedDependencies = [[]];
-        $updatedDependencies = [[]];
-        $installQueue = [[]];
+        $downloadedDependencies = [];
+        $updatedDependencies = [];
+        $installQueue = [];
 
         // First resolve all dependencies and the sub-dependencies until all queues are empty as new extensions might be
         // added each time
@@ -198,19 +198,19 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface
             if (!empty($copyQueue)) {
                 $this->copyDependencies($copyQueue);
             }
-            $installQueue[] = $this->downloadQueue->resetExtensionInstallStorage();
+            $installQueue = array_merge($this->downloadQueue->resetExtensionInstallStorage(), $installQueue);
             // Get download and update information
             $queue = $this->downloadQueue->resetExtensionQueue();
             if (!empty($queue['download'])) {
-                $downloadedDependencies[] = $this->downloadDependencies($queue['download']);
+                $downloadedDependencies = array_merge($downloadedDependencies, $this->downloadDependencies($queue['download']));
             }
-            $installQueue[] = $this->downloadQueue->resetExtensionInstallStorage();
+            $installQueue = array_merge($this->downloadQueue->resetExtensionInstallStorage(), $installQueue);
             if ($this->automaticInstallationEnabled) {
                 if (!empty($queue['update'])) {
                     $this->downloadDependencies($queue['update']);
-                    $updatedDependencies[] = $this->uninstallDependenciesToBeUpdated($queue['update']);
+                    $updatedDependencies = array_merge($updatedDependencies, $this->uninstallDependenciesToBeUpdated($queue['update']));
                 }
-                $installQueue[] = $this->downloadQueue->resetExtensionInstallStorage();
+                $installQueue = array_merge($this->downloadQueue->resetExtensionInstallStorage(), $installQueue);
             }
         }
 
@@ -221,13 +221,13 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface
 
         // Attach extension to install queue
         $this->downloadQueue->addExtensionToInstallQueue($extension);
-        $installQueue = array_merge($this->downloadQueue->resetExtensionInstallStorage(), ...$installQueue);
+        $installQueue += $this->downloadQueue->resetExtensionInstallStorage();
         $installedDependencies = [];
         if ($this->automaticInstallationEnabled) {
             $installedDependencies = $this->installDependencies($installQueue);
         }
 
-        return array_filter(array_merge($installedDependencies, ...$downloadedDependencies, ...$updatedDependencies));
+        return array_merge($downloadedDependencies, $updatedDependencies, $installedDependencies);
     }
 
     /**
index 4415e65..ec33de8 100644 (file)
@@ -382,15 +382,18 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface
         $updateStatements = $schemaMigrator->getUpdateSuggestions($sqlStatements);
 
         $updateStatements = array_merge_recursive(...array_values($updateStatements));
-        $selectedStatements = [[]];
+        $selectedStatements = [];
         foreach (['add', 'change', 'create_table', 'change_table'] as $action) {
             if (empty($updateStatements[$action])) {
                 continue;
             }
-            $selectedStatements[] = array_combine(array_keys($updateStatements[$action]), array_fill(0, count($updateStatements[$action]), true));
+            $selectedStatements = array_merge(
+                $selectedStatements,
+                array_combine(array_keys($updateStatements[$action]), array_fill(0, count($updateStatements[$action]), true))
+            );
         }
 
-        $schemaMigrator->migrate($sqlStatements, array_merge(...$selectedStatements));
+        $schemaMigrator->migrate($sqlStatements, $selectedStatements);
     }
 
     /**
index 1e9f0ca..5affec7 100644 (file)
@@ -137,14 +137,14 @@ abstract class AbstractCompositeRenderable extends AbstractRenderable implements
      */
     public function getRenderablesRecursively(): array
     {
-        $renderables = [[]];
+        $renderables = [];
         foreach ($this->renderables as $renderable) {
             $renderables[] = $renderable;
             if ($renderable instanceof CompositeRenderableInterface) {
-                $renderables[] = $renderable->getRenderablesRecursively();
+                $renderables = array_merge($renderables, $renderable->getRenderablesRecursively());
             }
         }
-        return array_merge(...$renderables);
+        return $renderables;
     }
 
     /**
index fceccc7..38c78f1 100644 (file)
@@ -62,7 +62,7 @@ class YamlSource
      */
     public function load(array $filesToLoad): array
     {
-        $configuration = [[]];
+        $configuration = [];
         foreach ($filesToLoad as $fileToLoad) {
             if ($fileToLoad instanceof File) {
                 $fileIdentifier = $fileToLoad->getIdentifier();
@@ -90,7 +90,7 @@ class YamlSource
                 $loadedConfiguration = Yaml::parse($rawYamlContent);
 
                 if (is_array($loadedConfiguration)) {
-                    $configuration[] = $loadedConfiguration;
+                    $configuration = array_replace_recursive($configuration, $loadedConfiguration);
                 }
             } catch (ParseException $exception) {
                 throw new ParseErrorException(
@@ -100,7 +100,7 @@ class YamlSource
             }
         }
 
-        $configuration = ArrayUtility::convertBooleanStringsToBooleanRecursive(array_replace_recursive(...$configuration));
+        $configuration = ArrayUtility::convertBooleanStringsToBooleanRecursive($configuration);
         return $configuration;
     }
 
index c1783ca..80e7a06 100644 (file)
@@ -625,19 +625,19 @@ class TranslationService implements SingletonInterface
      */
     protected function flattenTypoScriptLabelArray(array $labelValues, string $parentKey = ''): array
     {
-        $result = [[]];
+        $result = [];
         foreach ($labelValues as $key => $labelValue) {
             if (!empty($parentKey)) {
                 $key = $parentKey . '.' . $key;
             }
             if (is_array($labelValue)) {
                 $labelValue = $this->flattenTypoScriptLabelArray($labelValue, $key);
-                $result[] = $labelValue;
+                $result = array_merge($result, $labelValue);
             } else {
-                $result[] = [$key => $labelValue];
+                $result[$key] = $labelValue;
             }
         }
-        return array_merge(...$result);
+        return $result;
     }
 
     /**
index a8b1007..c7a4b10 100644 (file)
@@ -5884,7 +5884,7 @@ class ContentObjectRenderer implements LoggerAwareInterface
         $allFields = 'uid,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,php_tree_stop,mount_pid,mount_pid_ol,t3ver_state' . $addSelectFields;
         $depth = (int)$depth;
         $begin = (int)$begin;
-        $theList = [[]];
+        $theList = [];
         $addId = 0;
         $requestHash = '';
 
@@ -6033,7 +6033,7 @@ class ContentObjectRenderer implements LoggerAwareInterface
                     // Add ID to list:
                     if ($begin <= 0) {
                         if ($dontCheckEnableFields || $tsfe->checkEnableFields($row)) {
-                            $theList[] = [$next_id];
+                            $theList[] = $next_id;
                         }
                     }
                     // Next level:
@@ -6044,27 +6044,28 @@ class ContentObjectRenderer implements LoggerAwareInterface
                         }
                         // Call recursively, if the id is not in prevID_array:
                         if (!in_array($next_id, $prevId_array)) {
-                            $theList[] = GeneralUtility::intExplode(
-                                ',',
-                                $this->getTreeList(
-                                    $next_id,
-                                    $depth - 1,
-                                    $begin - 1,
-                                    $dontCheckEnableFields,
-                                    $addSelectFields,
-                                    $moreWhereClauses,
-                                    $prevId_array,
-                                    $recursionLevel + 1
+                            $theList = array_merge(
+                                GeneralUtility::intExplode(
+                                    ',',
+                                    $this->getTreeList(
+                                        $next_id,
+                                        $depth - 1,
+                                        $begin - 1,
+                                        $dontCheckEnableFields,
+                                        $addSelectFields,
+                                        $moreWhereClauses,
+                                        $prevId_array,
+                                        $recursionLevel + 1
+                                    ),
+                                    true
                                 ),
-                                true
+                                $theList
                             );
                         }
                     }
                 }
             }
         }
-        $theList = array_merge(...$theList);
-
         // If first run, check if the ID should be returned:
         if (!$recursionLevel) {
             if ($addId) {
@@ -6274,13 +6275,16 @@ class ContentObjectRenderer implements LoggerAwareInterface
                         $storagePid = -$storagePid;
                     }
                 });
-                $expandedPidList = [[]];
+                $expandedPidList = [];
                 foreach ($pidList as $value) {
                     // Implementation of getTreeList allows to pass the id negative to include
                     // it into the result otherwise only childpages are returned
-                    $expandedPidList[] = GeneralUtility::intExplode(',', $this->getTreeList($value, $conf['recursive']));
+                    $expandedPidList = array_merge(
+                        GeneralUtility::intExplode(',', $this->getTreeList($value, $conf['recursive'])),
+                        $expandedPidList
+                    );
                 }
-                $conf['pidInList'] = implode(',', array_merge(...$expandedPidList));
+                $conf['pidInList'] = implode(',', $expandedPidList);
             }
         }
         if ((string)$conf['pidInList'] === '') {
index ac701d9..ac1ce53 100644 (file)
@@ -72,20 +72,23 @@ abstract class AbstractTestCase extends FunctionalTestCase
      */
     protected function meltStrings(array $arrays, callable $finalCallback = null, string $prefix = ''): array
     {
-        $results = [[]];
+        $results = [];
         $array = array_shift($arrays);
         foreach ($array as $item) {
             $resultItem = $prefix . $item;
             if (count($arrays) > 0) {
-                $results[] = $this->meltStrings($arrays, $finalCallback, $resultItem);
+                $results = array_merge(
+                    $results,
+                    $this->meltStrings($arrays, $finalCallback, $resultItem)
+                );
                 continue;
             }
             if ($finalCallback !== null) {
                 $resultItem = call_user_func($finalCallback, $resultItem);
             }
-            $results[] = [$resultItem];
+            $results[] = $resultItem;
         }
-        return array_merge(...$results);
+        return $results;
     }
 
     /**
index e50a703..dd0ef23 100644 (file)
@@ -507,29 +507,32 @@ class EnhancerLinkGeneratorTest extends AbstractTestCase
             'end' => '100',
         ];
 
-        $dataSet = [[]];
+        $dataSet = [];
         foreach (range(10, 100, 30) as $value) {
             $languages = [
                 '0' => sprintf('https://acme.us/welcome/enhance/%s%s', $value, $options['pathSuffix'] ?? ''),
                 '1' => sprintf('https://acme.fr/bienvenue/enhance/%s%s', $value, $options['pathSuffix'] ?? ''),
             ];
 
-            $dataSet[] = $this->createDataSet(
-                $aspect,
-                $languages,
-                $this->getEnhancers([
-                    'value' => $value,
-                    'additionalParameters' => $options['additionalParameters'] ?? ''
-                ]),
-                'value',
-                [
-                    'prefix' => 'staticRangeMapper/',
-                    'suffix' => sprintf(', value:%d', $value),
-                ],
-                array_key_exists('pageTypeSettings', $options) ? $options['pageTypeSettings'] : []
+            $dataSet = array_merge(
+                $dataSet,
+                $this->createDataSet(
+                    $aspect,
+                    $languages,
+                    $this->getEnhancers([
+                        'value' => $value,
+                        'additionalParameters' => $options['additionalParameters'] ?? ''
+                    ]),
+                    'value',
+                    [
+                        'prefix' => 'staticRangeMapper/',
+                        'suffix' => sprintf(', value:%d', $value),
+                    ],
+                    array_key_exists('pageTypeSettings', $options) ? $options['pageTypeSettings'] : []
+                )
             );
         }
-        return array_merge(...$dataSet);
+        return $dataSet;
     }
 
     /**
@@ -614,7 +617,7 @@ class EnhancerLinkGeneratorTest extends AbstractTestCase
             ]
         ];
 
-        $dataSet = [[]];
+        $dataSet = [];
         foreach ($instructions as $instruction) {
             $templateSuffix = sprintf(
                 ' [%s=>%s]',
@@ -641,9 +644,12 @@ class EnhancerLinkGeneratorTest extends AbstractTestCase
                 },
                 array_keys($dataSetCandidates)
             );
-            $dataSet[] = array_combine($dataSetCandidatesKeys, $dataSetCandidates);
+            $dataSet = array_merge(
+                $dataSet,
+                array_combine($dataSetCandidatesKeys, $dataSetCandidates)
+            );
         }
-        return array_merge(...$dataSet);
+        return $dataSet;
     }
 
     /**
index 7d62cfb..eccb060 100644 (file)
@@ -493,7 +493,7 @@ class EnhancerSiteRequestTest extends AbstractTestCase
             'end' => '100',
         ];
 
-        $dataSet = [[]];
+        $dataSet = [];
         foreach (range(10, 100, 30) as $value) {
             $enhancerLanguageUris = $this->populateToKeys(
                 ['Simple', 'Plugin', 'Extbase'],
@@ -503,15 +503,18 @@ class EnhancerSiteRequestTest extends AbstractTestCase
                 ]
             );
 
-            $dataSet[] = $this->createDataSet(
-                $aspect,
-                $enhancerLanguageUris,
-                $this->getEnhancers(['value' => $value], true),
-                'value',
-                ['prefix' => 'staticRangeMapper/', 'suffix' => sprintf(', value:%d', $value)]
+            $dataSet = array_merge(
+                $dataSet,
+                $this->createDataSet(
+                    $aspect,
+                    $enhancerLanguageUris,
+                    $this->getEnhancers(['value' => $value], true),
+                    'value',
+                    ['prefix' => 'staticRangeMapper/', 'suffix' => sprintf(', value:%d', $value)]
+                )
             );
         }
-        return array_merge(...$dataSet);
+        return $dataSet;
     }
 
     /**
@@ -544,7 +547,7 @@ class EnhancerSiteRequestTest extends AbstractTestCase
             ['pathSuffix' => '/menu.json', 'type' => 10],
         ];
 
-        $dataSet = [[]];
+        $dataSet = [];
         foreach ($instructions as $instruction) {
             $templateSuffix = sprintf(
                 ' [%s=>%s]',
@@ -576,9 +579,12 @@ class EnhancerSiteRequestTest extends AbstractTestCase
                 },
                 array_keys($dataSetCandidates)
             );
-            $dataSet[] = array_combine($dataSetCandidatesKeys, $dataSetCandidates);
+            $dataSet = array_merge(
+                $dataSet,
+                array_combine($dataSetCandidatesKeys, $dataSetCandidates)
+            );
         }
-        return array_merge(...$dataSet);
+        return $dataSet;
     }
 
     /**
index 2be2942..da8fdf7 100644 (file)
@@ -119,21 +119,20 @@ class ContentVisibleFieldsTest extends \TYPO3\TestingFramework\Core\Functional\F
         $formEngineTestService = GeneralUtility::makeInstance(FormTestService::class);
 
         foreach (static::$contentFieldsByType as $contentType => $fieldConfig) {
-            $expectedFields = [static::$commonContentFields];
+            $expectedFields = static::$commonContentFields;
 
             if (empty($fieldConfig['disableHeaderFields'])) {
-                $expectedFields[] = static::$headerFields;
+                $expectedFields = array_merge($expectedFields, static::$headerFields);
             }
 
             if (!empty($fieldConfig['useImageFields'])) {
-                $expectedFields[] = static::$imageFields;
+                $expectedFields = array_merge($expectedFields, static::$imageFields);
             }
 
             if (!empty($fieldConfig['additionalFields'])) {
-                $expectedFields[] = $fieldConfig['additionalFields'];
+                $expectedFields = array_merge($expectedFields, $fieldConfig['additionalFields']);
             }
 
-            $expectedFields = array_merge(...$expectedFields);
             $formResult = $formEngineTestService->createNewRecordForm('tt_content', ['CType' => $contentType]);
             foreach ($expectedFields as $expectedField) {
                 $this->assertNotFalse(
index a43136a..517bdc5 100644 (file)
@@ -72,7 +72,7 @@ class FeatureManager
      */
     public function getConfigurationForSelectedFeaturePresets(array $postValues)
     {
-        $localConfigurationValuesToSet = [[]];
+        $localConfigurationValuesToSet = [];
         $features = $this->getInitializedFeatures($postValues);
         foreach ($features as $feature) {
             /** @var FeatureInterface $feature */
@@ -85,11 +85,14 @@ class FeatureManager
                     && $postValues[$featureName]['enable'] === $presetName
                     && (!$preset->isActive() || $preset instanceof CustomPresetInterface)
                 ) {
-                    $localConfigurationValuesToSet[] = $preset->getConfigurationValues();
+                    $localConfigurationValuesToSet = array_merge(
+                        $localConfigurationValuesToSet,
+                        $preset->getConfigurationValues()
+                    );
                 }
             }
         }
-        return array_merge(...$localConfigurationValuesToSet);
+        return $localConfigurationValuesToSet;
     }
 
     /**
index 87dc462..75a3641 100644 (file)
@@ -110,12 +110,12 @@ class DirectoryNode extends AbstractNode implements NodeInterface
      */
     public function fix(): array
     {
-        $result = [$this->fixSelf()];
+        $result = $this->fixSelf();
         foreach ($this->children as $child) {
             /** @var NodeInterface $child */
-            $result[] = $child->fix();
+            $result = array_merge($result, $child->fix());
         }
-        return array_merge(...$result);
+        return $result;
     }
 
     /**
@@ -238,12 +238,12 @@ class DirectoryNode extends AbstractNode implements NodeInterface
      */
     protected function getChildrenStatus(): array
     {
-        $result = [[]];
+        $result = [];
         foreach ($this->children as $child) {
             /** @var NodeInterface $child */
-            $result[] = $child->getStatus();
+            $result = array_merge($result, $child->getStatus());
         }
-        return array_merge(...$result);
+        return $result;
     }
 
     /**
index 619f2fd..280a014 100644 (file)
@@ -72,7 +72,7 @@ class LocalConfigurationValueService
      */
     protected function recursiveConfigurationFetching(array $sections, array $sectionsFromCurrentConfiguration, array $descriptions, array $path = []): array
     {
-        $data = [[]];
+        $data = [];
 
         foreach ($sections as $key => $value) {
             if (!isset($descriptions['items'][$key])) {
@@ -88,7 +88,7 @@ class LocalConfigurationValueService
 
             if ($descriptionType === 'container') {
                 $valueFromCurrentConfiguration = $sectionsFromCurrentConfiguration[$key] ?? null;
-                $data[] = $this->recursiveConfigurationFetching($value, $valueFromCurrentConfiguration, $descriptionInfo, $newPath);
+                $data = array_merge($data, $this->recursiveConfigurationFetching($value, $valueFromCurrentConfiguration, $descriptionInfo, $newPath));
             } elseif (!preg_match('/[' . LF . CR . ']/', (string)$value) || $descriptionType === 'multiline') {
                 $itemData = [];
                 $itemData['key'] = implode('/', $newPath);
@@ -141,7 +141,7 @@ class LocalConfigurationValueService
             }
         }
 
-        return array_merge(...$data);
+        return $data;
     }
 
     /**
index ebaab8d..e4a1bc8 100644 (file)
@@ -3722,20 +3722,19 @@ class DatabaseRecordList
             $tree->init('AND ' . $perms_clause);
             $tree->makeHTML = 0;
             $tree->fieldArray = ['uid', 'php_tree_stop'];
-            $idList = [[]];
+            $idList = [];
 
             $allowedMounts = !$backendUser->isAdmin() && $id === 0
                 ? $backendUser->returnWebmounts()
                 : [$id];
 
             foreach ($allowedMounts as $allowedMount) {
-                $idList[] = [$allowedMount];
+                $idList[] = $allowedMount;
                 if ($depth) {
                     $tree->getTree($allowedMount, $depth, '');
                 }
-                $idList[] = [$tree->ids];
+                $idList = array_merge($idList, $tree->ids);
             }
-            $idList = array_merge(...$idList);
             $runtimeCache->set($hash, $idList);
         }
 
index c9db0c1..87643d3 100644 (file)
@@ -525,9 +525,9 @@ class DeletedRecords
         $depth = (int)$depth;
         $begin = (int)$begin;
         $id = abs((int)$id);
-        $theList = [[]];
+        $theList = [];
         if ($begin === 0) {
-            $theList[] = [$id];
+            $theList[] = $id;
         }
         if ($depth > 0) {
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
@@ -541,14 +541,14 @@ class DeletedRecords
                 ->execute();
             while ($row = $statement->fetch()) {
                 if ($begin <= 0) {
-                    $theList[] = [$row['uid']];
+                    $theList[] = $row['uid'];
                 }
                 if ($depth > 1) {
-                    $theList[] = $this->resolveTree($row['uid'], $depth - 1, $begin - 1, $permsClause);
+                    $theList = array_merge($theList, $this->resolveTree($row['uid'], $depth - 1, $begin - 1, $permsClause));
                 }
             }
         }
-        return array_merge(...$theList);
+        return $theList;
     }
 
     /**
index e64e57d..302eef8 100644 (file)
@@ -87,16 +87,15 @@ class Status implements RequestAwareReportInterface
     {
         $status = [];
         foreach ($this->statusProviders as $statusProviderId => $statusProviderList) {
-            $status[$statusProviderId] = [[]];
+            $status[$statusProviderId] = [];
             foreach ($statusProviderList as $statusProvider) {
                 if ($statusProvider instanceof RequestAwareStatusProviderInterface) {
                     $statuses = $statusProvider->getStatus($request);
                 } else {
                     $statuses = $statusProvider->getStatus();
                 }
-                $status[$statusProviderId][] = $statuses;
+                $status[$statusProviderId] = array_merge($status[$statusProviderId], $statuses);
             }
-            $status[$statusProviderId] = array_merge(...$status[$statusProviderId]);
         }
         return $status;
     }
@@ -114,10 +113,9 @@ class Status implements RequestAwareReportInterface
             foreach ($statusProviderList as $statusProvider) {
                 if ($statusProvider instanceof ExtendedStatusProviderInterface) {
                     $statuses = $statusProvider->getDetailedStatus();
-                    $status[$statusProviderId][] = $statuses;
+                    $status[$statusProviderId] = array_merge($status[$statusProviderId], $statuses);
                 }
             }
-            $status[$statusProviderId] = array_merge(...$status[$statusProviderId]);
         }
         return $status;
     }
index 1e7c417..0a923e6 100644 (file)
@@ -587,7 +587,7 @@ class SchedulerModuleController
         }
 
         // Get the extra fields to display for each task that needs some
-        $allAdditionalFields = [[]];
+        $allAdditionalFields = [];
         if ($process === 'add') {
             foreach ($registeredClasses as $class => $registrationInfo) {
                 if (!empty($registrationInfo['provider'])) {
@@ -595,7 +595,7 @@ class SchedulerModuleController
                     $providerObject = GeneralUtility::makeInstance($registrationInfo['provider']);
                     if ($providerObject instanceof AdditionalFieldProviderInterface) {
                         $additionalFields = $providerObject->getAdditionalFields($taskInfo, null, $this);
-                        $allAdditionalFields[] = [$class => $additionalFields];
+                        $allAdditionalFields = array_merge($allAdditionalFields, [$class => $additionalFields]);
                     }
                 }
             }
@@ -603,7 +603,7 @@ class SchedulerModuleController
             // only try to fetch additionalFields if the task is valid
             $providerObject = GeneralUtility::makeInstance($registeredClasses[$taskInfo['class']]['provider']);
             if ($providerObject instanceof AdditionalFieldProviderInterface) {
-                $allAdditionalFields[] = [$taskInfo['class'] => $providerObject->getAdditionalFields($taskInfo, $task, $this)];
+                $allAdditionalFields[$taskInfo['class']] = $providerObject->getAdditionalFields($taskInfo, $task, $this);
             }
         }
 
@@ -685,7 +685,6 @@ class SchedulerModuleController
 
         // Display additional fields
         $additionalFieldList = [];
-        $allAdditionalFields = array_merge(...$allAdditionalFields);
         foreach ($allAdditionalFields as $class => $fields) {
             if ($class == $taskInfo['class']) {
                 $additionalFieldsStyle = '';
index ef28cd9..c2844a7 100644 (file)
@@ -158,7 +158,7 @@ class OptimizeDatabaseTableAdditionalFieldProvider extends AbstractAdditionalFie
             // These tables will be rechecked and possibly re-added to the list
             // of optimizable tables. This ensures that no orphaned table from
             // the default connection gets mistakenly labeled as optimizable.
-            $optimizableTables = [array_diff($optimizableTables, array_keys($tableMap))];
+            $optimizableTables = array_diff($optimizableTables, array_keys($tableMap));
 
             // Walk each connection and check all tables that have been
             // remapped to it for optimization support.
@@ -172,10 +172,8 @@ class OptimizeDatabaseTableAdditionalFieldProvider extends AbstractAdditionalFie
                     }
                 ));
                 $tables = $this->getOptimizableTablesForConnection($connection, $tablesOnConnection);
-                $optimizableTables[] = $tables;
+                $optimizableTables = array_merge($optimizableTables, $tables);
             }
-
-            $optimizableTables = array_merge(...$optimizableTables);
         }
 
         sort($optimizableTables);
index 390c77c..a5a70dd 100644 (file)
@@ -82,14 +82,14 @@ class RecordsXmlSitemapDataProvider extends AbstractXmlSitemapDataProvider
         if (!empty($pids)) {
             $recursiveLevel = isset($this->config['recursive']) ? (int)$this->config['recursive'] : 0;
             if ($recursiveLevel) {
-                $newList = [[]];
+                $newList = [];
                 foreach ($pids as $pid) {
                     $list = $this->cObj->getTreeList($pid, $recursiveLevel);
                     if ($list) {
-                        $newList[] = explode(',', $list);
+                        $newList = array_merge($newList, explode(',', $list));
                     }
                 }
-                $pids = array_merge($pids, ...$newList);
+                $pids = array_merge($pids, $newList);
             }
 
             $constraints[] = $queryBuilder->expr()->in('pid', $pids);
index d91fded..f31f545 100644 (file)
@@ -75,11 +75,11 @@ class AddonRegistry implements SingletonInterface
      */
     public function compileSettings(array $addons): array
     {
-        $settings = [[]];
+        $settings = [];
         foreach ($addons as $addon) {
-            $settings[] = $addon->getOptions();
+            $settings = array_merge($settings, $addon->getOptions());
         }
 
-        return array_merge(...$settings);
+        return $settings;
     }
 }
index 578fb53..327f0d6 100644 (file)
@@ -98,8 +98,8 @@ class T3editor implements SingletonInterface
         }
 
         $this->configuration = [
-            'modes' => [[]],
-            'addons' => [[]],
+            'modes' => [],
+            'addons' => [],
         ];
 
         $cache = $this->getCache();
@@ -117,7 +117,7 @@ class T3editor implements SingletonInterface
                 if (is_file($modesFileNameForPackage)) {
                     $definedModes = require_once $modesFileNameForPackage;
                     if (is_array($definedModes)) {
-                        $this->configuration['modes'][] = $definedModes;
+                        $this->configuration['modes'] = array_merge($this->configuration['modes'], $definedModes);
                     }
                 }
 
@@ -125,12 +125,10 @@ class T3editor implements SingletonInterface
                 if (is_file($addonsFileNameForPackage)) {
                     $definedAddons = require_once $addonsFileNameForPackage;
                     if (is_array($definedAddons)) {
-                        $this->configuration['addons'][] = $definedAddons;
+                        $this->configuration['addons'] = array_merge($this->configuration['addons'], $definedAddons);
                     }
                 }
             }
-            $this->configuration['modes'] = array_merge(...$this->configuration['modes']);
-            $this->configuration['addons'] = array_merge(...$this->configuration['addons']);
             $cache->set($cacheIdentifier, $this->configuration);
         }
 
index 86c09a9..2889b24 100644 (file)
@@ -386,15 +386,14 @@ class ElementEntity
     public function getNestedChildren()
     {
         if (!isset($this->nestedChildren)) {
-            $this->nestedChildren = [[]];
+            $this->nestedChildren = [];
             $children = $this->getChildren();
             /** @var ReferenceEntity $child */
             foreach ($children as $child) {
-                $this->nestedChildren[] = [$child->getElement()->__toString() => $child->getElement()];
-                $this->nestedChildren[] = $child->getElement()->getNestedChildren();
+                $this->nestedChildren = array_merge($this->nestedChildren, [$child->getElement()->__toString() => $child->getElement()], $child->getElement()->getNestedChildren());
             }
         }
-        return array_merge(...$this->nestedChildren);
+        return $this->nestedChildren;
     }
 
     /**
index 39d591f..b9ceb7e 100644 (file)
@@ -162,18 +162,21 @@ class CollectionService implements SingletonInterface
      */
     protected function finalize(array $dataArray)
     {
-        $processedDataArray = [[]];
+        $processedDataArray = [];
         foreach ($dataArray as $dataElement) {
             $dataElementIdentifier = $dataElement['id'];
             $processedDataArray[] = $dataElement;
             // Insert children (if any)
             if (!empty($this->nestedDataArray[$dataElementIdentifier])) {
-                $processedDataArray[] = $this->finalize($this->nestedDataArray[$dataElementIdentifier]);
+                $processedDataArray = array_merge(
+                    $processedDataArray,
+                    $this->finalize($this->nestedDataArray[$dataElementIdentifier])
+                );
                 unset($this->nestedDataArray[$dataElementIdentifier]);
             }
         }
 
-        return array_merge(...$processedDataArray);
+        return $processedDataArray;
     }
 
     /**
index 2526ee2..4fafab0 100644 (file)
@@ -161,10 +161,11 @@ class GridDataService implements LoggerAwareInterface
                     $isDeletedPage = $table === 'pages' && $recordState === 'deleted';
                     $pageId = $table === 'pages' ? $record['uid'] : $record['pid'];
                     $viewUrl = GeneralUtility::makeInstance(PreviewUriBuilder::class)->buildUriForElement($table, $record['uid'], $origRecord, $versionRecord);
-                    $versionArray = $defaultGridColumns;
+                    $versionArray = [];
                     $versionArray['table'] = $table;
                     $versionArray['id'] = $table . ':' . $record['uid'];
                     $versionArray['uid'] = $record['uid'];
+                    $versionArray = array_merge($versionArray, $defaultGridColumns);
                     $versionArray['label_Workspace'] = htmlspecialchars(BackendUtility::getRecordTitle($table, $versionRecord));
                     $versionArray['label_Live'] = htmlspecialchars(BackendUtility::getRecordTitle($table, $origRecord));
                     $versionArray['label_Stage'] = htmlspecialchars($stagesObj->getStageTitle($versionRecord['t3ver_stage']));
index f700a9f..5ff6e05 100644 (file)
@@ -61,7 +61,7 @@ class RecordService implements SingletonInterface
      */
     public function getCreateUserIds()
     {
-        $createUserIds = [[]];
+        $createUserIds = [];
         foreach ($this->getIdsPerTable() as $tableName => $ids) {
             if (empty($GLOBALS['TCA'][$tableName]['ctrl']['cruser_id'])) {
                 continue;
@@ -87,9 +87,9 @@ class RecordService implements SingletonInterface
             $records = array_column($records, $createUserIdFieldName);
 
             if (!empty($records)) {
-                $createUserIds[] = $records;
+                $createUserIds = array_merge($createUserIds, $records);
             }
         }
-        return array_unique(array_merge(...$createUserIds));
+        return array_unique($createUserIds);
     }
 }