From f416d13839a0c9350b3f1634c625f13cfc3035d0 Mon Sep 17 00:00:00 2001 From: Mohammad Alavi Date: Tue, 28 May 2024 20:58:45 +0330 Subject: [PATCH] feat: deprecate methods --- src/Traits/ResponseTrait.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Traits/ResponseTrait.php b/src/Traits/ResponseTrait.php index 00b1e86d..d5677eaa 100644 --- a/src/Traits/ResponseTrait.php +++ b/src/Traits/ResponseTrait.php @@ -9,6 +9,7 @@ use Illuminate\Pagination\AbstractPaginator; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Request; +use JetBrains\PhpStorm\Deprecated; use Spatie\Fractal\Facades\Fractal; trait ResponseTrait @@ -18,6 +19,10 @@ trait ResponseTrait /** * @throws InvalidTransformerException */ + #[Deprecated( + reason: 'This method is the cause of many bugs and its functionality is already covered by the Fractal package.', + replacement: '\Spatie\Fractal\Facades\Fractal::create(%parameter0%,%parameter1%)->parseIncludes(%parameter2%)->addMeta(%parameter3%)->toArray();', + )] public function transform( $data, $transformerName = null, @@ -119,6 +124,10 @@ private function filterResponse(array $responseArray, array $filters): array return $responseArray; } + #[Deprecated( + reason: 'Its functionality is already covered by the Fractal package. Use the addMeta() method on the Fractal instance instead.', + replacement: '\Spatie\Fractal\Facades\Fractal::create()->addMeta(%parameter0%)->toArray();', + )] public function withMeta($data): self { $this->metaData = $data;