laravel-ide-helper
laravel-ide-helper copied to clipboard
Incorrect type for nullable morph
Summary
Command php artisan ide-helper:models do not consider nullable morphs, and recognize such properties as \Illuminate\Database\Eloquent\Model|\Eloquent. Instead it should be of type \Illuminate\Database\Eloquent\Model|\Eloquent|null.
// migration
Schema::create('examples', function (Blueprint $table) {
$table->nullableMorphs('column');
});
// class Example
public function column(): MorphTo
{
return $this->morphTo('column');
}
Can you make a PR with tests?
I'll prepare something.
https://github.com/barryvdh/laravel-ide-helper/pull/1549