diff --git a/src/Traits/ResponseTrait.php b/src/Traits/ResponseTrait.php index 00b1e86d8..d5677eaa5 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;