Skip to content

Commit

Permalink
Merge pull request #597 from konovalexander/generic-type-for-withData…
Browse files Browse the repository at this point in the history
…-trait

Add generic type for WithData trait
  • Loading branch information
rubenvanassche authored Dec 1, 2023
2 parents d735a53 + b34caae commit 02752fc
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 02752fc

Please sign in to comment.