1 unresolved thread
Closes #3419074
Merge request reports
Activity
62 62 $selection_handler_groups = $this->getSelectionGroups($target_type); 63 63 64 64 // Sort the selection plugins by weight and select the best match. 65 uasort($selection_handler_groups[$base_plugin_id], ['Drupal\Component\Utility\SortArray', 'sortByWeightElement']); 65 66 // Sort the selection plugins by weight and select the best match. 67 if ($selection_handler_groups && count($selection_handler_groups) > 1) { It would be better to use modern PHP syntax:
public function getPluginId($target_type, $base_plugin_id) { // Get all available selection plugins for this entity type by plugin Id. $plugin_handler_groups = $this->getSelectionGroups($target_type)[$base_plugin_id] ?? []; // Sort the selection plugins by weight and select the best match. uasort($plugin_handler_groups, ['Drupal\Component\Utility\SortArray', 'sortByWeightElement']); $plugin_id = array_key_last(plugin_handler_groups); return $plugin_id; }
The modern syntax is https://www.php.net/manual/en/functions.first_class_callable_syntax.php
Edited by Andrey Postnikov
Please register or sign in to reply