PhpStan error on $this->resolveRecord($record)
Hello All,
I run phpstan on my code regularly, and I stumbled upon the following issue. This code excerpt is from a page definition
Phpstan reports the following for the last row:
Access to an undefined property Illuminate\Database\Eloquent\Model::$merchant.Even I declared the $record type in the docblock, the resolveRecord return type is a Model, and phpstan can't recognize the merchant belongsTo relation. Of course I can re-implement the resolveRecord function in my class and typehint with the correct return type, but I feel this is just add unnecessary bloat to my code. How can I typehint this function to pass the phpstan?
0 Replies