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

fix: change return type of hasOne and belongsTo to nullable object type. #3979

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion framework/core/js/dist/admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion framework/core/js/dist/admin.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion framework/core/js/src/admin/components/StatusWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class StatusWidget extends DashboardWidget {
[
<span>
<strong>{app.translator.trans('core.admin.dashboard.status.headers.scheduler-status')}</strong>{' '}
<LinkButton href="https://discuss.flarum.org/d/24118" external={true} target="_blank" icon="fas fa-info-circle" />
<LinkButton href="https://docs.flarum.org/scheduler" external={true} target="_blank" icon="fas fa-info-circle" />
</span>,
<br />,
app.data.schedulerStatus,
Expand Down
7 changes: 6 additions & 1 deletion php-packages/phpstan/src/Relations/RelationProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use PHPStan\Type\Generic\GenericObjectType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use PHPStan\Type\NullType;
use PHPStan\Type\UnionType;

class RelationProperty implements PropertyReflection
{
Expand Down Expand Up @@ -66,7 +68,10 @@ public function getReadableType(): Type

case 'hasOne':
case 'belongsTo':
return new ObjectType($this->methodCall->arguments[1]->class->toString());
return new UnionType([
new ObjectType($this->methodCall->arguments[1]->class->toString()),
new NullType(),
]);

default:
throw new Exception('Unknown relationship type for relation: '.$this->methodCall->methodName);
Expand Down
Loading