Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect type for nullable morph #1547

Open
matysekmichal opened this issue May 16, 2024 · 3 comments
Open

Incorrect type for nullable morph #1547

matysekmichal opened this issue May 16, 2024 · 3 comments

Comments

@matysekmichal
Copy link
Contributor

matysekmichal commented May 16, 2024

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');
}
@mfn
Copy link
Collaborator

mfn commented May 16, 2024

Can you make a PR with tests?

@matysekmichal
Copy link
Contributor Author

I'll prepare something.

@matysekmichal
Copy link
Contributor Author

#1549

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants