From 3c11e78b3a8dc42ba0b5c29eca14cfbbbc82040b Mon Sep 17 00:00:00 2001 From: qrazi Date: Tue, 12 Mar 2024 14:43:57 +0100 Subject: [PATCH] feat!: upgrade `league/fractal` to 0.20 Upgrade to most recent branch of `league/fractal`. This makes sense to do now since `craftcms/element-api` has also done this upgrade in its recent 4.x line. BREAKING CHANGE: Fractal's public API has changed in classes such as `\League\Fractal\Serializer\ArraySerializer` --- composer.json | 2 +- src/ScoutIndex.php | 2 +- src/serializer/AlgoliaSerializer.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 921fb70..7be3a75 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "php": "^8.0.2", "craftcms/cms": "^4.3.5", "algolia/algoliasearch-client-php": "^2.3|^3.0", - "league/fractal": "^0.18|^0.19" + "league/fractal": "^0.20" }, "repositories": [ { diff --git a/src/ScoutIndex.php b/src/ScoutIndex.php index 4692e46..6735930 100644 --- a/src/ScoutIndex.php +++ b/src/ScoutIndex.php @@ -21,7 +21,7 @@ class ScoutIndex extends BaseObject /** @var IndexSettings */ public $indexSettings; - /** @var string */ + /** @var */ public $elementType = Entry::class; /** @var callable|string|array|\League\Fractal\TransformerAbstract */ diff --git a/src/serializer/AlgoliaSerializer.php b/src/serializer/AlgoliaSerializer.php index 1464a6a..99cc0ff 100644 --- a/src/serializer/AlgoliaSerializer.php +++ b/src/serializer/AlgoliaSerializer.php @@ -7,12 +7,12 @@ class AlgoliaSerializer extends \League\Fractal\Serializer\ArraySerializer /** * Serialize a collection. * - * @param string $resourceKey + * @param ?string $resourceKey * @param array $data * * @return array */ - public function collection($resourceKey, array $data) + public function collection(?string $resourceKey, array $data): array { if ($resourceKey) { return [$resourceKey => $data];