Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #603 from kbrodej/bugfix/createMembership-invalid-…
Browse files Browse the repository at this point in the history
…account-objects

MembershipManager::createMembership() is accepting invalid account objects #540
  • Loading branch information
pfrenssen authored Feb 7, 2020
2 parents 76b0b6c + a877df5 commit 8de5c6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/MembershipManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ public function getGroupMembershipsByRoleNames(EntityInterface $group, array $ro
/**
* {@inheritdoc}
*/
public function createMembership(EntityInterface $group, AccountInterface $user, $membership_type = OgMembershipInterface::TYPE_DEFAULT) {
/** @var \Drupal\user\UserInterface|\Drupal\Core\Session\AccountInterface $user */
public function createMembership(EntityInterface $group, UserInterface $user, $membership_type = OgMembershipInterface::TYPE_DEFAULT) {
/** @var \Drupal\user\UserInterface $user */
/** @var \Drupal\og\OgMembershipInterface $membership */
$membership = OgMembership::create(['type' => $membership_type]);
$membership
Expand Down
6 changes: 3 additions & 3 deletions src/MembershipManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Drupal\og;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\user\UserInterface;

/**
* Membership manager interface.
Expand Down Expand Up @@ -169,7 +169,7 @@ public function getGroupMembershipsByRoleNames(EntityInterface $group, array $ro
*
* @param \Drupal\Core\Entity\EntityInterface $group
* The group entity.
* @param \Drupal\Core\Session\AccountInterface $user
* @param \Drupal\user\UserInterface $user
* The user object.
* @param string $membership_type
* (optional) The membership type. Defaults to
Expand All @@ -178,7 +178,7 @@ public function getGroupMembershipsByRoleNames(EntityInterface $group, array $ro
* @return \Drupal\og\OgMembershipInterface
* The unsaved membership object.
*/
public function createMembership(EntityInterface $group, AccountInterface $user, $membership_type = OgMembershipInterface::TYPE_DEFAULT);
public function createMembership(EntityInterface $group, UserInterface $user, $membership_type = OgMembershipInterface::TYPE_DEFAULT);

/**
* Returns all group IDs associated with the given group content entity.
Expand Down

0 comments on commit 8de5c6b

Please sign in to comment.