From 876e17f5763acac1a7fda9882da741598a70e65f Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Tue, 26 Jul 2022 12:55:10 +0900 Subject: [PATCH] Issue #3299327 by andypost, Berdir: Replace deprecated static::method() calls for PHP 8.2 --- core/lib/Drupal/Core/Asset/AssetResolver.php | 4 ++-- core/lib/Drupal/Core/Mail/MailFormatHelper.php | 2 +- core/lib/Drupal/Core/Render/Element.php | 2 +- core/modules/user/src/Entity/Role.php | 2 +- core/modules/views/src/Plugin/views/filter/Date.php | 2 +- .../views/src/Plugin/views/filter/FilterPluginBase.php | 2 +- core/modules/views/src/Plugin/views/filter/ManyToOne.php | 2 +- core/modules/views/src/ViewsDataHelper.php | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/lib/Drupal/Core/Asset/AssetResolver.php b/core/lib/Drupal/Core/Asset/AssetResolver.php index c57bbffe2874..6f477d19f68e 100644 --- a/core/lib/Drupal/Core/Asset/AssetResolver.php +++ b/core/lib/Drupal/Core/Asset/AssetResolver.php @@ -155,7 +155,7 @@ public function getCssAssets(AttachedAssetsInterface $assets, $optimize) { $this->themeManager->alter('css', $css, $assets); // Sort CSS items, so that they appear in the correct order. - uasort($css, 'static::sort'); + uasort($css, [static::class, 'sort']); if ($optimize) { $css = \Drupal::service('asset.css.collection_optimizer')->optimize($css); @@ -262,7 +262,7 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize) { $this->themeManager->alter('js', $javascript, $assets); // Sort JavaScript assets, so that they appear in the correct order. - uasort($javascript, 'static::sort'); + uasort($javascript, [static::class, 'sort']); // Prepare the return value: filter JavaScript assets per scope. $js_assets_header = []; diff --git a/core/lib/Drupal/Core/Mail/MailFormatHelper.php b/core/lib/Drupal/Core/Mail/MailFormatHelper.php index 42468cbbf8b3..4d7a1ae7ae95 100644 --- a/core/lib/Drupal/Core/Mail/MailFormatHelper.php +++ b/core/lib/Drupal/Core/Mail/MailFormatHelper.php @@ -125,7 +125,7 @@ public static function htmlToText($string, $allowed_tags = NULL) { // 'See the Drupal site [1]' with the URL included as a footnote. static::htmlToMailUrls(NULL, TRUE); $pattern = '@(<a[^>]+?href="([^"]*)"[^>]*?>(.+?)</a>)@i'; - $string = preg_replace_callback($pattern, 'static::htmlToMailUrls', $string); + $string = preg_replace_callback($pattern, [static::class, 'htmlToMailUrls'], $string); $urls = static::htmlToMailUrls(); $footnotes = ''; if (count($urls)) { diff --git a/core/lib/Drupal/Core/Render/Element.php b/core/lib/Drupal/Core/Render/Element.php index dbd0804119ae..27e4d1ab05c2 100644 --- a/core/lib/Drupal/Core/Render/Element.php +++ b/core/lib/Drupal/Core/Render/Element.php @@ -37,7 +37,7 @@ public static function property($key) { * An array of property keys for the element. */ public static function properties(array $element) { - return array_filter(array_keys($element), 'static::property'); + return array_filter(array_keys($element), [static::class, 'property']); } /** diff --git a/core/modules/user/src/Entity/Role.php b/core/modules/user/src/Entity/Role.php index f65af5108854..af05336658b2 100644 --- a/core/modules/user/src/Entity/Role.php +++ b/core/modules/user/src/Entity/Role.php @@ -169,7 +169,7 @@ public static function postLoad(EntityStorageInterface $storage, array &$entitie parent::postLoad($storage, $entities); // Sort the queried roles by their weight. // See \Drupal\Core\Config\Entity\ConfigEntityBase::sort(). - uasort($entities, 'static::sort'); + uasort($entities, [static::class, 'sort']); } /** diff --git a/core/modules/views/src/Plugin/views/filter/Date.php b/core/modules/views/src/Plugin/views/filter/Date.php index 9aa8168f0878..e15f0b249392 100644 --- a/core/modules/views/src/Plugin/views/filter/Date.php +++ b/core/modules/views/src/Plugin/views/filter/Date.php @@ -111,7 +111,7 @@ protected function hasValidGroupedValue(array $group) { // one greater. $operators = $this->operators(); $expected = $operators[$group['operator']]['values'] + 1; - $actual = count(array_filter($group['value'], 'static::arrayFilterZero')); + $actual = count(array_filter($group['value'], [static::class, 'arrayFilterZero'])); return $actual == $expected; } diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php index 6401fe01435f..1da612333e08 100644 --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -704,7 +704,7 @@ protected function hasValidGroupedValue(array $group) { // types). Ensure at least the minimum number of values is present for // this entry to be considered valid. $min_values = $operators[$group['operator']]['values']; - $actual_values = count(array_filter($group['value'], 'static::arrayFilterZero')); + $actual_values = count(array_filter($group['value'], [static::class, 'arrayFilterZero'])); return $actual_values >= $min_values; } } diff --git a/core/modules/views/src/Plugin/views/filter/ManyToOne.php b/core/modules/views/src/Plugin/views/filter/ManyToOne.php index 1b3810cfe6f2..9fd8a42fe8a9 100644 --- a/core/modules/views/src/Plugin/views/filter/ManyToOne.php +++ b/core/modules/views/src/Plugin/views/filter/ManyToOne.php @@ -132,7 +132,7 @@ protected function opHelper() { } // Form API returns unchecked options in the form of option_id => 0. This // breaks the generated query for "is all of" filters so we remove them. - $this->value = array_filter($this->value, 'static::arrayFilterZero'); + $this->value = array_filter($this->value, [static::class, 'arrayFilterZero']); $this->helper->addFilter(); } diff --git a/core/modules/views/src/ViewsDataHelper.php b/core/modules/views/src/ViewsDataHelper.php index c977882d9b47..f6522e46ca3a 100644 --- a/core/modules/views/src/ViewsDataHelper.php +++ b/core/modules/views/src/ViewsDataHelper.php @@ -148,7 +148,7 @@ public function fetchFields($base, $type, $grouping = FALSE, $sub_type = NULL) { $strings += $this->fields[$base_table][$type]; } } - uasort($strings, ['self', 'fetchedFieldSort']); + uasort($strings, [self::class, 'fetchedFieldSort']); return $strings; } -- GitLab