Maybe there is a different sollution than with UnionType, but I found no hints about setting the ObjectType as nullable one.
Fixes: no issues
Changes proposed in this pull request:
Change return type of hasOne and belongsTo to nullable object type in the RelationProperty Phpstan Reflection Class.
Reviewers should focus on:
Is this Valid in every case, is there a case where nullable is not true?
Screenshot
Necessity
[ ] Has the problem that is being solved here been clearly explained?
[ ] If applicable, have various options for solving this problem been considered?
[ ] For core PRs, does this need to be in core, or could it be in an extension?
[ ] Are we willing to maintain this for years / potentially forever?
Confirmed
[ ] Frontend changes: tested on a local Flarum installation.
[ ] Backend changes: tests are green (run composer test).
[ ] Core developer confirmed locally this works as intended.
[ ] Tests have been added, or are not appropriate here.
Maybe there is a different sollution than with UnionType, but I found no hints about setting the ObjectType as nullable one.
Fixes: no issues
Changes proposed in this pull request: Change return type of hasOne and belongsTo to nullable object type in the RelationProperty Phpstan Reflection Class.
Reviewers should focus on: Is this Valid in every case, is there a case where nullable is not true?
Screenshot
Necessity
Confirmed
composer test
).