From 5255e715912b50127b296da7410bd97468bf5e40 Mon Sep 17 00:00:00 2001 From: Jakub Dibala Date: Mon, 14 Feb 2022 20:30:22 +0100 Subject: [PATCH] Fix trim warning in PHP 8 (#291) --- src/Lavary/Menu/Builder.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Lavary/Menu/Builder.php b/src/Lavary/Menu/Builder.php index f68a5b1..d1a9075 100644 --- a/src/Lavary/Menu/Builder.php +++ b/src/Lavary/Menu/Builder.php @@ -300,7 +300,13 @@ protected function prefix($uri) public static function formatGroupClass($new, $old) { if (isset($new['class']) and $new['class'] !== null) { - $classes = trim(trim(Arr::get($old, 'class')).' '.trim(Arr::get($new, 'class'))); + $oldClass = Arr::get($old, 'class'); + + if ($oldClass !== null) { + $oldClass = trim($oldClass); + } + + $classes = trim($oldClass.' '.trim(Arr::get($new, 'class'))); return implode(' ', array_unique(explode(' ', $classes))); }