From 91ab3aa2a95086af2a34ab27bfcb6905a8707c5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20E=C3=9Fl?= <indy.essl@gmail.com>
Date: Sat, 28 Mar 2020 15:42:25 +0100
Subject: [PATCH] [TASK] Make attributes in AssetCollector optional
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The AssetCollector does not necessarily need a filled array with
attributes for adding javascript or stylesheets. Make the $attributes
argument optional and default to an empty array.

Resolves: #90868
Releases: master
Change-Id: I7a6e5dad8724f36c0450d13cda853e90b1929e71
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63969
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Jonas Eberle <flightvision@googlemail.com>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Jonas Eberle <flightvision@googlemail.com>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
---
 typo3/sysext/core/Classes/Page/AssetCollector.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/typo3/sysext/core/Classes/Page/AssetCollector.php b/typo3/sysext/core/Classes/Page/AssetCollector.php
index 19581c8d4512..c87f539dc0b3 100644
--- a/typo3/sysext/core/Classes/Page/AssetCollector.php
+++ b/typo3/sysext/core/Classes/Page/AssetCollector.php
@@ -65,7 +65,7 @@ class AssetCollector implements SingletonInterface
      */
     protected $media = [];
 
-    public function addJavaScript(string $identifier, string $source, array $attributes, array $options = []): self
+    public function addJavaScript(string $identifier, string $source, array $attributes = [], array $options = []): self
     {
         $existingAttributes = $this->javaScripts[$identifier]['attributes'] ?? [];
         ArrayUtility::mergeRecursiveWithOverrule($existingAttributes, $attributes);
@@ -79,7 +79,7 @@ class AssetCollector implements SingletonInterface
         return $this;
     }
 
-    public function addInlineJavaScript(string $identifier, string $source, array $attributes, array $options = []): self
+    public function addInlineJavaScript(string $identifier, string $source, array $attributes = [], array $options = []): self
     {
         $existingAttributes = $this->inlineJavaScripts[$identifier]['attributes'] ?? [];
         ArrayUtility::mergeRecursiveWithOverrule($existingAttributes, $attributes);
@@ -93,7 +93,7 @@ class AssetCollector implements SingletonInterface
         return $this;
     }
 
-    public function addStyleSheet(string $identifier, string $source, array $attributes, array $options = []): self
+    public function addStyleSheet(string $identifier, string $source, array $attributes = [], array $options = []): self
     {
         $existingAttributes = $this->styleSheets[$identifier]['attributes'] ?? [];
         ArrayUtility::mergeRecursiveWithOverrule($existingAttributes, $attributes);
@@ -107,7 +107,7 @@ class AssetCollector implements SingletonInterface
         return $this;
     }
 
-    public function addInlineStyleSheet(string $identifier, string $source, array $attributes, array $options = []): self
+    public function addInlineStyleSheet(string $identifier, string $source, array $attributes = [], array $options = []): self
     {
         $existingAttributes = $this->inlineStyleSheets[$identifier]['attributes'] ?? [];
         ArrayUtility::mergeRecursiveWithOverrule($existingAttributes, $attributes);
-- 
GitLab