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

Commit

Permalink
Merge pull request #746 from Gizra/feature/coder8.3
Browse files Browse the repository at this point in the history
Upgrade to coder 8.3
MPParsley authored Aug 26, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 7b00a53 + 70e48de commit 008ca50
Showing 7 changed files with 18 additions and 24 deletions.
20 changes: 7 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -26,22 +26,16 @@
],
"require": {
"php": "^7.4 || ^8",
"cweagans/composer-patches": "^1.7",
"drupal/core": "^9.2"
},
"require-dev": {
"drupal/coder": "^8.2",
"phpunit/phpunit": "^7 || ^8",
"slevomat/coding-standard": "~6.0"
"drupal/coder": "^8.3.16",
"phpunit/phpunit": "^7 || ^8"
},
"extra": {
"composer-exit-on-patch-failure": true,
"enable-patching": true,
"patches": {
"drupal/coder": {
"https://www.drupal.org/project/coder/issues/3250986": "https://patch-diff.githubusercontent.com/raw/pfrenssen/coder/pull/157.diff"
}
"minimum-stability": "RC",
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"minimum-stability": "RC"
}
}
4 changes: 2 additions & 2 deletions src/Element/OgAutocomplete.php
Original file line number Diff line number Diff line change
@@ -34,12 +34,12 @@ public static function processEntityAutocomplete(array &$element, FormStateInter
throw new \InvalidArgumentException("Missing required #autocreate['bundle'] parameter.");
}
// Default the autocreate user ID to the current user.
$element['#autocreate']['uid'] = isset($element['#autocreate']['uid']) ? $element['#autocreate']['uid'] : \Drupal::currentUser()->id();
$element['#autocreate']['uid'] = $element['#autocreate']['uid'] ?? \Drupal::currentUser()->id();
}

// Store the selection settings in the key/value store and pass a hashed key
// in the route parameters.
$selection_settings = isset($element['#selection_settings']) ? $element['#selection_settings'] : [];
$selection_settings = $element['#selection_settings'] ?? [];
$data = serialize($selection_settings) . $element['#target_type'] . $element['#selection_handler'];
$selection_settings_key = Crypt::hmacBase64($data, \Drupal::service('private_key')->get() . Settings::getHashSalt());

6 changes: 3 additions & 3 deletions src/GroupTypeManager.php
Original file line number Diff line number Diff line change
@@ -198,7 +198,7 @@ public function isGroupContent($entity_type_id, $bundle) {
*/
public function getGroupBundleIdsByEntityType($entity_type_id) {
$group_map = $this->getGroupMap();
return isset($group_map[$entity_type_id]) ? $group_map[$entity_type_id] : [];
return $group_map[$entity_type_id] ?? [];
}

/**
@@ -209,7 +209,7 @@ public function getAllGroupContentBundleIds() {
foreach ($this->getGroupRelationMap() as $group_bundle_ids) {
foreach ($group_bundle_ids as $group_content_entity_type_ids) {
foreach ($group_content_entity_type_ids as $group_content_entity_type_id => $group_content_bundle_ids) {
$bundles[$group_content_entity_type_id] = array_merge(isset($bundles[$group_content_entity_type_id]) ? $bundles[$group_content_entity_type_id] : [], $group_content_bundle_ids);
$bundles[$group_content_entity_type_id] = array_merge($bundles[$group_content_entity_type_id] ?? [], $group_content_bundle_ids);
}
}
}
@@ -257,7 +257,7 @@ public function getGroupBundleIdsByGroupContentBundle($group_content_entity_type
*/
public function getGroupContentBundleIdsByGroupBundle($group_entity_type_id, $group_bundle_id) {
$group_relation_map = $this->getGroupRelationMap();
return isset($group_relation_map[$group_entity_type_id][$group_bundle_id]) ? $group_relation_map[$group_entity_type_id][$group_bundle_id] : [];
return $group_relation_map[$group_entity_type_id][$group_bundle_id] ?? [];
}

/**
2 changes: 1 addition & 1 deletion src/OgResolvedGroupCollection.php
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ public function addGroup(ContentEntityInterface $group, array $cache_contexts =
}
$key = $this->generateKey($group);
$this->groupInfo[$key]['entity'] = $group;
$this->groupInfo[$key]['votes'][] = $weight !== NULL ? $weight : $this->getVoteWeight();
$this->groupInfo[$key]['votes'][] = $weight ?? $this->getVoteWeight();
foreach ($cache_contexts as $cache_context) {
$this->groupInfo[$key]['cache_contexts'][$cache_context] = $cache_context;
}
2 changes: 1 addition & 1 deletion src/Plugin/EntityReferenceSelection/OgSelection.php
Original file line number Diff line number Diff line change
@@ -127,7 +127,7 @@ protected function getUserGroups() {
/** @var \Drupal\og\MembershipManagerInterface $membership_manager */
$membership_manager = \Drupal::service('og.membership_manager');
$other_groups = $membership_manager->getUserGroups($this->currentUser->id());
return isset($other_groups[$this->configuration['target_type']]) ? $other_groups[$this->configuration['target_type']] : [];
return $other_groups[$this->configuration['target_type']] ?? [];
}

}
4 changes: 2 additions & 2 deletions src/Plugin/Field/FieldWidget/OgComplex.php
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f
/** @var \Drupal\og\MembershipManagerInterface $membership_manager */
$membership_manager = \Drupal::service('og.membership_manager');
$user_groups = $membership_manager->getUserGroups(\Drupal::currentUser()->id());
$user_groups_target_type = isset($user_groups[$target_type]) ? $user_groups[$target_type] : [];
$user_groups_target_type = $user_groups[$target_type] ?? [];
$user_group_ids = array_map(function ($group) {
return $group->id();
}, $user_groups_target_type);
@@ -239,7 +239,7 @@ protected function otherGroupsWidget(FieldItemListInterface $items, FormStateInt
/** @var \Drupal\og\MembershipManagerInterface $membership_manager */
$membership_manager = \Drupal::service('og.membership_manager');
$user_groups = $membership_manager->getUserGroups(\Drupal::currentUser()->id());
$user_groups_target_type = isset($user_groups[$target_type]) ? $user_groups[$target_type] : [];
$user_groups_target_type = $user_groups[$target_type] ?? [];
$user_group_ids = array_map(function ($group) {
return $group->id();
}, $user_groups_target_type);
4 changes: 2 additions & 2 deletions tests/src/Kernel/Action/ActionTestBase.php
Original file line number Diff line number Diff line change
@@ -218,7 +218,7 @@ public function testAccess() {
// single test, so that the expensive setup is not executed over and over.
$test_cases = $this->accessProvider();
foreach ($test_cases as $test_case) {
list($user, $membership) = $test_case;
[$user, $membership] = $test_case;

// When testing the group owner, configure whether or not they have full
// access.
@@ -245,7 +245,7 @@ public function testNoAccess() {
// single test, so that the expensive setup is not executed over and over.
$test_cases = $this->noAccessProvider();
foreach ($test_cases as $test_case) {
list($user, $membership) = $test_case;
[$user, $membership] = $test_case;

// When testing the group owner, configure whether or not they have full
// access.

0 comments on commit 008ca50

Please sign in to comment.