From 8c63eebf135aafa60c2ff13fc7d414911731a1d7 Mon Sep 17 00:00:00 2001 From: DaneEveritt Date: Wed, 4 May 2022 19:35:10 -0400 Subject: [PATCH] Fix fractal errors --- .../Serializers/PterodactylSerializer.php | 23 ++++--------------- .../Api/Client/ScheduleTransformer.php | 2 +- .../Api/Client/ServerTransformer.php | 2 +- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php b/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php index 2481cf96e..5b53a5ad7 100644 --- a/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php +++ b/app/Extensions/League/Fractal/Serializers/PterodactylSerializer.php @@ -8,12 +8,8 @@ class PterodactylSerializer extends ArraySerializer { /** * Serialize an item. - * - * @param string $resourceKey - * - * @return array */ - public function item($resourceKey, array $data) + public function item(?string $resourceKey, array $data): array { return [ 'object' => $resourceKey, @@ -23,12 +19,8 @@ class PterodactylSerializer extends ArraySerializer /** * Serialize a collection. - * - * @param string $resourceKey - * - * @return array */ - public function collection($resourceKey, array $data) + public function collection(?string $resourceKey, array $data): array { $response = []; foreach ($data as $datum) { @@ -43,10 +35,8 @@ class PterodactylSerializer extends ArraySerializer /** * Serialize a null resource. - * - * @return array */ - public function null() + public function null(): ?array { return [ 'object' => 'null_resource', @@ -56,13 +46,8 @@ class PterodactylSerializer extends ArraySerializer /** * Merge the included resources with the parent resource being serialized. - * - * @param array $transformedData - * @param array $includedData - * - * @return array */ - public function mergeIncludes($transformedData, $includedData) + public function mergeIncludes(array $transformedData, array $includedData): array { foreach ($includedData as $key => $datum) { $transformedData['relationships'][$key] = $datum; diff --git a/app/Transformers/Api/Client/ScheduleTransformer.php b/app/Transformers/Api/Client/ScheduleTransformer.php index ed718ce2b..3f42234b2 100644 --- a/app/Transformers/Api/Client/ScheduleTransformer.php +++ b/app/Transformers/Api/Client/ScheduleTransformer.php @@ -16,7 +16,7 @@ class ScheduleTransformer extends BaseClientTransformer /** * @var array */ - protected $defaultIncludes = ['tasks']; + protected array $defaultIncludes = ['tasks']; /** * {@inheritdoc} diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index fc393d2f8..1e4412b91 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -16,7 +16,7 @@ class ServerTransformer extends BaseClientTransformer /** * @var string[] */ - protected $defaultIncludes = ['allocations', 'variables']; + protected array $defaultIncludes = ['allocations', 'variables']; /** * @var array