- Issue created by @kingdutch
GroupRelationshipInterface
specifies getEntity
as returning a EntityInterface
. This interface is extended by GroupMembershipInterface
and implemented by GroupMembership
.
From the rules around how the GroupMembership
works we know that the entity that it points to are user entities (I'm assuming this is enforced in code). However, when you know you have an instance of GroupMembershipInterface
, tools like PHPStan or your IDE will still think GroupMembershipInterface::getEntity
returns a EntityInterface
rather than knowing you'll get a UserInterface
instance. This requires extra checks, assertions or annotations.
Add getEntity
as method to GroupMembershipInterface
and narrow the type-hint to UserInterface
. This is allowed because UserInterface
still satisfies EntityInterface
GroupMembershipInterface
and GroupMembership
are now type-hinted to return a UserInterface
when calling getEntity
Active
3.3
Code