Skip to content
Snippets Groups Projects

3492427 fix nullable types

@@ -116,15 +116,15 @@ trait PluginHelperTrait {
@@ -116,15 +116,15 @@ trait PluginHelperTrait {
*
*
* This is based on CategorizingPluginManagerTrait::getGroupedDefinitions.
* This is based on CategorizingPluginManagerTrait::getGroupedDefinitions.
*
*
* @param array $definitions
* @param array|null $definitions
* The definitions as provided by the Block Plugin Manager.
* (optional) The definitions as provided by the Block Plugin Manager.
* @param string $label_key
* @param string $label_key
* The key to use if a block does not have a category defined.
* The key to use if a block does not have a category defined.
*
*
* @return array
* @return array
* Definitions grouped by untranslated category.
* 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);
$definitions = $this->getSortedDefinitions($definitions, $label_key);
$grouped_definitions = [];
$grouped_definitions = [];
foreach ($definitions as $id => $definition) {
foreach ($definitions as $id => $definition) {
@@ -203,15 +203,15 @@ trait PluginHelperTrait {
@@ -203,15 +203,15 @@ trait PluginHelperTrait {
/**
/**
* Sort block categories alphabetically.
* Sort block categories alphabetically.
*
*
* @param array $definitions
* @param array|null $definitions
* The block definitions, with category values.
* (optional) The block definitions, with category values.
* @param string $label_key
* @param string $label_key
* The module name, if no category value is present on the block.
* The module name, if no category value is present on the block.
*
*
* @return array
* @return array
* The alphabetically sorted categories with definitions.
* 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) {
uasort($definitions, function ($a, $b) use ($label_key) {
if ($a['category'] != $b['category']) {
if ($a['category'] != $b['category']) {
$a['category'] = $a['category'] ?? '';
$a['category'] = $a['category'] ?? '';
Loading