No detection of return type
On my Eloquent model I've got a custom function like this:
public function userCount(): int
{
return $this->users()->count();
}
As you can see the return type is int.
Next I've got a CompanyResource with:
[
...
'userCount' => $this->userCount(),
...
]
I would expect Scramble to list "userCount": 0, however Scramble shows: "userCount": "string"
Scramble fails to detect and use the return type.
@zenire does it work when you write it in the resource like so?
$this->resource->userCount()
@zenire does it work when you write it in the resource like so?
$this->resource->userCount()
I tried, but no, same behavior.
@zenire gotcha. Please help me reproduce. What's your versions, show some code, etc
Version v0.11.5
Not really sure what I can share more (without sharing too much code). Return type of userCount() is int indicating it's an integer. The resource calls userCount() and the resource is returned in a controller with return new CompanyResource($company);
@zenire sorry, I need a way to reproduce it. And currently I can't.
Maybe you can create a fresh repo and make a reproduction?