From f4717bc191840dc9b9981bf6fee400fb03fc6dff Mon Sep 17 00:00:00 2001
From: Nick Dickinson-Wilde <29811-NickWilde@users.noreply.drupalcode.org>
Date: Mon, 9 Dec 2024 05:29:00 +0000
Subject: [PATCH] Issue #3492427 by nickdickinsonwilde, akulsaxena: Nullable
 types must be explicit

---
 src/Traits/PluginHelperTrait.php | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/Traits/PluginHelperTrait.php b/src/Traits/PluginHelperTrait.php
index 61595f1..1de08a5 100644
--- a/src/Traits/PluginHelperTrait.php
+++ b/src/Traits/PluginHelperTrait.php
@@ -116,15 +116,15 @@ trait PluginHelperTrait {
    *
    * This is based on CategorizingPluginManagerTrait::getGroupedDefinitions.
    *
-   * @param array $definitions
-   *   The definitions as provided by the Block Plugin Manager.
+   * @param array|null $definitions
+   *   (optional) The definitions as provided by the Block Plugin Manager.
    * @param string $label_key
    *   The key to use if a block does not have a category defined.
    *
    * @return array
    *   Definitions grouped by untranslated category.
    */
-  public function getGroupedDefinitions(array $definitions = NULL, $label_key = 'label') {
+  public function getGroupedDefinitions(?array $definitions = NULL, $label_key = 'label') {
     $definitions = $this->getSortedDefinitions($definitions, $label_key);
     $grouped_definitions = [];
     foreach ($definitions as $id => $definition) {
@@ -203,15 +203,15 @@ trait PluginHelperTrait {
   /**
    * Sort block categories alphabetically.
    *
-   * @param array $definitions
-   *   The block definitions, with category values.
+   * @param array|null $definitions
+   *   (optional) The block definitions, with category values.
    * @param string $label_key
    *   The module name, if no category value is present on the block.
    *
    * @return array
    *   The alphabetically sorted categories with definitions.
    */
-  protected function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') {
+  protected function getSortedDefinitions(?array $definitions = NULL, $label_key = 'label') {
     uasort($definitions, function ($a, $b) use ($label_key) {
       if ($a['category'] != $b['category']) {
         $a['category'] = $a['category'] ?? '';
-- 
GitLab