From 4ea66c6d938952aeefd262b1b247e07bd93b4007 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 24 Mar 2024 17:04:35 +0100 Subject: [PATCH] Replace early construct call with property coalesce assignments --- .../src/Framework/Features/Navigation/NavigationItem.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/framework/src/Framework/Features/Navigation/NavigationItem.php b/packages/framework/src/Framework/Features/Navigation/NavigationItem.php index c0d65bd58df..099e539cd48 100644 --- a/packages/framework/src/Framework/Features/Navigation/NavigationItem.php +++ b/packages/framework/src/Framework/Features/Navigation/NavigationItem.php @@ -63,12 +63,9 @@ public static function create(Route|string $destination, ?string $label = null, } if ($destination instanceof Route) { - return new self( - $destination, - $label ?? $destination->getPage()->navigationMenuLabel(), - $priority ?? $destination->getPage()->navigationMenuPriority(), - $group ?? $destination->getPage()->navigationMenuGroup(), - ); + $label ??= $destination->getPage()->navigationMenuLabel(); + $priority ??= $destination->getPage()->navigationMenuPriority(); + $group ??= $destination->getPage()->navigationMenuGroup(); } return new self($destination, $label ?? '', $priority ?? NavigationMenu::DEFAULT, $group);