The expression return App\Models\AccountStats::class returns the type string which is incompatible with the return type mandated by Czim\Repository\Contract...itoryInterface::model() of Illuminate\Database\Eloquent\Model.
In the issue above, the returned value is violating the contract defined by the
mentioned interface.
Let's take a look at an example:
interfaceHasName{/** @return string */publicfunctiongetName();}className{public$name;}classUserimplementsHasName{/** @return string|Name */publicfunctiongetName(){returnnewName('foo');// This is a violation of the ``HasName`` interface// which only allows a string value to be returned.}}
The expression return $this->create(arr..., 'time_request' => 0)) returns the type Illuminate\Database\Eloquent\Model which includes types incompatible with the type-hinted return App\Models\AccountStats|null.
Loading history...
27
'uuid' => $uuid,
28
'count_search' => 0,
29
'count_request' => 0,
30
'time_search' => 0,
31
'time_request' => 0,
32
]);
33
}
34
35
/**
36
* Increment request counter.
37
*
38
* @param string $uuid User UUID
39
*/
40
public function incrementRequestCounter(string $uuid = ''): void
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: