Skip to content

Commit

Permalink
feat: deprecate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed May 28, 2024
1 parent df99732 commit f416d13
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Traits/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f416d13

Please sign in to comment.