laravel-ide-helper
laravel-ide-helper copied to clipboard
Should generate |null for @property-read of morphTo relation
Versions:
- ide-helper Version: 2.12.3
- Laravel Version: 9.25.1
- PHP Version: 8.1.x
Description:
Suppose a model like this:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
class Test extends Model
{
public function owner(): MorphTo
{
return $this->morphTo();
}
}
ide-helper generates the following line for the relation:
* @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $owner
expected:
* @property-read \Illuminate\Database\Eloquent\Model|\Eloquent|null $owner
ide-helper generates |null for similar relations. (eg. BelongsTo)
I tested this with nullable columns for owner_id and owner_type, this does not make a difference.
+1
+1
I think this one should be easy to fix
It's only been 1.5 years...