Hi everyone, Im going through the process of upgrading through laravel / larastan versions and im stuck on this issue at the moment. There is a related one but it seems to be due to morph relations.#54590 (comment) I have the following HasOne relation: /** * @return HasOne<Licence, $this> */ public function licence(): HasOne { return $this->hasOne(Licence::class, 'id', 'id'); }
and im trying to use it like this: Tenant::whereHas('licence', function ($query): void { $query->where('type', Licence::FULL) ->where('expires_on', '>', now()->timestamp); })
This results in: 14 Parameter #1 $column of method Illuminate\Database\Eloquent\Builder<TRelatedModel of Illuminate\Database\Eloquent\Model>::where() expects array<int|model property of T RelatedModel of Illuminate\Database\Eloquent\Model, mixed>|(Closure(Illuminate\Database\Eloquent\Builder<TRelatedModel>): Illuminate\Database\Eloquent\Builder<TRelated Model>)|(Closure(Illuminate\Database\Eloquent\Builder<TRelatedModel>): void)|Illuminate\Contracts\Database\Query\Expression|model property of TRelatedModel of Illumina te\Database\Eloquent\Model, 'type' given. 🪪 argument.type 💡 Type #5 from the union: The given string should be a property of TRelatedModel of Illuminate\Database\Eloquent\Model, type given. 15 Parameter #1 $column of method Illuminate\Database\Eloquent\Builder<TRelatedModel of Illuminate\Database\Eloquent\Model>::where() expects array<int|model property of T RelatedModel of Illuminate\Database\Eloquent\Model, mixed>|(Closure(Illuminate\Database\Eloquent\Builder<TRelatedModel>): Illuminate\Database\Eloquent\Builder<TRelated Model>)|(Closure(Illuminate\Database\Eloquent\Builder<TRelatedModel>): void)|Illuminate\Contracts\Database\Query\Expression|model property of TRelatedModel of Illumina te\Database\Eloquent\Model, 'expires_on' given.
Now I try and specify which builder to give it: Tenant::whereHas('licence', function (Builder $query): void { /** @var Builder<Licence> $query */
Which removes the 2 errors above but is replaced with: 16 PHPDoc tag @var with type Illuminate\Database\Eloquent\Builder<App\Models\System\Licence> is not subtype of native type Illuminate\Database\Eloquent\Builder<Illuminate \Database\Eloquent\Model>. 🪪 varTag.nativeType
Kind of stuck here and cant find any further similar issues. Anyone with some suggestions or even a changelog I can read? |