From 0096424bdb1f678a769b1ba94a3f767e91808d58 Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Mon, 9 Oct 2023 20:23:51 +0100 Subject: [PATCH] fix: traits cant have arrays as default --- .../Stand/OrdersStandsByCommonConditions.php | 48 ++++++++++++------- .../SelectsStandsUsingStandardConditions.php | 8 ++-- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/app/Allocator/Stand/OrdersStandsByCommonConditions.php b/app/Allocator/Stand/OrdersStandsByCommonConditions.php index 2b18c4a7a..1d3b902b1 100644 --- a/app/Allocator/Stand/OrdersStandsByCommonConditions.php +++ b/app/Allocator/Stand/OrdersStandsByCommonConditions.php @@ -18,25 +18,37 @@ trait OrdersStandsByCommonConditions private string $otherStandRequests = 'other_stand_requests.id ASC'; private string $random = 'RAND() ASC'; - private array $commonOrderByConditions = [ - $this->aerodromeReferenceCode, - $this->assignmentPriority, - $this->otherStandRequests, - $this->random, - ]; + private function commonOrderByConditions(): array + { + return [ + $this->aerodromeReferenceCode, + $this->assignmentPriority, + $this->otherStandRequests, + $this->random, + ]; + } - private array $commonOrderByConditionsWithoutAssignmentPriority = [ - $this->aerodromeReferenceCode, - $this->otherStandRequests, - $this->random, - ]; + private function commonOrderByConditionsWithoutAssignmentPriority(): array + { + return [ + $this->aerodromeReferenceCode, + $this->otherStandRequests, + $this->random, + ]; + } - private array $commonOrderByConditionsForRanking = [ - $this->aerodromeReferenceCode, - $this->assignmentPriority, - ]; + private function commonOrderByConditionsForRanking(): array + { + return [ + $this->aerodromeReferenceCode, + $this->assignmentPriority, + ]; + } - private array $commonOrderByConditionsWithoutAssignmentPriorityForRanking = [ - $this->aerodromeReferenceCode, - ]; + private function commonOrderByConditionsWithoutAssignmentPriorityForRanking(): array + { + return [ + $this->aerodromeReferenceCode, + ]; + } } diff --git a/app/Allocator/Stand/SelectsStandsUsingStandardConditions.php b/app/Allocator/Stand/SelectsStandsUsingStandardConditions.php index 17de9e173..9741d74cc 100644 --- a/app/Allocator/Stand/SelectsStandsUsingStandardConditions.php +++ b/app/Allocator/Stand/SelectsStandsUsingStandardConditions.php @@ -81,12 +81,12 @@ private function orderByForStandsQuery(array $customOrders, bool $includeAssignm */ if ($includeAssignmentPriority) { $commonConditions = $isRanking - ? $this->commonOrderByConditionsForRanking - : $this->commonOrderByConditions; + ? $this->commonOrderByConditionsForRanking() + : $this->commonOrderByConditions(); } else { $commonConditions = $isRanking - ? $this->commonOrderByConditionsWithoutAssignmentPriorityForRanking - : $this->commonOrderByConditionsWithoutAssignmentPriority; + ? $this->commonOrderByConditionsWithoutAssignmentPriorityForRanking() + : $this->commonOrderByConditionsWithoutAssignmentPriority(); } return array_merge(