From 12a1eef59b5288d61c8143a89942b37a231ab8cf Mon Sep 17 00:00:00 2001 From: Sem Schilder Date: Sun, 12 Dec 2021 12:55:31 +0100 Subject: [PATCH] Dont use null where string is expected (#489) Quickfix for PHP 8.1 compatibility --- src/DebugBar/JavascriptRenderer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DebugBar/JavascriptRenderer.php b/src/DebugBar/JavascriptRenderer.php index c9fbd48..0cad8b0 100644 --- a/src/DebugBar/JavascriptRenderer.php +++ b/src/DebugBar/JavascriptRenderer.php @@ -719,8 +719,8 @@ class JavascriptRenderer } foreach ($additionalAssets as $assets) { - $basePath = isset($assets['base_path']) ? $assets['base_path'] : null; - $baseUrl = isset($assets['base_url']) ? $assets['base_url'] : null; + $basePath = isset($assets['base_path']) ? $assets['base_path'] : ''; + $baseUrl = isset($assets['base_url']) ? $assets['base_url'] : ''; $root = $this->getRelativeRoot($relativeTo, $this->makeUriRelativeTo($basePath, $this->basePath), $this->makeUriRelativeTo($baseUrl, $this->baseUrl)); @@ -746,7 +746,7 @@ class JavascriptRenderer $cssFiles = array_unique($cssFiles); $jsFiles = array_unique($jsFiles); - return $this->filterAssetArray(array($cssFiles, $jsFiles, $inlineCss, $inlineJs, $inlineHead), $type); + return $this->filterAssetArray(array($cssFiles, $jsFiles, $inlineCss, $inlineJs, $inlineHead), $type ?? ''); } /** @@ -802,7 +802,7 @@ class JavascriptRenderer * @param string $type 'css', 'js', 'inline_css', 'inline_js', 'inline_head', or null for all * @return array */ - protected function filterAssetArray($array, $type = null) + protected function filterAssetArray($array, $type = '') { $types = array('css', 'js', 'inline_css', 'inline_js', 'inline_head'); $typeIndex = array_search(strtolower($type), $types);