Skip to content

Commit

Permalink
Add generic type for WithData trait
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalexander committed Nov 1, 2023
1 parent 210e855 commit b34caae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/WithData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
namespace Spatie\LaravelData;

use Spatie\LaravelData\Contracts\BaseData;
use Spatie\LaravelData\Contracts\DataObject;
use Spatie\LaravelData\Exceptions\InvalidDataClass;

/**
* @template T
*/
trait WithData
{
public function getData(): DataObject
/**
* @return T
*/
public function getData()
{
$dataClass = match (true) {
/** @psalm-suppress UndefinedThisPropertyFetch */
Expand Down

0 comments on commit b34caae

Please sign in to comment.