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

Commit

Permalink
Adhere to coding standards.
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrenssen committed Jul 22, 2019
1 parent ff9632e commit 8ff95dd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
7 changes: 6 additions & 1 deletion phpcs-ruleset.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@
<exclude-pattern>*.min.css</exclude-pattern>
<exclude-pattern>*.min.js</exclude-pattern>

<rule ref="./vendor/drupal/coder/coder_sniffer/Drupal" />
<rule ref="./vendor/drupal/coder/coder_sniffer/Drupal">
<!-- URLs in deprecation messages point to Github rather than drupal.org. -->
<exclude name="Drupal.Semantics.FunctionTriggerError.TriggerErrorSeeUrlFormat" />
<!-- Deprecation versions are allowed to include beta versions. -->
<exclude name="Drupal.Semantics.FunctionTriggerError.TriggerErrorVersion" />
</rule>
</ruleset>
36 changes: 18 additions & 18 deletions src/MembershipManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, OgG
* {@inheritdoc}
*/
public function getUserGroupIds($user_id, array $states = [OgMembershipInterface::STATE_ACTIVE]) {
if ($user_id instanceof AccountInterface) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Pass the user ID instead.', E_USER_DEPRECATED);
if (!is_int($user_id)) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
$user_id = $user_id->id();
}
$group_ids = [];
Expand All @@ -82,8 +82,8 @@ public function getUserGroupIds($user_id, array $states = [OgMembershipInterface
* {@inheritdoc}
*/
public function getUserGroups($user_id, array $states = [OgMembershipInterface::STATE_ACTIVE]) {
if ($user_id instanceof AccountInterface) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Pass the user ID instead.', E_USER_DEPRECATED);
if (!is_int($user_id)) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
$user_id = $user_id->id();
}

Expand All @@ -95,8 +95,8 @@ public function getUserGroups($user_id, array $states = [OgMembershipInterface::
* {@inheritdoc}
*/
public function getMemberships($user_id, array $states = [OgMembershipInterface::STATE_ACTIVE]) {
if ($user_id instanceof AccountInterface) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Pass the user ID instead.', E_USER_DEPRECATED);
if (!is_int($user_id)) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
$user_id = $user_id->id();
}

Expand Down Expand Up @@ -130,8 +130,8 @@ public function getMemberships($user_id, array $states = [OgMembershipInterface:
* {@inheritdoc}
*/
public function getMembership(EntityInterface $group, $user_id, array $states = [OgMembershipInterface::STATE_ACTIVE]) {
if ($user_id instanceof AccountInterface) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Pass the user ID instead.', E_USER_DEPRECATED);
if (!is_int($user_id)) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
$user_id = $user_id->id();
}

Expand All @@ -149,8 +149,8 @@ public function getMembership(EntityInterface $group, $user_id, array $states =
* {@inheritdoc}
*/
public function getUserGroupIdsByRoleIds($user_id, array $role_ids, array $states = [OgMembershipInterface::STATE_ACTIVE], bool $require_all_roles = TRUE): array {
if ($user_id instanceof AccountInterface) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Pass the user ID instead.', E_USER_DEPRECATED);
if (!is_int($user_id)) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
$user_id = $user_id->id();
}

Expand All @@ -172,8 +172,8 @@ public function getUserGroupIdsByRoleIds($user_id, array $role_ids, array $state
* {@inheritdoc}
*/
public function getUserGroupsByRoleIds($user_id, array $role_ids, array $states = [OgMembershipInterface::STATE_ACTIVE], bool $require_all_roles = TRUE): array {
if ($user_id instanceof AccountInterface) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Pass the user ID instead.', E_USER_DEPRECATED);
if (!is_int($user_id)) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
$user_id = $user_id->id();
}

Expand Down Expand Up @@ -415,8 +415,8 @@ public function getGroupContentIds(EntityInterface $entity, array $entity_types
* {@inheritdoc}
*/
public function isMember(EntityInterface $group, $user_id, array $states = [OgMembershipInterface::STATE_ACTIVE]) {
if ($user_id instanceof AccountInterface) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Pass the user ID instead.', E_USER_DEPRECATED);
if (!is_int($user_id)) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
$user_id = $user_id->id();
}

Expand All @@ -429,8 +429,8 @@ public function isMember(EntityInterface $group, $user_id, array $states = [OgMe
* {@inheritdoc}
*/
public function isMemberPending(EntityInterface $group, $user_id) {
if ($user_id instanceof AccountInterface) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Pass the user ID instead.', E_USER_DEPRECATED);
if (!is_int($user_id)) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
$user_id = $user_id->id();
}

Expand All @@ -441,8 +441,8 @@ public function isMemberPending(EntityInterface $group, $user_id) {
* {@inheritdoc}
*/
public function isMemberBlocked(EntityInterface $group, $user_id) {
if ($user_id instanceof AccountInterface) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Pass the user ID instead.', E_USER_DEPRECATED);
if (!is_int($user_id)) {
trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
$user_id = $user_id->id();
}

Expand Down
1 change: 0 additions & 1 deletion src/Plugin/EntityReferenceSelection/OgSelection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Drupal\og\Plugin\EntityReferenceSelection;

use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection;
use Drupal\user\Entity\User;
use Drupal\og\Og;

/**
Expand Down
1 change: 0 additions & 1 deletion src/Plugin/Field/FieldWidget/OgComplex.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget;
use Drupal\Core\Form\FormStateInterface;
use Drupal\og\OgAccess;
use Drupal\user\Entity\User;

/**
* Plugin implementation of the 'entity_reference autocomplete' widget.
Expand Down

0 comments on commit 8ff95dd

Please sign in to comment.