From e125ce28f59bc3c801e85cddce797b415053b8f7 Mon Sep 17 00:00:00 2001 From: Lee Rowlands <lee.rowlands@previousnext.com.au> Date: Mon, 15 Nov 2021 12:35:55 +1000 Subject: [PATCH] Issue #3222769 by bbrala, alexpott, longwave, Matroskeen: [November 8, 2021] Replace all list (array destructuring) assignment to the array syntax (cherry picked from commit 6d39cdeeb47c2179a8fcabcb2b41e71f89f2996e) --- composer/Plugin/Scaffold/Interpolator.php | 2 +- core/includes/batch.inc | 8 ++--- core/includes/bootstrap.inc | 2 +- core/includes/errors.inc | 2 +- core/includes/install.inc | 2 +- core/includes/theme.inc | 2 +- core/includes/update.inc | 2 +- .../Annotation/Doctrine/DocParser.php | 4 +-- .../Component/Diff/Engine/DiffEngine.php | 4 +-- .../Drupal/Component/Diff/WordLevelDiff.php | 4 +-- .../lib/Drupal/Component/Gettext/PoHeader.php | 2 +- .../DerivativeDiscoveryDecorator.php | 2 +- .../Drupal/Component/Plugin/PluginBase.php | 4 +-- .../Drupal/Component/Utility/UrlHelper.php | 4 +-- .../Ajax/AjaxResponseAttachmentsProcessor.php | 2 +- core/lib/Drupal/Core/Asset/AssetResolver.php | 10 +++---- .../Core/Asset/LibraryDependencyResolver.php | 2 +- .../Core/Asset/LibraryDiscoveryCollector.php | 4 +-- .../Cache/Context/CacheContextsManager.php | 8 ++--- .../lib/Drupal/Core/Command/DbDumpCommand.php | 2 +- .../Drupal/Core/Config/ConfigInstaller.php | 6 ++-- core/lib/Drupal/Core/Config/ConfigManager.php | 4 +-- .../Core/Controller/ControllerResolver.php | 4 +-- .../Core/Database/Driver/pgsql/Schema.php | 2 +- .../Core/Database/Driver/pgsql/Select.php | 2 +- .../Core/Database/Driver/sqlite/Schema.php | 2 +- .../Core/Datetime/Element/DateElementBase.php | 2 +- .../DependencyInjection/YamlFileLoader.php | 2 +- .../Entity/Enhancer/EntityRouteEnhancer.php | 2 +- .../Drupal/Core/Entity/EntityAccessCheck.php | 2 +- .../Core/Entity/EntityBundleAccessCheck.php | 2 +- .../Entity/EntityConstraintViolationList.php | 2 +- .../Core/Entity/EntityCreateAccessCheck.php | 2 +- .../Core/Entity/EntityDisplayRepository.php | 2 +- .../Core/Entity/EntityResolverManager.php | 10 +++---- .../Core/Entity/HtmlEntityFormController.php | 2 +- .../Core/Entity/Query/Sql/QueryAggregate.php | 2 +- .../Drupal/Core/Entity/Query/Sql/Tables.php | 2 +- .../Sql/SqlContentEntityStorageSchema.php | 2 +- .../ConfigImportSubscriber.php | 2 +- .../ResponseGeneratorSubscriber.php | 2 +- core/lib/Drupal/Core/Extension/Dependency.php | 2 +- .../Core/Layout/LayoutPluginManager.php | 2 +- .../lib/Drupal/Core/Mail/MailFormatHelper.php | 4 +-- .../Core/Menu/Form/MenuLinkDefaultForm.php | 2 +- .../Core/Menu/MenuParentFormSelector.php | 2 +- .../Plugin/Context/LazyContextRepository.php | 2 +- .../HtmlResponseAttachmentsProcessor.php | 4 +-- .../Core/Render/MainContent/HtmlRenderer.php | 2 +- .../Core/Security/DoTrustedCallbackTrait.php | 4 +-- .../Drupal/Core/StreamWrapper/LocalStream.php | 4 +-- .../Drupal/Core/Template/TwigNodeTrans.php | 4 +-- core/lib/Drupal/Core/Test/TestDiscovery.php | 2 +- core/lib/Drupal/Core/Theme/Registry.php | 4 +-- .../lib/Drupal/Core/Update/UpdateRegistry.php | 4 +-- core/lib/Drupal/Core/Url.php | 2 +- core/modules/big_pipe/src/Render/BigPipe.php | 2 +- .../Plugin/migrate/process/BlockPluginId.php | 4 +-- .../Plugin/migrate/process/BlockRegion.php | 2 +- .../Plugin/migrate/process/BlockSettings.php | 4 +-- .../src/Plugin/migrate/process/BlockTheme.php | 2 +- .../migrate/process/BlockVisibility.php | 2 +- .../block/src/Plugin/migrate/source/Block.php | 2 +- .../block/tests/src/Functional/BlockTest.php | 2 +- .../src/Plugin/CKEditorPlugin/Internal.php | 2 +- .../src/Plugin/CKEditorPlugin/StylesCombo.php | 2 +- .../src/Functional/CKEditorLoadingTest.php | 6 ++-- core/modules/color/color.module | 6 ++-- .../views/filter/ModerationStateFilter.php | 4 +-- .../ContentModerationRouteSubscriber.php | 2 +- ...ontentTranslationFieldSyncRevisionTest.php | 2 +- core/modules/contextual/contextual.module | 2 +- .../src/Functional/DateTimeFieldTest.php | 2 +- .../src/Functional/DateRangeFieldTest.php | 2 +- .../src/Functional/EditorLoadingTest.php | 12 ++++---- .../Functional/EditorUploadImageScaleTest.php | 24 +++++++-------- core/modules/field/field.module | 2 +- .../process/d6/FieldInstanceDefaults.php | 2 +- .../d6/FieldInstanceOptionTranslation.php | 2 +- .../process/d6/FieldInstanceSettings.php | 2 +- .../d6/FieldInstanceWidgetSettings.php | 2 +- .../process/d6/FieldOptionTranslation.php | 2 +- .../migrate/process/d6/FieldSettings.php | 2 +- .../process/d7/FieldInstanceDefaults.php | 2 +- .../d7/FieldInstanceOptionTranslation.php | 2 +- .../process/d7/FieldInstanceSettings.php | 2 +- .../process/d7/FieldOptionTranslation.php | 2 +- .../Kernel/Boolean/BooleanFormatterTest.php | 2 +- .../Migrate/d7/MigrateFieldInstanceTest.php | 2 +- .../Timestamp/TimestampFormatterTest.php | 2 +- .../src/Form/EntityDisplayFormBase.php | 2 +- .../field_ui/src/Form/FieldStorageAddForm.php | 2 +- core/modules/file/file.module | 4 +-- core/modules/file/file.views.inc | 2 +- .../FieldFormatter/FileMediaFormatterBase.php | 2 +- .../src/Plugin/migrate/process/d6/FileUri.php | 2 +- .../src/Functional/FileFieldValidateTest.php | 2 +- .../src/Functional/SaveUploadFormTest.php | 2 +- .../tests/src/Functional/SaveUploadTest.php | 2 +- .../file/tests/src/Kernel/UsageTest.php | 6 ++-- core/modules/filter/filter.module | 2 +- .../Functional/FilterDefaultFormatTest.php | 2 +- .../src/Functional/FilterFormatAccessTest.php | 2 +- .../help_topics/src/HelpTopicDiscovery.php | 2 +- core/modules/image/image.views.inc | 2 +- .../PathProcessorImageStyles.php | 2 +- .../src/Plugin/Field/FieldType/ImageItem.php | 2 +- .../Plugin/ImageEffect/CropImageEffect.php | 2 +- .../ImageEffect/ScaleAndCropImageEffect.php | 2 +- .../src/Functional/ImageFieldDisplayTest.php | 2 +- .../src/Access/TemporaryQueryGuard.php | 2 +- .../ResourceObjectNormalizationCacher.php | 2 +- .../src/Revisions/VersionNegotiator.php | 2 +- .../tests/src/Functional/ResourceTestBase.php | 2 +- .../JsonApiDocumentTopLevelNormalizerTest.php | 30 +++++++++---------- .../ResourceResponseValidatorTest.php | 2 +- .../LanguageNegotiationUrl.php | 2 +- .../ContentTranslationEnabledSetting.php | 2 +- .../src/Functional/LanguageSwitchingTest.php | 4 +-- .../Unit/ContentLanguageSettingsUnitTest.php | 2 +- .../Entity/LayoutBuilderEntityViewDisplay.php | 4 +-- .../src/Plugin/Block/ExtraFieldBlock.php | 2 +- .../src/Plugin/Block/FieldBlock.php | 2 +- .../SectionStorage/DefaultsSectionStorage.php | 2 +- .../OverridesSectionStorage.php | 2 +- .../src/QuickEditIntegration.php | 4 +-- .../Plugin/Field/FieldWidget/LinkWidget.php | 2 +- .../tests/src/Functional/LinkFieldUITest.php | 2 +- .../Plugin/QueueWorker/LocaleTranslation.php | 2 +- core/modules/locale/src/PoDatabaseWriter.php | 2 +- .../media/src/OEmbed/ResourceFetcher.php | 2 +- .../src/Form/MenuLinkContentForm.php | 2 +- core/modules/menu_ui/menu_ui.module | 2 +- .../MenuSettingsConstraintValidator.php | 2 +- .../menu_ui/tests/src/Traits/MenuUiTrait.php | 2 +- .../src/EntityFieldDefinitionTrait.php | 2 +- .../src/Plugin/migrate/process/Download.php | 2 +- .../src/Plugin/migrate/process/FileCopy.php | 2 +- .../src/Plugin/migrate/process/Route.php | 2 +- .../tests/src/Kernel/QueryBatchTest.php | 2 +- .../tests/src/Kernel/process/FileCopyTest.php | 4 +-- .../src/Unit/MigrationPluginManagerTest.php | 2 +- .../src/Form/MigrateUpgradeFormBase.php | 2 +- .../MigrateUpgradeFormStepsTest.php | 2 +- .../NodeTranslationExceptionSubscriber.php | 2 +- .../node/src/Plugin/Search/NodeSearch.php | 2 +- .../tests/src/Functional/PageCacheTest.php | 4 +-- .../quickedit/src/QuickEditController.php | 2 +- .../migrate/process/ImageStyleMappings.php | 2 +- .../EntityResource/EntityResourceTestBase.php | 2 +- core/modules/search/src/SearchIndex.php | 2 +- core/modules/search/src/SearchQuery.php | 4 +-- core/modules/system/system.admin.inc | 2 +- core/modules/system/system.module | 2 +- .../Form/FormTestTableSelectColspanForm.php | 2 +- .../src/Form/FormTestTableSelectFormBase.php | 2 +- .../src/Functional/Ajax/FrameworkTest.php | 2 +- .../Entity/EntityCacheTagsTestBase.php | 4 +-- .../Form/ElementsTableSelectTest.php | 12 ++++---- .../src/Functional/Menu/LocalActionTest.php | 2 +- .../src/Functional/Menu/LocalTasksTest.php | 2 +- .../Module/InstallUninstallTest.php | 2 +- .../Functional/System/AdminMetaTagTest.php | 2 +- .../System/ResponseGeneratorTest.php | 2 +- .../tests/src/Kernel/Common/UrlTest.php | 2 +- .../system/tests/src/Kernel/Mail/MailTest.php | 4 +-- .../tests/src/Unit/Menu/MenuLinkTreeTest.php | 2 +- .../tests/src/Functional/TermTest.php | 2 +- .../src/Controller/ToolbarController.php | 2 +- core/modules/toolbar/toolbar.module | 4 +-- .../update/src/ProjectSecurityRequirement.php | 2 +- core/modules/user/src/AccountForm.php | 2 +- .../modules/user/src/Event/UserFloodEvent.php | 2 +- .../d6/ProfileFieldOptionTranslation.php | 2 +- .../tests/src/Kernel/UserValidationTest.php | 2 +- .../src/EventSubscriber/RouteSubscriber.php | 6 ++-- .../views/src/Plugin/Block/ViewsBlockBase.php | 2 +- .../src/Plugin/Derivative/ViewsLocalTask.php | 4 +-- .../src/Plugin/Derivative/ViewsMenuLink.php | 2 +- .../ViewsSelection.php | 4 +-- .../views/src/Plugin/views/area/View.php | 4 +-- .../views/src/Plugin/views/display/Page.php | 2 +- .../src/Plugin/views/field/EntityField.php | 4 +-- .../views/relationship/GroupwiseMax.php | 6 ++-- .../Plugin/views/wizard/WizardPluginBase.php | 4 +-- core/modules/views/src/Views.php | 2 +- .../Plugin/NumericFormatPluralTest.php | 2 +- ...sEntitySchemaSubscriberIntegrationTest.php | 30 +++++++++---------- .../views/tests/src/Kernel/ModuleTest.php | 2 +- .../Controller/ViewAjaxControllerTest.php | 12 ++++---- .../EventSubscriber/RouteSubscriberTest.php | 4 +-- .../Plugin/display/PathPluginBaseTest.php | 28 ++++++++--------- .../tests/src/Unit/ViewExecutableTest.php | 24 +++++++-------- core/modules/views/views.api.php | 4 +-- core/modules/views/views.views.inc | 2 +- .../views_ui/src/Form/Ajax/ConfigHandler.php | 2 +- core/modules/views_ui/src/ViewUI.php | 6 ++-- .../src/WorkflowAccessControlHandler.php | 2 +- .../workspaces/src/EntityQuery/Tables.php | 2 +- .../workspaces/src/Form/WorkspaceForm.php | 2 +- .../demo_umami_content/src/InstallHelper.php | 2 +- core/scripts/run-tests.sh | 10 +++---- .../Core/Asset/AttachedAssetsTest.php | 4 +-- .../KernelTests/Core/Database/SelectTest.php | 2 +- .../Core/Entity/EntityQueryTest.php | 2 +- .../Core/Entity/EntitySchemaTest.php | 4 +-- core/tests/Drupal/Tests/BrowserTestBase.php | 2 +- .../Tests/Component/Gettext/PoHeaderTest.php | 2 +- .../Core/Cache/CacheableMetadataTest.php | 2 +- .../Core/Extension/ExtensionListTest.php | 6 ++-- .../Core/Extension/InfoParserUnitTest.php | 2 +- .../Field/BaseFieldDefinitionTestBase.php | 2 +- .../Tests/Core/Mail/MailFormatHelperTest.php | 2 +- .../Core/Render/RendererRecursionTest.php | 6 ++-- .../DrupalStandardsListenerTrait.php | 2 +- .../tests/Drupal/Tests/XdebugRequestTrait.php | 2 +- 216 files changed, 367 insertions(+), 367 deletions(-) diff --git a/composer/Plugin/Scaffold/Interpolator.php b/composer/Plugin/Scaffold/Interpolator.php index c9f6a4fedb57..251415ee5e36 100644 --- a/composer/Plugin/Scaffold/Interpolator.php +++ b/composer/Plugin/Scaffold/Interpolator.php @@ -148,7 +148,7 @@ protected function findTokens($message) { } $tokens = []; foreach ($matches as $matchSet) { - list($sourceText, $key) = $matchSet; + [$sourceText, $key] = $matchSet; $tokens[$sourceText] = $key; } return $tokens; diff --git a/core/includes/batch.inc b/core/includes/batch.inc index ce812f155b09..2dc34b33d4fe 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -134,7 +134,7 @@ function _batch_needs_update($new_value = NULL) { */ function _batch_do() { // Perform actual processing. - list($percentage, $message, $label) = _batch_process(); + [$percentage, $message, $label] = _batch_process(); return new JsonResponse(['status' => TRUE, 'percentage' => $percentage, 'message' => $message, 'label' => $label]); } @@ -179,11 +179,11 @@ function _batch_progress_page() { // Just use the content of the response. $fallback = $response->getContent(); - list($fallback) = explode('<!--partial-->', $fallback); + [$fallback] = explode('<!--partial-->', $fallback); print $fallback; // Perform actual processing. - list($percentage, $message, $label) = _batch_process($batch); + [$percentage, $message, $label] = _batch_process($batch); if ($percentage == 100) { $new_op = 'finished'; } @@ -283,7 +283,7 @@ function _batch_process() { $finished = 1; if ($item = $queue->claimItem()) { - list($callback, $args) = $item->data; + [$callback, $args] = $item->data; // Build the 'context' array and execute the function call. $batch_context = [ diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 12464555f759..2a28d04e0873 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -418,7 +418,7 @@ function drupal_valid_test_ua($new_prefix = NULL) { $http_user_agent = $_SERVER['HTTP_USER_AGENT'] ?? NULL; $user_agent = $_COOKIE['SIMPLETEST_USER_AGENT'] ?? $http_user_agent; if (isset($user_agent) && preg_match("/^simple(\w+\d+):(.+):(.+):(.+)$/", $user_agent, $matches)) { - list(, $prefix, $time, $salt, $hmac) = $matches; + [, $prefix, $time, $salt, $hmac] = $matches; $check_string = $prefix . ':' . $time . ':' . $salt; // Read the hash salt prepared by drupal_generate_test_ua(). // This function is called before settings.php is read and Drupal's error diff --git a/core/includes/errors.inc b/core/includes/errors.inc index 69543cf0af89..79328b3e5c58 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -58,7 +58,7 @@ function drupal_error_levels() { function _drupal_error_handler_real($error_level, $message, $filename, $line) { if ($error_level & error_reporting()) { $types = drupal_error_levels(); - list($severity_msg, $severity_level) = $types[$error_level]; + [$severity_msg, $severity_level] = $types[$error_level]; $backtrace = debug_backtrace(); $caller = Error::getLastCaller($backtrace); diff --git a/core/includes/install.inc b/core/includes/install.inc index c24c16533342..dcb7ffa6911f 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -282,7 +282,7 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) { $state = 'default'; foreach (token_get_all($contents) as $token) { if (is_array($token)) { - list($type, $value) = $token; + [$type, $value] = $token; } else { $type = -1; diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 7476d323c3b2..ff7052d4a8d8 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -153,7 +153,7 @@ function drupal_find_theme_functions($cache, $prefixes) { // intermediary suggestion. $pattern = $info['pattern'] ?? ($hook . '__'); // Grep only the functions which are within the prefix group. - list($first_prefix,) = explode('_', $prefix, 2); + [$first_prefix] = explode('_', $prefix, 2); if (!isset($info['base hook']) && !empty($pattern) && isset($grouped_functions[$first_prefix])) { $matches = preg_grep('/^' . $prefix . '_' . $pattern . '/', $grouped_functions[$first_prefix]); if ($matches) { diff --git a/core/includes/update.inc b/core/includes/update.inc index e3644d86744c..7aed4b1a492d 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -286,7 +286,7 @@ function update_invoke_post_update($function, &$context) { return; } - list($module, $name) = explode('_post_update_', $function, 2); + [$module, $name] = explode('_post_update_', $function, 2); module_load_include('php', $module, $module . '.post_update'); if (function_exists($function)) { try { diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php b/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php index 04b81a0c1642..ccc44feca843 100644 --- a/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php +++ b/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php @@ -897,7 +897,7 @@ private function Constant() $identifier = $this->Identifier(); if ( ! defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { - list($className, $const) = explode('::', $identifier); + [$className, $const] = explode('::', $identifier); $alias = (false === $pos = strpos($className, '\\')) ? $className : substr($className, 0, $pos); $found = false; @@ -1099,7 +1099,7 @@ private function Arrayx() $this->match(DocLexer::T_CLOSE_CURLY_BRACES); foreach ($values as $value) { - list ($key, $val) = $value; + [$key, $val] = $value; if ($key !== null) { $array[$key] = $val; diff --git a/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php b/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php index bd3cc10a6216..f8ec05fbbbcb 100644 --- a/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php +++ b/core/lib/Drupal/Component/Diff/Engine/DiffEngine.php @@ -165,7 +165,7 @@ protected function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) { // Things seems faster (I'm not sure I understand why) // when the shortest sequence in X. $flip = TRUE; - list($xoff, $xlim, $yoff, $ylim) = [$yoff, $ylim, $xoff, $xlim]; + [$xoff, $xlim, $yoff, $ylim] = [$yoff, $ylim, $xoff, $xlim]; } if ($flip) { @@ -302,7 +302,7 @@ protected function _compareseq($xoff, $xlim, $yoff, $ylim) { //$nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); //$nchunks = max(2, min(8, (int)$nchunks)); $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1; - list($lcs, $seps) = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks); + [$lcs, $seps] = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks); } if ($lcs == 0) { diff --git a/core/lib/Drupal/Component/Diff/WordLevelDiff.php b/core/lib/Drupal/Component/Diff/WordLevelDiff.php index 66c6e1a90f2c..da6c9b6d5b57 100644 --- a/core/lib/Drupal/Component/Diff/WordLevelDiff.php +++ b/core/lib/Drupal/Component/Diff/WordLevelDiff.php @@ -14,8 +14,8 @@ class WordLevelDiff extends MappedDiff { const MAX_LINE_LENGTH = 10000; public function __construct($orig_lines, $closing_lines) { - list($orig_words, $orig_stripped) = $this->_split($orig_lines); - list($closing_words, $closing_stripped) = $this->_split($closing_lines); + [$orig_words, $orig_stripped] = $this->_split($orig_lines); + [$closing_words, $closing_stripped] = $this->_split($closing_lines); parent::__construct($orig_words, $closing_words, $orig_stripped, $closing_stripped); } diff --git a/core/lib/Drupal/Component/Gettext/PoHeader.php b/core/lib/Drupal/Component/Gettext/PoHeader.php index bdd0d20a5156..8bc912d3bd99 100644 --- a/core/lib/Drupal/Component/Gettext/PoHeader.php +++ b/core/lib/Drupal/Component/Gettext/PoHeader.php @@ -254,7 +254,7 @@ private function parseHeader($header) { $lines = array_map('trim', explode("\n", $header)); foreach ($lines as $line) { if ($line) { - list($tag, $contents) = explode(":", $line, 2); + [$tag, $contents] = explode(":", $line, 2); $header_parsed[trim($tag)] = trim($contents); } } diff --git a/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php b/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php index 6b47af01717b..7f629199b224 100644 --- a/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php +++ b/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php @@ -55,7 +55,7 @@ public function getDefinition($plugin_id, $exception_on_invalid = TRUE) { // $base_plugin_id. $plugin_definition = $this->decorated->getDefinition($plugin_id, FALSE); - list($base_plugin_id, $derivative_id) = $this->decodePluginId($plugin_id); + [$base_plugin_id, $derivative_id] = $this->decodePluginId($plugin_id); $base_plugin_definition = $this->decorated->getDefinition($base_plugin_id, $exception_on_invalid); if ($base_plugin_definition) { $deriver = $this->getDeriver($base_plugin_id, $base_plugin_definition); diff --git a/core/lib/Drupal/Component/Plugin/PluginBase.php b/core/lib/Drupal/Component/Plugin/PluginBase.php index 7bdc4a5fde35..67691784b3ca 100644 --- a/core/lib/Drupal/Component/Plugin/PluginBase.php +++ b/core/lib/Drupal/Component/Plugin/PluginBase.php @@ -69,7 +69,7 @@ public function getPluginId() { public function getBaseId() { $plugin_id = $this->getPluginId(); if (strpos($plugin_id, static::DERIVATIVE_SEPARATOR)) { - list($plugin_id) = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2); + [$plugin_id] = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2); } return $plugin_id; } @@ -81,7 +81,7 @@ public function getDerivativeId() { $plugin_id = $this->getPluginId(); $derivative_id = NULL; if (strpos($plugin_id, static::DERIVATIVE_SEPARATOR)) { - list(, $derivative_id) = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2); + [, $derivative_id] = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2); } return $derivative_id; } diff --git a/core/lib/Drupal/Component/Utility/UrlHelper.php b/core/lib/Drupal/Component/Utility/UrlHelper.php index 137b4118ce03..b23a21351847 100644 --- a/core/lib/Drupal/Component/Utility/UrlHelper.php +++ b/core/lib/Drupal/Component/Utility/UrlHelper.php @@ -147,14 +147,14 @@ public static function parse($url) { if ($scheme_delimiter_position !== FALSE && ($query_delimiter_position === FALSE || $scheme_delimiter_position < $query_delimiter_position)) { // Split off the fragment, if any. if (strpos($url, '#') !== FALSE) { - list($url, $options['fragment']) = explode('#', $url, 2); + [$url, $options['fragment']] = explode('#', $url, 2); } // Split off everything before the query string into 'path'. $parts = explode('?', $url, 2); // Don't support URLs without a path, like 'http://'. - list(, $path) = explode('://', $parts[0], 2); + [, $path] = explode('://', $parts[0], 2); if ($path != '') { $options['path'] = $parts[0]; } diff --git a/core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php b/core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php index 55a3b4374c0a..600a6dbd7163 100644 --- a/core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php +++ b/core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php @@ -142,7 +142,7 @@ protected function buildAttachmentsCommands(AjaxResponse $response, Request $req ->setAlreadyLoadedLibraries(isset($ajax_page_state['libraries']) ? explode(',', $ajax_page_state['libraries']) : []) ->setSettings($attachments['drupalSettings'] ?? []); $css_assets = $this->assetResolver->getCssAssets($assets, $optimize_css); - list($js_assets_header, $js_assets_footer) = $this->assetResolver->getJsAssets($assets, $optimize_js); + [$js_assets_header, $js_assets_footer] = $this->assetResolver->getJsAssets($assets, $optimize_js); // First, AttachedAssets::setLibraries() ensures duplicate libraries are // removed: it converts it to a set of libraries if necessary. Second, diff --git a/core/lib/Drupal/Core/Asset/AssetResolver.php b/core/lib/Drupal/Core/Asset/AssetResolver.php index c52ee7ffad55..35d28bbe8ce9 100644 --- a/core/lib/Drupal/Core/Asset/AssetResolver.php +++ b/core/lib/Drupal/Core/Asset/AssetResolver.php @@ -130,7 +130,7 @@ public function getCssAssets(AttachedAssetsInterface $assets, $optimize) { ]; foreach ($libraries_to_load as $library) { - list($extension, $name) = explode('/', $library, 2); + [$extension, $name] = explode('/', $library, 2); $definition = $this->libraryDiscovery->getLibraryByName($extension, $name); if (isset($definition['css'])) { foreach ($definition['css'] as $options) { @@ -196,7 +196,7 @@ protected function getJsSettingsAssets(AttachedAssetsInterface $assets) { $settings = []; foreach ($this->getLibrariesToLoad($assets) as $library) { - list($extension, $name) = explode('/', $library, 2); + [$extension, $name] = explode('/', $library, 2); $definition = $this->libraryDiscovery->getLibraryByName($extension, $name); if (isset($definition['drupalSettings'])) { $settings = NestedArray::mergeDeepArray([$settings, $definition['drupalSettings']], TRUE); @@ -218,7 +218,7 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize) { $cid = 'js:' . $theme_info->getName() . ':' . $this->languageManager->getCurrentLanguage()->getId() . ':' . Crypt::hashBase64(serialize($libraries_to_load)) . (int) (count($assets->getSettings()) > 0) . (int) $optimize; if ($cached = $this->cache->get($cid)) { - list($js_assets_header, $js_assets_footer, $settings, $settings_in_header) = $cached->data; + [$js_assets_header, $js_assets_footer, $settings, $settings_in_header] = $cached->data; } else { $javascript = []; @@ -236,7 +236,7 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize) { // Collect all libraries that contain JS assets and are in the header. $header_js_libraries = []; foreach ($libraries_to_load as $library) { - list($extension, $name) = explode('/', $library, 2); + [$extension, $name] = explode('/', $library, 2); $definition = $this->libraryDiscovery->getLibraryByName($extension, $name); if (isset($definition['js']) && !empty($definition['header'])) { $header_js_libraries[] = $library; @@ -248,7 +248,7 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize) { $header_js_libraries = $this->libraryDependencyResolver->getLibrariesWithDependencies($header_js_libraries); foreach ($libraries_to_load as $library) { - list($extension, $name) = explode('/', $library, 2); + [$extension, $name] = explode('/', $library, 2); $definition = $this->libraryDiscovery->getLibraryByName($extension, $name); if (isset($definition['js'])) { foreach ($definition['js'] as $options) { diff --git a/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php b/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php index 6b94e3178e9a..4c31c1b124ba 100644 --- a/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php +++ b/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php @@ -64,7 +64,7 @@ public function getLibrariesWithDependencies(array $libraries) { protected function doGetDependencies(array $libraries_with_unresolved_dependencies, array $final_libraries = []) { foreach ($libraries_with_unresolved_dependencies as $library) { if (!isset($final_libraries[$library])) { - list($extension, $name) = explode('/', $library, 2); + [$extension, $name] = explode('/', $library, 2); $definition = $this->libraryDiscovery->getLibraryByName($extension, $name); if (!empty($definition['dependencies'])) { $final_libraries = $this->doGetDependencies($definition['dependencies'], $final_libraries); diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php index d72c58477390..3634892de9ed 100644 --- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php @@ -96,7 +96,7 @@ protected function getLibraryDefinitions($extension) { else { // Otherwise replace with existing library definition if it exists. // Throw an exception if it doesn't. - list($replacement_extension, $replacement_name) = explode('/', $definition['override']); + [$replacement_extension, $replacement_name] = explode('/', $definition['override']); $replacement_definition = $this->get($replacement_extension); if (isset($replacement_definition[$replacement_name])) { $libraries[$name] = $replacement_definition[$replacement_name]; @@ -145,7 +145,7 @@ protected function applyLibrariesExtend($extension, $library_name, $library_defi // Only string library names are allowed. throw new InvalidLibrariesExtendSpecificationException('The libraries-extend specification for each library must be a list of strings.'); } - list($new_extension, $new_library_name) = explode('/', $library_extend_name, 2); + [$new_extension, $new_library_name] = explode('/', $library_extend_name, 2); $new_libraries = $this->get($new_extension); if (isset($new_libraries[$new_library_name])) { $library_definition = NestedArray::mergeDeep($library_definition, $new_libraries[$new_library_name]); diff --git a/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php b/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php index 377ba7bd5a68..cd88b24bf729 100644 --- a/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php +++ b/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php @@ -106,7 +106,7 @@ public function convertTokensToKeys(array $context_tokens) { // Iterate over cache contexts that have been optimized away and get their // cacheability metadata. foreach (static::parseTokens(array_diff($context_tokens, $optimized_tokens)) as $context_token) { - list($context_id, $parameter) = $context_token; + [$context_id, $parameter] = $context_token; $context = $this->getService($context_id); $cacheable_metadata = $cacheable_metadata->merge($context->getCacheableMetadata($parameter)); } @@ -114,7 +114,7 @@ public function convertTokensToKeys(array $context_tokens) { sort($optimized_tokens); $keys = []; foreach (array_combine($optimized_tokens, static::parseTokens($optimized_tokens)) as $context_token => $context) { - list($context_id, $parameter) = $context; + [$context_id, $parameter] = $context; $keys[] = '[' . $context_token . ']=' . $this->getService($context_id)->getContext($parameter); } @@ -164,7 +164,7 @@ public function optimizeTokens(array $context_tokens) { $parameter = NULL; $context_id = $context_token; if (strpos($context_token, ':') !== FALSE) { - list($context_id, $parameter) = explode(':', $context_token); + [$context_id, $parameter] = explode(':', $context_token); } // Context tokens without: @@ -236,7 +236,7 @@ public static function parseTokens(array $context_tokens) { $context_id = $context; $parameter = NULL; if (strpos($context, ':') !== FALSE) { - list($context_id, $parameter) = explode(':', $context, 2); + [$context_id, $parameter] = explode(':', $context, 2); } $contexts_with_parameters[] = [$context_id, $parameter]; } diff --git a/core/lib/Drupal/Core/Command/DbDumpCommand.php b/core/lib/Drupal/Core/Command/DbDumpCommand.php index bb345e4d2659..a36366cc2eb9 100644 --- a/core/lib/Drupal/Core/Command/DbDumpCommand.php +++ b/core/lib/Drupal/Core/Command/DbDumpCommand.php @@ -279,7 +279,7 @@ protected function getTableCollation(Connection $connection, $table, &$definitio // Map the collation to a character set. For example, 'utf8mb4_general_ci' // (MySQL 5) or 'utf8mb4_0900_ai_ci' (MySQL 8) will be mapped to 'utf8mb4'. - list($charset,) = explode('_', $data['Collation'], 2); + [$charset] = explode('_', $data['Collation'], 2); // Set `mysql_character_set`. This will be ignored by other backends. $definition['mysql_character_set'] = $charset; diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 16472b65ed10..107ca8a0716e 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -525,7 +525,7 @@ public function checkConfigurationToInstall($type, $name) { $profile_storages = $this->getProfileStorages($name); // Check the dependencies of configuration provided by the module. - list($invalid_default_config, $missing_dependencies) = $this->findDefaultConfigWithUnmetDependencies($storage, $enabled_extensions, $profile_storages); + [$invalid_default_config, $missing_dependencies] = $this->findDefaultConfigWithUnmetDependencies($storage, $enabled_extensions, $profile_storages); if (!empty($invalid_default_config)) { throw UnmetDependenciesException::create($name, array_unique($missing_dependencies, SORT_REGULAR)); } @@ -593,7 +593,7 @@ protected function findDefaultConfigWithUnmetDependencies(StorageInterface $stor protected function validateDependencies($config_name, array $data, array $enabled_extensions, array $all_config) { if (!isset($data['dependencies'])) { // Simple config or a config entity without dependencies. - list($provider) = explode('.', $config_name, 2); + [$provider] = explode('.', $config_name, 2); return in_array($provider, $enabled_extensions, TRUE); } @@ -619,7 +619,7 @@ protected function validateDependencies($config_name, array $data, array $enable protected function getMissingDependencies($config_name, array $data, array $enabled_extensions, array $all_config) { $missing = []; if (isset($data['dependencies'])) { - list($provider) = explode('.', $config_name, 2); + [$provider] = explode('.', $config_name, 2); $all_dependencies = $data['dependencies']; // Ensure enforced dependencies are included. diff --git a/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php index 1aca27fa55f0..db67c29959ba 100644 --- a/core/lib/Drupal/Core/Config/ConfigManager.php +++ b/core/lib/Drupal/Core/Config/ConfigManager.php @@ -466,7 +466,7 @@ protected function callOnDependencyRemoval(ConfigEntityInterface $entity, array } else { // Ignore the bundle. - list($entity_type_id,, $uuid) = explode(':', $name); + [$entity_type_id,, $uuid] = explode(':', $name); return $this->entityRepository->loadEntityByConfigTarget($entity_type_id, $uuid); } }, $affected_dependencies[$type]); @@ -513,7 +513,7 @@ public function findMissingContentDependencies() { } foreach (array_unique($content_dependencies) as $content_dependency) { // Format of the dependency is entity_type:bundle:uuid. - list($entity_type, $bundle, $uuid) = explode(':', $content_dependency, 3); + [$entity_type, $bundle, $uuid] = explode(':', $content_dependency, 3); if (!$this->entityRepository->loadEntityByUuid($entity_type, $uuid)) { $missing_dependencies[$uuid] = [ 'entity_type' => $entity_type, diff --git a/core/lib/Drupal/Core/Controller/ControllerResolver.php b/core/lib/Drupal/Core/Controller/ControllerResolver.php index 36312c1a1211..ec64c1d89b03 100644 --- a/core/lib/Drupal/Core/Controller/ControllerResolver.php +++ b/core/lib/Drupal/Core/Controller/ControllerResolver.php @@ -104,11 +104,11 @@ protected function createController($controller) { // Controller in the service:method notation. $count = substr_count($controller, ':'); if ($count == 1) { - list($class_or_service, $method) = explode(':', $controller, 2); + [$class_or_service, $method] = explode(':', $controller, 2); } // Controller in the class::method notation. elseif (strpos($controller, '::') !== FALSE) { - list($class_or_service, $method) = explode('::', $controller, 2); + [$class_or_service, $method] = explode('::', $controller, 2); } else { throw new \LogicException(sprintf('Unable to parse the controller name "%s".', $controller)); diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php index afb7f604fbde..59795d39210c 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php @@ -566,7 +566,7 @@ public function renameTable($table, $new_name) { // Get the schema and tablename for the old table. $old_full_name = str_replace('"', '', $this->connection->prefixTables('{' . $table . '}')); - list($old_schema, $old_table_name) = strpos($old_full_name, '.') ? explode('.', $old_full_name) : ['public', $old_full_name]; + [$old_schema, $old_table_name] = strpos($old_full_name, '.') ? explode('.', $old_full_name) : ['public', $old_full_name]; // Index names and constraint names are global in PostgreSQL, so we need to // rename them when renaming the table. diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Select.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Select.php index b5d22d42c9ea..2a9bc4a58726 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Select.php +++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Select.php @@ -63,7 +63,7 @@ public function orderBy($field, $direction = 'ASC') { // If there is a table alias specified, split it up. if (strpos($field, '.') !== FALSE) { - list($table, $table_field) = explode('.', $field); + [$table, $table_field] = explode('.', $field); } // Figure out if the field has already been added. foreach ($this->fields as $existing_field) { diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php index 2949e0619d5a..1895522e810a 100644 --- a/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php +++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php @@ -500,7 +500,7 @@ protected function introspectSchema($table) { $length = NULL; } if (isset($mapped_fields[$type])) { - list($type, $size) = explode(':', $mapped_fields[$type]); + [$type, $size] = explode(':', $mapped_fields[$type]); $schema['fields'][$row->name] = [ 'type' => $type, 'size' => $size, diff --git a/core/lib/Drupal/Core/Datetime/Element/DateElementBase.php b/core/lib/Drupal/Core/Datetime/Element/DateElementBase.php index 433cdf8b1810..24f553a41fe3 100644 --- a/core/lib/Drupal/Core/Datetime/Element/DateElementBase.php +++ b/core/lib/Drupal/Core/Datetime/Element/DateElementBase.php @@ -33,7 +33,7 @@ abstract class DateElementBase extends FormElement { protected static function datetimeRangeYears($string, $date = NULL) { $datetime = new DrupalDateTime(); $this_year = $datetime->format('Y'); - list($min_year, $max_year) = explode(':', $string); + [$min_year, $max_year] = explode(':', $string); // Valid patterns would be -5:+5, 0:+1, 2008:2010. $plus_pattern = '@[\+|\-][0-9]{1,4}@'; diff --git a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php index cab99558f0aa..215babce46ff 100644 --- a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php +++ b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php @@ -119,7 +119,7 @@ private function parseDefinitions($content, $file) } else { $basename = basename($file); - list($provider, ) = explode('.', $basename, 2); + [$provider, ] = explode('.', $basename, 2); } foreach ($content['services'] as $id => $service) { if (is_array($service)) { diff --git a/core/lib/Drupal/Core/Entity/Enhancer/EntityRouteEnhancer.php b/core/lib/Drupal/Core/Entity/Enhancer/EntityRouteEnhancer.php index aa0b41a2fa9e..e895273d8893 100644 --- a/core/lib/Drupal/Core/Entity/Enhancer/EntityRouteEnhancer.php +++ b/core/lib/Drupal/Core/Entity/Enhancer/EntityRouteEnhancer.php @@ -105,7 +105,7 @@ protected function enhanceEntityView(array $defaults, Request $request) { $defaults['_controller'] = '\Drupal\Core\Entity\Controller\EntityViewController::view'; if (strpos($defaults['_entity_view'], '.') !== FALSE) { // The _entity_view entry is of the form entity_type.view_mode. - list($entity_type, $view_mode) = explode('.', $defaults['_entity_view']); + [$entity_type, $view_mode] = explode('.', $defaults['_entity_view']); $defaults['view_mode'] = $view_mode; } else { diff --git a/core/lib/Drupal/Core/Entity/EntityAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityAccessCheck.php index 8ca8cf66cded..9d44998f2f47 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessCheck.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessCheck.php @@ -56,7 +56,7 @@ class EntityAccessCheck implements AccessInterface { public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) { // Split the entity type and the operation. $requirement = $route->getRequirement('_entity_access'); - list($entity_type, $operation) = explode('.', $requirement); + [$entity_type, $operation] = explode('.', $requirement); // If $entity_type parameter is a valid entity, call its own access check. $parameters = $route_match->getParameters(); if ($parameters->has($entity_type)) { diff --git a/core/lib/Drupal/Core/Entity/EntityBundleAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityBundleAccessCheck.php index 8f1928567798..f43f7bb80620 100644 --- a/core/lib/Drupal/Core/Entity/EntityBundleAccessCheck.php +++ b/core/lib/Drupal/Core/Entity/EntityBundleAccessCheck.php @@ -42,7 +42,7 @@ class EntityBundleAccessCheck implements AccessInterface { public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) { @trigger_error('The ' . __NAMESPACE__ . '\EntityBundleAccessCheck is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Specify the list of bundles in the entity parameter, under "bundle" key, as a sequence, instead. See https://www.drupal.org/node/3155569', E_USER_DEPRECATED); if ($route->hasRequirement('_entity_bundles')) { - list($entity_type, $bundle_definition) = explode(':', $route->getRequirement('_entity_bundles')); + [$entity_type, $bundle_definition] = explode(':', $route->getRequirement('_entity_bundles')); $bundles = explode('|', $bundle_definition); $parameters = $route_match->getParameters(); if ($parameters->has($entity_type)) { diff --git a/core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php b/core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php index 6081a8de1683..aaa26ecfc708 100644 --- a/core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php +++ b/core/lib/Drupal/Core/Entity/EntityConstraintViolationList.php @@ -64,7 +64,7 @@ protected function groupViolationOffsets() { foreach ($this as $offset => $violation) { if ($path = $violation->getPropertyPath()) { // An example of $path might be 'title.0.value'. - list($field_name) = explode('.', $path, 2); + [$field_name] = explode('.', $path, 2); if ($this->entity->hasField($field_name)) { $this->violationOffsetsByField[$field_name][$offset] = $offset; } diff --git a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php index 233285e09042..25566ba4bf64 100644 --- a/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php +++ b/core/lib/Drupal/Core/Entity/EntityCreateAccessCheck.php @@ -51,7 +51,7 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager) { * The access result. */ public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) { - list($entity_type, $bundle) = explode(':', $route->getRequirement($this->requirementsKey) . ':'); + [$entity_type, $bundle] = explode(':', $route->getRequirement($this->requirementsKey) . ':'); // The bundle argument can contain request argument placeholders like // {name}, loop over the raw variables and attempt to replace them in the diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayRepository.php b/core/lib/Drupal/Core/Entity/EntityDisplayRepository.php index 972a883840a9..571c978753ae 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayRepository.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayRepository.php @@ -112,7 +112,7 @@ protected function getAllDisplayModesByEntityType($display_type) { else { $this->displayModeInfo[$display_type] = []; foreach ($this->entityTypeManager->getStorage($entity_type_id)->loadMultiple() as $display_mode) { - list($display_mode_entity_type, $display_mode_name) = explode('.', $display_mode->id(), 2); + [$display_mode_entity_type, $display_mode_name] = explode('.', $display_mode->id(), 2); $this->displayModeInfo[$display_type][$display_mode_entity_type][$display_mode_name] = $display_mode->toArray(); } $this->moduleHandler->alter($key, $this->displayModeInfo[$display_type]); diff --git a/core/lib/Drupal/Core/Entity/EntityResolverManager.php b/core/lib/Drupal/Core/Entity/EntityResolverManager.php index 25cb70c33505..23fcebdf80e0 100644 --- a/core/lib/Drupal/Core/Entity/EntityResolverManager.php +++ b/core/lib/Drupal/Core/Entity/EntityResolverManager.php @@ -95,7 +95,7 @@ protected function getControllerClass(array $defaults) { // service. This is dangerous as the controller could depend on services // that could not exist at this point. There is however no other way to // do it, as the container does not allow static introspection. - list($class_or_service, $method) = explode(':', $controller, 2); + [$class_or_service, $method] = explode(':', $controller, 2); return [$this->classResolver->getInstanceFromDefinition($class_or_service), $method]; } elseif (strpos($controller, '::') !== FALSE) { @@ -124,7 +124,7 @@ protected function setParametersFromReflection($controller, Route $route) { $result = FALSE; if (is_array($controller)) { - list($instance, $method) = $controller; + [$instance, $method] = $controller; $reflection = new \ReflectionMethod($instance, $method); } else { @@ -166,10 +166,10 @@ protected function setParametersFromReflection($controller, Route $route) { */ protected function setParametersFromEntityInformation(Route $route) { if ($entity_view = $route->getDefault('_entity_view')) { - list($entity_type) = explode('.', $entity_view, 2); + [$entity_type] = explode('.', $entity_view, 2); } elseif ($entity_form = $route->getDefault('_entity_form')) { - list($entity_type) = explode('.', $entity_form, 2); + [$entity_type] = explode('.', $entity_form, 2); } // Do not add parameter information if the route does not declare a @@ -183,7 +183,7 @@ protected function setParametersFromEntityInformation(Route $route) { foreach ($parameter_definitions as $info) { if (isset($info['type']) && (strpos($info['type'], 'entity:') === 0)) { // The parameter types are in the form 'entity:$entity_type'. - list(, $parameter_entity_type) = explode(':', $info['type'], 2); + [, $parameter_entity_type] = explode(':', $info['type'], 2); if ($parameter_entity_type == $entity_type) { return; } diff --git a/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php b/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php index f431bc17c0a5..fd4db8439e60 100644 --- a/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php +++ b/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php @@ -64,7 +64,7 @@ protected function getFormArgument(RouteMatchInterface $route_match) { protected function getFormObject(RouteMatchInterface $route_match, $form_arg) { // If no operation is provided, use 'default'. $form_arg .= '.default'; - list ($entity_type_id, $operation) = explode('.', $form_arg); + [$entity_type_id, $operation] = explode('.', $form_arg); $form_object = $this->entityTypeManager->getFormObject($entity_type_id, $operation); diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php b/core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php index 2e2d7a01c1a2..03e00ef45102 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/QueryAggregate.php @@ -104,7 +104,7 @@ protected function addGroupBy() { $field = $group_by['field']; $sql_field = $this->getSqlField($field, $group_by['langcode']); $this->sqlGroupBy[$sql_field] = $sql_field; - list($table, $real_sql_field) = explode('.', $sql_field); + [$table, $real_sql_field] = explode('.', $sql_field); $this->sqlFields[$sql_field] = [$table, $real_sql_field, $this->createSqlAlias($field, $real_sql_field)]; } diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php index 5eb10f86a2bb..43b7be38a3ad 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php @@ -284,7 +284,7 @@ public function addField($field, $type, $langcode) { // Relationship specifier can also contain the entity type ID, i.e. // entity:node, entity:user or entity:taxonomy. if (strpos($relationship_specifier, ':') !== FALSE) { - list($relationship_specifier, $entity_type_id) = explode(':', $relationship_specifier, 2); + [$relationship_specifier, $entity_type_id] = explode(':', $relationship_specifier, 2); } // Check for a valid relationship. if (isset($propertyDefinitions[$relationship_specifier]) && $propertyDefinitions[$relationship_specifier] instanceof DataReferenceDefinitionInterface) { diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index 9f53bd7c6726..1390593498af 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -1144,7 +1144,7 @@ protected function getFieldSchemaData($field_name, array $field_schema, array $c // Allow for indexes and unique keys to specified as an array of column // name and length. if (is_array($column)) { - list($column_name, $length) = $column; + [$column_name, $length] = $column; $data[$real_key][] = [$column_mapping[$column_name], $length]; } else { diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php index 906dab45deb9..99b933754d0f 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php @@ -227,7 +227,7 @@ protected function validateDependencies(ConfigImporter $config_importer) { foreach ($config_importer->getStorageComparer()->getSourceStorage()->listAll() as $name) { // Ensure that the config owner is installed. This checks all // configuration including configuration entities. - list($owner,) = explode('.', $name, 2); + [$owner] = explode('.', $name, 2); if ($owner !== 'core') { $message = FALSE; if (!isset($core_extension['module'][$owner]) && isset($module_data[$owner])) { diff --git a/core/lib/Drupal/Core/EventSubscriber/ResponseGeneratorSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ResponseGeneratorSubscriber.php index bf45269588ab..2b5c1461a99b 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ResponseGeneratorSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ResponseGeneratorSubscriber.php @@ -25,7 +25,7 @@ public function onRespond(ResponseEvent $event) { $response = $event->getResponse(); // Set the generator in the HTTP header. - list($version) = explode('.', \Drupal::VERSION, 2); + [$version] = explode('.', \Drupal::VERSION, 2); $response->headers->set('X-Generator', 'Drupal ' . $version . ' (https://www.drupal.org)'); } diff --git a/core/lib/Drupal/Core/Extension/Dependency.php b/core/lib/Drupal/Core/Extension/Dependency.php index da36f612a8e9..42caa67df35d 100644 --- a/core/lib/Drupal/Core/Extension/Dependency.php +++ b/core/lib/Drupal/Core/Extension/Dependency.php @@ -124,7 +124,7 @@ public function isCompatible($version) { */ public static function createFromString($dependency) { if (strpos($dependency, ':') !== FALSE) { - list($project, $dependency) = explode(':', $dependency); + [$project, $dependency] = explode(':', $dependency); } else { $project = ''; diff --git a/core/lib/Drupal/Core/Layout/LayoutPluginManager.php b/core/lib/Drupal/Core/Layout/LayoutPluginManager.php index 12d740350918..4d211aaefdba 100644 --- a/core/lib/Drupal/Core/Layout/LayoutPluginManager.php +++ b/core/lib/Drupal/Core/Layout/LayoutPluginManager.php @@ -117,7 +117,7 @@ public function processDefinition(&$definition, $plugin_id) { // Add a dependency on the provider of the library. if ($library = $definition->getLibrary()) { $config_dependencies = $definition->getConfigDependencies(); - list($library_provider) = explode('/', $library, 2); + [$library_provider] = explode('/', $library, 2); if ($this->moduleHandler->moduleExists($library_provider)) { $config_dependencies['module'][] = $library_provider; } diff --git a/core/lib/Drupal/Core/Mail/MailFormatHelper.php b/core/lib/Drupal/Core/Mail/MailFormatHelper.php index 12b956ceac2f..42468cbbf8b3 100644 --- a/core/lib/Drupal/Core/Mail/MailFormatHelper.php +++ b/core/lib/Drupal/Core/Mail/MailFormatHelper.php @@ -153,7 +153,7 @@ public static function htmlToText($string, $allowed_tags = NULL) { // Process HTML tags (but don't output any literally). if ($tag) { - list($tagname) = explode(' ', strtolower($value), 2); + [$tagname] = explode(' ', strtolower($value), 2); switch ($tagname) { // List counters. case 'ul': @@ -334,7 +334,7 @@ protected static function htmlToMailUrls($match = NULL, $reset = FALSE) { static::$regexp = '@^' . preg_quote($base_path, '@') . '@'; } if ($match) { - list(, , $url, $label) = $match; + [, , $url, $label] = $match; // Ensure all URLs are absolute. static::$urls[] = strpos($url, '://') ? $url : preg_replace(static::$regexp, $base_url . '/', $url); return $label . ' [' . count(static::$urls) . ']'; diff --git a/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php index 98969910bd7d..36b91f6b3c20 100644 --- a/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php +++ b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php @@ -158,7 +158,7 @@ public function extractFormValues(array &$form, FormStateInterface $form_state) $new_definition['enabled'] = $form_state->getValue('enabled') ? 1 : 0; $new_definition['weight'] = (int) $form_state->getValue('weight'); $new_definition['expanded'] = $form_state->getValue('expanded') ? 1 : 0; - list($menu_name, $parent) = explode(':', $form_state->getValue('menu_parent'), 2); + [$menu_name, $parent] = explode(':', $form_state->getValue('menu_parent'), 2); if (!empty($menu_name)) { $new_definition['menu_name'] = $menu_name; } diff --git a/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php b/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php index dce990323615..ecae57c7cd36 100644 --- a/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php +++ b/core/lib/Drupal/Core/Menu/MenuParentFormSelector.php @@ -88,7 +88,7 @@ public function parentSelectElement($menu_parent, $id = '', array $menus = NULL) if (!isset($options[$menu_parent])) { // The requested menu parent cannot be found in the menu anymore. Try // setting it to the top level in the current menu. - list($menu_name, $parent) = explode(':', $menu_parent, 2); + [$menu_name, $parent] = explode(':', $menu_parent, 2); $menu_parent = $menu_name . ':'; } if (isset($options[$menu_parent])) { diff --git a/core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php b/core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php index d805354af624..68c7d6ffaa9e 100644 --- a/core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php +++ b/core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php @@ -63,7 +63,7 @@ public function getRuntimeContexts(array $context_ids) { // @todo Convert to an assert once https://www.drupal.org/node/2408013 is // in. if ($id[0] === '@' && strpos($id, ':') !== FALSE) { - list($service_id, $unqualified_context_id) = explode(':', $id, 2); + [$service_id, $unqualified_context_id] = explode(':', $id, 2); // Remove the leading '@'. $service_id = substr($service_id, 1); } diff --git a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php index 950eb68ae685..7df92bdb6db6 100644 --- a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php +++ b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php @@ -316,7 +316,7 @@ protected function processAssetLibraries(AttachedAssetsInterface $assets, array if (isset($placeholders['scripts']) || isset($placeholders['scripts_bottom'])) { // Optimize JS if necessary, but only during normal site operation. $optimize_js = !defined('MAINTENANCE_MODE') && !\Drupal::state()->get('system.maintenance_mode') && $this->config->get('js.preprocess'); - list($js_assets_header, $js_assets_footer) = $this->assetResolver->getJsAssets($assets, $optimize_js); + [$js_assets_header, $js_assets_footer] = $this->assetResolver->getJsAssets($assets, $optimize_js); $variables['scripts'] = $this->jsCollectionRenderer->render($js_assets_header); $variables['scripts_bottom'] = $this->jsCollectionRenderer->render($js_assets_footer); } @@ -393,7 +393,7 @@ protected function setHeaders(HtmlResponse $response, array $headers) { protected function processHtmlHead(array $html_head) { $head = []; foreach ($html_head as $item) { - list($data, $key) = $item; + [$data, $key] = $item; if (!isset($data['#type'])) { $data['#type'] = 'html_tag'; } diff --git a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php index fe1890f57ddd..09d946d22f6d 100644 --- a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php @@ -129,7 +129,7 @@ public function __construct(TitleResolverInterface $title_resolver, PluginManage * The entire HTML: takes a #type 'page' and wraps it in a #type 'html'. */ public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match) { - list($page, $title) = $this->prepare($main_content, $request, $route_match); + [$page, $title] = $this->prepare($main_content, $request, $route_match); if (!isset($page['#type']) || $page['#type'] !== 'page') { throw new \LogicException('Must be #type page'); diff --git a/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php b/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php index 5b37ea9bd44e..31900041ca44 100644 --- a/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php +++ b/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php @@ -53,10 +53,10 @@ public function doTrustedCallback(callable $callback, array $args, $message, $er $safe_callback = FALSE; if (is_array($callback)) { - list($object_or_classname, $method_name) = $callback; + [$object_or_classname, $method_name] = $callback; } elseif (is_string($callback) && strpos($callback, '::') !== FALSE) { - list($object_or_classname, $method_name) = explode('::', $callback, 2); + [$object_or_classname, $method_name] = explode('::', $callback, 2); } if (isset($method_name)) { diff --git a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php index 5778e6f98989..b4430966847d 100644 --- a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php +++ b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php @@ -87,7 +87,7 @@ protected function getTarget($uri = NULL) { $uri = $this->uri; } - list(, $target) = explode('://', $uri, 2); + [, $target] = explode('://', $uri, 2); // Remove erroneous leading or trailing, forward-slashes and backslashes. return trim($target, '\/'); @@ -315,7 +315,7 @@ public function rename($from_uri, $to_uri) { * {@inheritdoc} */ public function dirname($uri = NULL) { - list($scheme) = explode('://', $uri, 2); + [$scheme] = explode('://', $uri, 2); $target = $this->getTarget($uri); $dirname = dirname($target); diff --git a/core/lib/Drupal/Core/Template/TwigNodeTrans.php b/core/lib/Drupal/Core/Template/TwigNodeTrans.php index e581fa9c2bbc..135593793597 100644 --- a/core/lib/Drupal/Core/Template/TwigNodeTrans.php +++ b/core/lib/Drupal/Core/Template/TwigNodeTrans.php @@ -50,11 +50,11 @@ public function __construct(Node $body, Node $plural = NULL, AbstractExpression public function compile(Compiler $compiler) { $compiler->addDebugInfo($this); - list($singular, $tokens) = $this->compileString($this->getNode('body')); + [$singular, $tokens] = $this->compileString($this->getNode('body')); $plural = NULL; if ($this->hasNode('plural')) { - list($plural, $pluralTokens) = $this->compileString($this->getNode('plural')); + [$plural, $pluralTokens] = $this->compileString($this->getNode('plural')); $tokens = array_merge($tokens, $pluralTokens); } diff --git a/core/lib/Drupal/Core/Test/TestDiscovery.php b/core/lib/Drupal/Core/Test/TestDiscovery.php index cdcc1eeda7f8..1b12a47c7c65 100644 --- a/core/lib/Drupal/Core/Test/TestDiscovery.php +++ b/core/lib/Drupal/Core/Test/TestDiscovery.php @@ -439,7 +439,7 @@ public static function parseTestClassAnnotations(\ReflectionClass $class) { // @see https://www.drupal.org/node/1273478 if (isset($annotations['requires'])) { foreach ($annotations['requires'] as $i => $value) { - list($type, $value) = explode(' ', $value, 2); + [$type, $value] = explode(' ', $value, 2); if ($type === 'module') { $annotations['requires']['module'][$value] = $value; unset($annotations['requires'][$i]); diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index 2a4e8d95f131..98d596a7804e 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -724,7 +724,7 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) { // have matching hooks in the registry. foreach ($prefixes as $prefix) { // Grep only the functions which are within the prefix group. - list($first_prefix,) = explode('_', $prefix, 2); + [$first_prefix] = explode('_', $prefix, 2); if (!isset($grouped_functions[$first_prefix])) { continue; } @@ -836,7 +836,7 @@ public function getPrefixGroupedUserFunctions($prefixes = []) { $grouped_functions = []; // Splitting user defined functions into groups by the first prefix. foreach ($theme_functions as $function) { - list($first_prefix,) = explode('_', $function, 2); + [$first_prefix] = explode('_', $function, 2); $grouped_functions[$first_prefix][] = $function; } diff --git a/core/lib/Drupal/Core/Update/UpdateRegistry.php b/core/lib/Drupal/Core/Update/UpdateRegistry.php index 8b3f03ea24ef..5d55e89466a3 100644 --- a/core/lib/Drupal/Core/Update/UpdateRegistry.php +++ b/core/lib/Drupal/Core/Update/UpdateRegistry.php @@ -205,7 +205,7 @@ public function getPendingUpdateInformation() { $ret = []; foreach ($functions as $function) { - list($module, $update) = explode("_{$this->updateType}_", $function); + [$module, $update] = explode("_{$this->updateType}_", $function); // The description for an update comes from its Doxygen. $func = new \ReflectionFunction($function); $description = trim(str_replace(["\n", '*', '/'], '', $func->getDocComment()), ' '); @@ -247,7 +247,7 @@ public function getModuleUpdateFunctions($module_name) { $all_functions = $this->getAvailableUpdateFunctions(); return array_filter($all_functions, function ($function_name) use ($module_name) { - list($function_module_name,) = explode("_{$this->updateType}_", $function_name); + [$function_module_name] = explode("_{$this->updateType}_", $function_name); return $function_module_name === $module_name; }); } diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 776a8f778ad8..226ab436e022 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -349,7 +349,7 @@ public static function fromUri($uri, $options = []) { * Thrown if the entity URI is invalid. */ protected static function fromEntityUri(array $uri_parts, array $options, $uri) { - list($entity_type_id, $entity_id) = explode('/', $uri_parts['path'], 2); + [$entity_type_id, $entity_id] = explode('/', $uri_parts['path'], 2); if ($uri_parts['scheme'] != 'entity' || $entity_id === '') { throw new \InvalidArgumentException("The entity URI '$uri' is invalid. You must specify the entity id in the URL. e.g., entity:node/1 for loading the canonical path to node entity with id 1."); } diff --git a/core/modules/big_pipe/src/Render/BigPipe.php b/core/modules/big_pipe/src/Render/BigPipe.php index 53e4424984c0..133c86534eb5 100644 --- a/core/modules/big_pipe/src/Render/BigPipe.php +++ b/core/modules/big_pipe/src/Render/BigPipe.php @@ -330,7 +330,7 @@ protected function sendPreBody($pre_body, array $no_js_placeholders, AttachedAss // Extract the scripts_bottom markup: the no-JS BigPipe placeholders that we // will render may attach additional asset libraries, and if so, it will be // necessary to re-render scripts_bottom. - list($pre_scripts_bottom, $scripts_bottom, $post_scripts_bottom) = explode('<drupal-big-pipe-scripts-bottom-marker>', $pre_body, 3); + [$pre_scripts_bottom, $scripts_bottom, $post_scripts_bottom] = explode('<drupal-big-pipe-scripts-bottom-marker>', $pre_body, 3); $cumulative_assets_initial = clone $cumulative_assets; $this->sendNoJsPlaceholders($pre_scripts_bottom . $post_scripts_bottom, $no_js_placeholders, $cumulative_assets); diff --git a/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php b/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php index bfe4612b8b15..1e471a2cf72b 100644 --- a/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php +++ b/core/modules/block/src/Plugin/migrate/process/BlockPluginId.php @@ -73,10 +73,10 @@ public static function create(ContainerInterface $container, array $configuratio */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (is_array($value)) { - list($module, $delta) = $value; + [$module, $delta] = $value; switch ($module) { case 'aggregator': - list($type, $id) = explode('-', $delta); + [$type, $id] = explode('-', $delta); if ($type == 'feed') { return 'aggregator_feed_block'; } diff --git a/core/modules/block/src/Plugin/migrate/process/BlockRegion.php b/core/modules/block/src/Plugin/migrate/process/BlockRegion.php index 0eb984fd20c6..cd79f051bcbe 100644 --- a/core/modules/block/src/Plugin/migrate/process/BlockRegion.php +++ b/core/modules/block/src/Plugin/migrate/process/BlockRegion.php @@ -56,7 +56,7 @@ public static function create(ContainerInterface $container, array $configuratio public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { // Set the destination region, based on the source region and theme as well // as the current destination default theme. - list($source_theme, $destination_theme, $region) = $value; + [$source_theme, $destination_theme, $region] = $value; // Theme is the same on both source and destination, so ensure that the // region exists in the destination theme. diff --git a/core/modules/block/src/Plugin/migrate/process/BlockSettings.php b/core/modules/block/src/Plugin/migrate/process/BlockSettings.php index 5083f629d997..09c30b1f2cbe 100644 --- a/core/modules/block/src/Plugin/migrate/process/BlockSettings.php +++ b/core/modules/block/src/Plugin/migrate/process/BlockSettings.php @@ -22,7 +22,7 @@ class BlockSettings extends ProcessPluginBase { * Set the block configuration. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($plugin, $delta, $old_settings, $title) = $value; + [$plugin, $delta, $old_settings, $title] = $value; $settings = []; $settings['label'] = $title; if ($title && $title !== '<none>') { @@ -33,7 +33,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable } switch ($plugin) { case 'aggregator_feed_block': - list(, $id) = explode('-', $delta); + [, $id] = explode('-', $delta); $settings['block_count'] = $old_settings['aggregator']['item_count']; $settings['feed'] = $id; break; diff --git a/core/modules/block/src/Plugin/migrate/process/BlockTheme.php b/core/modules/block/src/Plugin/migrate/process/BlockTheme.php index fe6ae2ce3743..408f83be67e5 100644 --- a/core/modules/block/src/Plugin/migrate/process/BlockTheme.php +++ b/core/modules/block/src/Plugin/migrate/process/BlockTheme.php @@ -71,7 +71,7 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($theme, $default_theme, $admin_theme) = $value; + [$theme, $default_theme, $admin_theme] = $value; // If the source theme exists on the destination, we're good. if (isset($this->themes[$theme])) { diff --git a/core/modules/block/src/Plugin/migrate/process/BlockVisibility.php b/core/modules/block/src/Plugin/migrate/process/BlockVisibility.php index 45e4d4e7fb60..4d7b19cd55f6 100644 --- a/core/modules/block/src/Plugin/migrate/process/BlockVisibility.php +++ b/core/modules/block/src/Plugin/migrate/process/BlockVisibility.php @@ -82,7 +82,7 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($old_visibility, $pages, $roles) = $value; + [$old_visibility, $pages, $roles] = $value; $visibility = []; diff --git a/core/modules/block/src/Plugin/migrate/source/Block.php b/core/modules/block/src/Plugin/migrate/source/Block.php index a6bc1313be20..de6060c968d5 100644 --- a/core/modules/block/src/Plugin/migrate/source/Block.php +++ b/core/modules/block/src/Plugin/migrate/source/Block.php @@ -135,7 +135,7 @@ public function prepareRow(Row $row) { $settings = []; switch ($module) { case 'aggregator': - list($type, $id) = explode('-', $delta); + [$type, $id] = explode('-', $delta); if ($type == 'feed') { $item_count = $this->select('aggregator_feed', 'af') ->fields('af', ['block']) diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php index 86e705fd95ff..5beff98efcea 100644 --- a/core/modules/block/tests/src/Functional/BlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockTest.php @@ -169,7 +169,7 @@ public function testAddBlockFromLibraryWithWeight() { $this->assertSession()->elementTextEquals('xpath', $xpath, 'Place block'); $link = $this->getSession()->getPage()->find('xpath', $xpath); - list($path, $query_string) = explode('?', $link->getAttribute('href'), 2); + [$path, $query_string] = explode('?', $link->getAttribute('href'), 2); parse_str($query_string, $query_parts); $this->assertEquals($weight, $query_parts['weight'], 'Found the expected weight query string.'); diff --git a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php index 135cdee2902f..5c2dce25b6b4 100644 --- a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php +++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php @@ -112,7 +112,7 @@ public function getConfig(Editor $editor) { // Add the allowedContent setting, which ensures CKEditor only allows tags // and attributes that are allowed by the text format for this text editor. - list($config['allowedContent'], $config['disallowedContent']) = $this->generateACFSettings($editor); + [$config['allowedContent'], $config['disallowedContent']] = $this->generateACFSettings($editor); // Add the format_tags setting, if its button is enabled. $toolbar_buttons = CKEditorPluginManager::getEnabledButtons($editor); diff --git a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php index c6d4df3a4d83..e35c5ac1f51d 100644 --- a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php +++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php @@ -146,7 +146,7 @@ protected function generateStylesSetSetting($styles) { } // Parse. - list($selector, $label) = explode('|', $style); + [$selector, $label] = explode('|', $style); $classes = explode('.', $selector); $element = array_shift($classes); diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php index e485efe98d6a..eb56fc722017 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php @@ -93,7 +93,7 @@ public function testLoading() { // - doesn't have access to the filtered_html text format, so: no text editor. $this->drupalLogin($this->untrustedUser); $this->drupalGet('node/add/article'); - list($settings, $editor_settings_present, $editor_js_present) = $this->getThingsToCheck(); + [$settings, $editor_settings_present, $editor_js_present] = $this->getThingsToCheck(); $this->assertFalse($editor_settings_present, 'No Text Editor module settings.'); $this->assertFalse($editor_js_present, 'No Text Editor JavaScript.'); $this->assertSession()->fieldExists('edit-body-0-value'); @@ -112,7 +112,7 @@ public function testLoading() { // - does have access to the filtered_html text format, so: CKEditor. $this->drupalLogin($this->normalUser); $this->drupalGet('node/add/article'); - list($settings, $editor_settings_present, $editor_js_present) = $this->getThingsToCheck(); + [$settings, $editor_settings_present, $editor_js_present] = $this->getThingsToCheck(); $ckeditor_plugin = $this->container->get('plugin.manager.editor')->createInstance('ckeditor'); $editor = Editor::load('filtered_html'); $expected = [ @@ -149,7 +149,7 @@ public function testLoading() { $editor->setSettings($editor_settings); $editor->save(); $this->drupalGet('node/add/article'); - list($settings, $editor_settings_present, $editor_js_present) = $this->getThingsToCheck(); + [$settings, $editor_settings_present, $editor_js_present] = $this->getThingsToCheck(); $expected = [ 'formats' => [ 'filtered_html' => [ diff --git a/core/modules/color/color.module b/core/modules/color/color.module index bc6880e2bce8..8a8aa5e1b41c 100644 --- a/core/modules/color/color.module +++ b/core/modules/color/color.module @@ -393,7 +393,7 @@ function color_scheme_form_submit($form, FormStateInterface $form_state) { if (isset($info['base_image'])) { // Fetch source image dimensions. $source = \Drupal::service('extension.list.theme')->getPath($theme) . '/' . $info['base_image']; - list($width, $height) = getimagesize($source); + [$width, $height] = getimagesize($source); // We need at least a copy of the source and a target buffer of the same // size (both at 32bpp). @@ -523,7 +523,7 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) { // Split off the "Don't touch" section of the stylesheet. $split = "Color Module: Don't touch"; if (strpos($style, $split) !== FALSE) { - list($style, $fixed) = explode($split, $style); + [$style, $fixed] = explode($split, $style); } // Find all colors in the stylesheet and the chunks in between. @@ -637,7 +637,7 @@ function _color_render_images($theme, &$info, &$paths, $palette) { // Cut out slices. foreach ($info['slices'] as $file => $coord) { - list($x, $y, $width, $height) = $coord; + [$x, $y, $width, $height] = $coord; /** @var \Drupal\Core\File\FileSystemInterface $file_system */ $file_system = \Drupal::service('file_system'); $base = $file_system->basename($file); diff --git a/core/modules/content_moderation/src/Plugin/views/filter/ModerationStateFilter.php b/core/modules/content_moderation/src/Plugin/views/filter/ModerationStateFilter.php index 42b91bd93cb5..0dfbe3d865d8 100644 --- a/core/modules/content_moderation/src/Plugin/views/filter/ModerationStateFilter.php +++ b/core/modules/content_moderation/src/Plugin/views/filter/ModerationStateFilter.php @@ -177,7 +177,7 @@ protected function opSimple() { // we need to create a complex WHERE condition. $field = $this->view->query->getConnection()->condition('OR'); foreach ((array) $this->value as $value) { - list($workflow_id, $state_id) = explode('-', $value, 2); + [$workflow_id, $state_id] = explode('-', $value, 2); $and = $this->view->query->getConnection()->condition('AND'); $and @@ -247,7 +247,7 @@ public function onDependencyRemoval(array $dependencies) { protected function getWorkflowIds() { $workflow_ids = []; foreach ((array) $this->value as $value) { - list($workflow_id) = explode('-', $value, 2); + [$workflow_id] = explode('-', $value, 2); $workflow_ids[] = $workflow_id; } diff --git a/core/modules/content_moderation/src/Routing/ContentModerationRouteSubscriber.php b/core/modules/content_moderation/src/Routing/ContentModerationRouteSubscriber.php index 934734da3cae..53da1fe07cc6 100644 --- a/core/modules/content_moderation/src/Routing/ContentModerationRouteSubscriber.php +++ b/core/modules/content_moderation/src/Routing/ContentModerationRouteSubscriber.php @@ -65,7 +65,7 @@ protected function setLatestRevisionFlag(Route $route) { return; } // Only set the flag on entity types which are revisionable. - list($entity_type) = explode('.', $entity_form, 2); + [$entity_type] = explode('.', $entity_form, 2); if (!isset($this->getModeratedEntityTypes()[$entity_type]) || !$this->getModeratedEntityTypes()[$entity_type]->isRevisionable()) { return; } diff --git a/core/modules/content_translation/tests/src/Kernel/ContentTranslationFieldSyncRevisionTest.php b/core/modules/content_translation/tests/src/Kernel/ContentTranslationFieldSyncRevisionTest.php index d273d056f3f6..2c7f8a9a3736 100644 --- a/core/modules/content_translation/tests/src/Kernel/ContentTranslationFieldSyncRevisionTest.php +++ b/core/modules/content_translation/tests/src/Kernel/ContentTranslationFieldSyncRevisionTest.php @@ -482,7 +482,7 @@ protected function assertViolations(EntityConstraintViolationListInterface $viol protected function assertLatestRevisionFieldValues($entity_id, array $expected_values) { /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ $entity = $this->storage->loadRevision($this->storage->getLatestRevisionId($entity_id)); - @list($revision_id, $target_id_en, $target_id_it, $alt_en, $alt_it) = $expected_values; + @[$revision_id, $target_id_en, $target_id_it, $alt_en, $alt_it] = $expected_values; $this->assertEquals($revision_id, $entity->getRevisionId()); $this->assertEquals($target_id_en, $entity->get($this->fieldName)->target_id); $this->assertEquals($alt_en, $entity->get($this->fieldName)->alt); diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module index aaab3a6e9de5..2410f1db51e6 100644 --- a/core/modules/contextual/contextual.module +++ b/core/modules/contextual/contextual.module @@ -210,7 +210,7 @@ function _contextual_id_to_links($id) { $contextual_links = []; $contexts = explode('|', $id); foreach ($contexts as $context) { - list($group, $route_parameters_raw, $metadata_raw) = explode(':', $context); + [$group, $route_parameters_raw, $metadata_raw] = explode(':', $context); parse_str($route_parameters_raw, $route_parameters); $metadata = []; parse_str($metadata_raw, $metadata); diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php index 469155e84959..17f70fc4b67c 100644 --- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php +++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php @@ -562,7 +562,7 @@ public function testDatelistWidget() { // Test the widget for validation notifications. foreach ($this->datelistDataProvider($field_label) as $data) { - list($date_value, $expected) = $data; + [$date_value, $expected] = $data; // Display creation form. $this->drupalGet('entity_test/add'); diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php index 77a21941a1ea..d6c4e0cb7728 100644 --- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php +++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php @@ -854,7 +854,7 @@ public function testDatelistWidget() { // Test the widget for validation notifications. foreach ($this->datelistDataProvider() as $data) { - list($start_date_value, $end_date_value, $expected) = $data; + [$start_date_value, $end_date_value, $expected] = $data; // Display creation form. $this->drupalGet('entity_test/add'); diff --git a/core/modules/editor/tests/src/Functional/EditorLoadingTest.php b/core/modules/editor/tests/src/Functional/EditorLoadingTest.php index 10cafa12a2ba..51f7c5d81c1f 100644 --- a/core/modules/editor/tests/src/Functional/EditorLoadingTest.php +++ b/core/modules/editor/tests/src/Functional/EditorLoadingTest.php @@ -147,7 +147,7 @@ public function testLoading() { // - doesn't have access to the full_html text format, so: no text editor. $this->drupalLogin($this->normalUser); $this->drupalGet('node/add/article'); - list(, $editor_settings_present, $editor_js_present, $body) = $this->getThingsToCheck('body'); + [, $editor_settings_present, $editor_js_present, $body] = $this->getThingsToCheck('body'); $this->assertFalse($editor_settings_present, 'No Text Editor module settings.'); $this->assertFalse($editor_js_present, 'No Text Editor JavaScript.'); $this->assertCount(1, $body, 'A body field exists.'); @@ -159,7 +159,7 @@ public function testLoading() { // - does have access to the full_html text format, so: Unicorn text editor. $this->drupalLogin($this->privilegedUser); $this->drupalGet('node/add/article'); - list($settings, $editor_settings_present, $editor_js_present, $body) = $this->getThingsToCheck('body'); + [$settings, $editor_settings_present, $editor_js_present, $body] = $this->getThingsToCheck('body'); $expected = [ 'formats' => [ 'full_html' => [ @@ -197,7 +197,7 @@ public function testLoading() { // - has access to the plain_text text format, so: Unicorn text editor. $this->drupalLogin($this->untrustedUser); $this->drupalGet('node/add/article'); - list($settings, $editor_settings_present, $editor_js_present, $body) = $this->getThingsToCheck('body'); + [$settings, $editor_settings_present, $editor_js_present, $body] = $this->getThingsToCheck('body'); $expected = [ 'formats' => [ 'plain_text' => [ @@ -233,7 +233,7 @@ public function testLoading() { // that they are not allowed to use. The editor is still loaded. CKEditor, // for example, supports being loaded in a disabled state. $this->drupalGet('node/1/edit'); - list(, $editor_settings_present, $editor_js_present, $body) = $this->getThingsToCheck('body'); + [, $editor_settings_present, $editor_js_present, $body] = $this->getThingsToCheck('body'); $this->assertTrue($editor_settings_present, 'Text Editor module settings.'); $this->assertTrue($editor_js_present, 'Text Editor JavaScript.'); $this->assertCount(1, $body, 'A body field exists.'); @@ -273,7 +273,7 @@ public function testSupportedElementTypes() { // Assert the unicorn editor works with textfields. $this->drupalLogin($this->privilegedUser); $this->drupalGet('node/1/edit'); - list(, $editor_settings_present, $editor_js_present, $field) = $this->getThingsToCheck('field-text', 'input'); + [, $editor_settings_present, $editor_js_present, $field] = $this->getThingsToCheck('field-text', 'input'); $this->assertTrue($editor_settings_present, "Text Editor module's JavaScript settings are on the page."); $this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.'); $this->assertCount(1, $field, 'A text field exists.'); @@ -292,7 +292,7 @@ public function testSupportedElementTypes() { ])->save(); $this->drupalGet('node/1/edit'); - list(, $editor_settings_present, $editor_js_present, $field) = $this->getThingsToCheck('field-text', 'input'); + [, $editor_settings_present, $editor_js_present, $field] = $this->getThingsToCheck('field-text', 'input'); $this->assertFalse($editor_settings_present, "Text Editor module's JavaScript settings are not on the page."); $this->assertFalse($editor_js_present, 'Text Editor JavaScript is not present.'); $this->assertCount(1, $field, 'A text field exists.'); diff --git a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php index 76a398d622b3..4196769ac856 100644 --- a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php +++ b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php @@ -81,48 +81,48 @@ public function testEditorUploadImageScale() { // Case 1: no max dimensions set: uploaded image not scaled. $test_image = $testing_image_list[0]; - list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri); + [$image_file_width, $image_file_height] = $this->getTestImageInfo($test_image->uri); $max_width = NULL; $max_height = NULL; $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); - list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); + [$uploaded_image_file_width, $uploaded_image_file_height] = $this->uploadImage($test_image->uri); $this->assertEquals($image_file_width, $uploaded_image_file_width); $this->assertEquals($image_file_height, $uploaded_image_file_height); $this->assertSession()->pageTextNotContains("The image was resized to fit within the maximum allowed dimensions of {$max_width}x{$max_height} pixels."); // Case 2: max width smaller than uploaded image: image scaled down. $test_image = $testing_image_list[1]; - list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri); + [$image_file_width, $image_file_height] = $this->getTestImageInfo($test_image->uri); $max_width = $image_file_width - 5; $max_height = $image_file_height; $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); - list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); + [$uploaded_image_file_width, $uploaded_image_file_height] = $this->uploadImage($test_image->uri); $this->assertEquals($max_width, $uploaded_image_file_width); $this->assertEquals($uploaded_image_file_height * ($uploaded_image_file_width / $max_width), $uploaded_image_file_height); $this->assertSession()->pageTextContains("The image was resized to fit within the maximum allowed dimensions of {$max_width}x{$max_height} pixels."); // Case 3: max height smaller than uploaded image: image scaled down. $test_image = $testing_image_list[2]; - list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri); + [$image_file_width, $image_file_height] = $this->getTestImageInfo($test_image->uri); $max_width = $image_file_width; $max_height = $image_file_height - 5; $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); - list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); + [$uploaded_image_file_width, $uploaded_image_file_height] = $this->uploadImage($test_image->uri); $this->assertEquals($uploaded_image_file_width * ($uploaded_image_file_height / $max_height), $uploaded_image_file_width); $this->assertEquals($max_height, $uploaded_image_file_height); $this->assertSession()->pageTextContains("The image was resized to fit within the maximum allowed dimensions of {$max_width}x{$max_height} pixels."); // Case 4: max dimensions greater than uploaded image: image not scaled. $test_image = $testing_image_list[3]; - list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri); + [$image_file_width, $image_file_height] = $this->getTestImageInfo($test_image->uri); $max_width = $image_file_width + 5; $max_height = $image_file_height + 5; $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); - list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); + [$uploaded_image_file_width, $uploaded_image_file_height] = $this->uploadImage($test_image->uri); $this->assertEquals($image_file_width, $uploaded_image_file_width); $this->assertEquals($image_file_height, $uploaded_image_file_height); $this->assertSession()->pageTextNotContains("The image was resized to fit within the maximum allowed dimensions of {$max_width}x{$max_height} pixels."); @@ -130,12 +130,12 @@ public function testEditorUploadImageScale() { // Case 5: only max width dimension was provided and it was smaller than // uploaded image: image scaled down. $test_image = $testing_image_list[4]; - list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri); + [$image_file_width, $image_file_height] = $this->getTestImageInfo($test_image->uri); $max_width = $image_file_width - 5; $max_height = NULL; $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); - list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); + [$uploaded_image_file_width, $uploaded_image_file_height] = $this->uploadImage($test_image->uri); $this->assertEquals($max_width, $uploaded_image_file_width); $this->assertEquals($uploaded_image_file_height * ($uploaded_image_file_width / $max_width), $uploaded_image_file_height); $this->assertSession()->pageTextContains("The image was resized to fit within the maximum allowed width of {$max_width} pixels."); @@ -143,12 +143,12 @@ public function testEditorUploadImageScale() { // Case 6: only max height dimension was provided and it was smaller than // uploaded image: image scaled down. $test_image = $testing_image_list[5]; - list($image_file_width, $image_file_height) = $this->getTestImageInfo($test_image->uri); + [$image_file_width, $image_file_height] = $this->getTestImageInfo($test_image->uri); $max_width = NULL; $max_height = $image_file_height - 5; $this->setMaxDimensions($max_width, $max_height); $this->assertSavedMaxDimensions($max_width, $max_height); - list($uploaded_image_file_width, $uploaded_image_file_height) = $this->uploadImage($test_image->uri); + [$uploaded_image_file_width, $uploaded_image_file_height] = $this->uploadImage($test_image->uri); $this->assertEquals($uploaded_image_file_width * ($uploaded_image_file_height / $max_height), $uploaded_image_file_width); $this->assertEquals($max_height, $uploaded_image_file_height); $this->assertSession()->pageTextContains("The image was resized to fit within the maximum allowed height of {$max_height} pixels."); diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 3a8a8e16b1f3..423271665482 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -410,7 +410,7 @@ function field_field_config_presave(FieldConfigInterface $field) { // target entity type. $target_type = $field->getFieldStorageDefinition()->getSetting('target_type'); $selection_manager = \Drupal::service('plugin.manager.entity_reference_selection'); - list($current_handler) = explode(':', $field->getSetting('handler'), 2); + [$current_handler] = explode(':', $field->getSetting('handler'), 2); $field->setSetting('handler', $selection_manager->getPluginId($target_type, $current_handler)); // In case we removed all the target bundles allowed by the field in diff --git a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceDefaults.php b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceDefaults.php index 383fa314ca37..99526b58009a 100644 --- a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceDefaults.php +++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceDefaults.php @@ -21,7 +21,7 @@ class FieldInstanceDefaults extends ProcessPluginBase { * Set the field instance defaults. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($widget_type, $widget_settings) = $value; + [$widget_type, $widget_settings] = $value; $default = []; switch ($widget_type) { diff --git a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceOptionTranslation.php b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceOptionTranslation.php index 4b612bffaa78..5e8d2322f8d4 100644 --- a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceOptionTranslation.php +++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceOptionTranslation.php @@ -20,7 +20,7 @@ class FieldInstanceOptionTranslation extends ProcessPluginBase { * {@inheritdoc} */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($field_type, $global_settings) = $value; + [$field_type, $global_settings] = $value; $option_key = 0; $translation = ''; diff --git a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceSettings.php b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceSettings.php index d0198dea2b1d..be41a4209ca5 100644 --- a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceSettings.php +++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceSettings.php @@ -21,7 +21,7 @@ class FieldInstanceSettings extends ProcessPluginBase { * Set the field instance defaults. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($widget_type, $widget_settings, $field_settings) = $value; + [$widget_type, $widget_settings, $field_settings] = $value; $settings = []; switch ($widget_type) { case 'number': diff --git a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceWidgetSettings.php b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceWidgetSettings.php index a64a14968903..4f79d7d2eac1 100644 --- a/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceWidgetSettings.php +++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldInstanceWidgetSettings.php @@ -23,7 +23,7 @@ class FieldInstanceWidgetSettings extends ProcessPluginBase { * Get the field instance default/mapped widget settings. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($widget_type, $widget_settings) = $value; + [$widget_type, $widget_settings] = $value; return $this->getSettings($widget_type, $widget_settings); } diff --git a/core/modules/field/src/Plugin/migrate/process/d6/FieldOptionTranslation.php b/core/modules/field/src/Plugin/migrate/process/d6/FieldOptionTranslation.php index 8432c2b26256..1976becf830e 100644 --- a/core/modules/field/src/Plugin/migrate/process/d6/FieldOptionTranslation.php +++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldOptionTranslation.php @@ -22,7 +22,7 @@ class FieldOptionTranslation extends ProcessPluginBase { * Get the field default/mapped settings. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($field_type, $global_settings) = $value; + [$field_type, $global_settings] = $value; $allowed_values = ''; $i = 0; diff --git a/core/modules/field/src/Plugin/migrate/process/d6/FieldSettings.php b/core/modules/field/src/Plugin/migrate/process/d6/FieldSettings.php index 967b4cbd796c..8b7eb0d95192 100644 --- a/core/modules/field/src/Plugin/migrate/process/d6/FieldSettings.php +++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldSettings.php @@ -26,7 +26,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable if (count($value) == 2) { $value[] = NULL; } - list($field_type, $global_settings, $original_field_type) = $value; + [$field_type, $global_settings, $original_field_type] = $value; return $this->getSettings($field_type, $global_settings, $original_field_type); } diff --git a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceDefaults.php b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceDefaults.php index 57c2b51c0343..fab63a67b504 100644 --- a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceDefaults.php +++ b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceDefaults.php @@ -17,7 +17,7 @@ class FieldInstanceDefaults extends ProcessPluginBase { * {@inheritdoc} */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($default_value, $widget_settings) = $value; + [$default_value, $widget_settings] = $value; $widget_type = $widget_settings['type']; $default_value = $default_value ?: []; diff --git a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceOptionTranslation.php b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceOptionTranslation.php index e7082554498e..a3e2063183e6 100644 --- a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceOptionTranslation.php +++ b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceOptionTranslation.php @@ -20,7 +20,7 @@ class FieldInstanceOptionTranslation extends ProcessPluginBase { * {@inheritdoc} */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($type, $data) = $value; + [$type, $data] = $value; $data = unserialize($data); $property = $row->getSourceProperty('property'); diff --git a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceSettings.php b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceSettings.php index cf17e75a5cf0..5236e5507a38 100644 --- a/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceSettings.php +++ b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceSettings.php @@ -19,7 +19,7 @@ class FieldInstanceSettings extends ProcessPluginBase { * {@inheritdoc} */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($instance_settings, $widget_settings, $field_definition) = $value; + [$instance_settings, $widget_settings, $field_definition] = $value; $widget_type = $widget_settings['type']; $field_data = unserialize($field_definition['data']); diff --git a/core/modules/field/src/Plugin/migrate/process/d7/FieldOptionTranslation.php b/core/modules/field/src/Plugin/migrate/process/d7/FieldOptionTranslation.php index 3831bfcb5964..4b60335f7fb8 100644 --- a/core/modules/field/src/Plugin/migrate/process/d7/FieldOptionTranslation.php +++ b/core/modules/field/src/Plugin/migrate/process/d7/FieldOptionTranslation.php @@ -22,7 +22,7 @@ class FieldOptionTranslation extends ProcessPluginBase { * Get the field default/mapped settings. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($type, $data) = $value; + [$type, $data] = $value; $data = unserialize($data); $new_allowed_values = ''; diff --git a/core/modules/field/tests/src/Kernel/Boolean/BooleanFormatterTest.php b/core/modules/field/tests/src/Kernel/Boolean/BooleanFormatterTest.php index 7e3653f75501..acebe47fdaa0 100644 --- a/core/modules/field/tests/src/Kernel/Boolean/BooleanFormatterTest.php +++ b/core/modules/field/tests/src/Kernel/Boolean/BooleanFormatterTest.php @@ -127,7 +127,7 @@ public function testBooleanFormatter() { $data[] = [1, $format, 'TRUE']; foreach ($data as $test_data) { - list($value, $settings, $expected) = $test_data; + [$value, $settings, $expected] = $test_data; $component = $this->display->getComponent($this->fieldName); $component['settings'] = $settings; diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php index c14fb3e37c7a..31264bcde6bf 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php @@ -52,7 +52,7 @@ protected function setUp(): void { * Whether or not the field is expected to be translatable. */ protected function assertEntity($id, $expected_label, $expected_field_type, $is_required, $expected_translatable) { - list ($expected_entity_type, $expected_bundle, $expected_name) = explode('.', $id); + [$expected_entity_type, $expected_bundle, $expected_name] = explode('.', $id); /** @var \Drupal\field\FieldConfigInterface $field */ $field = FieldConfig::load($id); diff --git a/core/modules/field/tests/src/Kernel/Timestamp/TimestampFormatterTest.php b/core/modules/field/tests/src/Kernel/Timestamp/TimestampFormatterTest.php index 8e0e64baa81d..2e5e7349aafb 100644 --- a/core/modules/field/tests/src/Kernel/Timestamp/TimestampFormatterTest.php +++ b/core/modules/field/tests/src/Kernel/Timestamp/TimestampFormatterTest.php @@ -119,7 +119,7 @@ public function testTimestampFormatter() { $data[] = ['date_format' => 'custom', 'custom_date_format' => 'e', 'timezone' => 'Asia/Tokyo']; foreach ($data as $settings) { - list($date_format, $custom_date_format, $timezone) = array_values($settings); + [$date_format, $custom_date_format, $timezone] = array_values($settings); if (empty($timezone)) { $timezone = NULL; } diff --git a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php index 8f399144099f..6cc3f6bd0589 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -829,7 +829,7 @@ protected function getDisplays() { $ids = $this->configFactory()->listAll($config_prefix . '.' . $this->entity->getTargetEntityTypeId() . '.' . $this->entity->getTargetBundle() . '.'); foreach ($ids as $id) { $config_id = str_replace($config_prefix . '.', '', $id); - list(,, $display_mode) = explode('.', $config_id); + [,, $display_mode] = explode('.', $config_id); if ($display_mode != 'default') { $load_ids[] = $config_id; } diff --git a/core/modules/field_ui/src/Form/FieldStorageAddForm.php b/core/modules/field_ui/src/Form/FieldStorageAddForm.php index 8a1139b0df0e..7c54ca94cc71 100644 --- a/core/modules/field_ui/src/Form/FieldStorageAddForm.php +++ b/core/modules/field_ui/src/Form/FieldStorageAddForm.php @@ -338,7 +338,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // Check if we're dealing with a preconfigured field. if (strpos($field_storage_values['type'], 'field_ui:') !== FALSE) { - list(, $field_type, $option_key) = explode(':', $field_storage_values['type'], 3); + [, $field_type, $option_key] = explode(':', $field_storage_values['type'], 3); $field_storage_values['type'] = $field_type; $field_definition = $this->fieldTypePluginManager->getDefinition($field_type); diff --git a/core/modules/file/file.module b/core/modules/file/file.module index d222f3560c9d..7300dd9c6767 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -416,7 +416,7 @@ function file_validate_image_resolution(FileInterface $file, $maximum_dimensions $scaling = FALSE; if ($maximum_dimensions) { // Check that it is smaller than the given dimensions. - list($width, $height) = explode('x', $maximum_dimensions); + [$width, $height] = explode('x', $maximum_dimensions); if ($image->getWidth() > $width || $image->getHeight() > $height) { // Try to resize the image to fit the dimensions. if ($image->scale($width, $height)) { @@ -456,7 +456,7 @@ function file_validate_image_resolution(FileInterface $file, $maximum_dimensions if ($minimum_dimensions) { // Check that it is larger than the given dimensions. - list($width, $height) = explode('x', $minimum_dimensions); + [$width, $height] = explode('x', $minimum_dimensions); if ($image->getWidth() < $width || $image->getHeight() < $height) { if ($scaling) { $errors[] = t('The resized image is too small. The minimum dimensions are %dimensions pixels and after resizing, the image size will be %widthx%height pixels.', diff --git a/core/modules/file/file.views.inc b/core/modules/file/file.views.inc index 1238b6711272..666c7da49d83 100644 --- a/core/modules/file/file.views.inc +++ b/core/modules/file/file.views.inc @@ -45,7 +45,7 @@ function file_field_views_data_views_data_alter(array &$data, FieldStorageConfig /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */ $table_mapping = $entity_type_manager->getStorage($entity_type_id)->getTableMapping(); - list($label) = views_entity_field_label($entity_type_id, $field_name); + [$label] = views_entity_field_label($entity_type_id, $field_name); $data['file_managed'][$pseudo_field_name]['relationship'] = [ 'title' => t('@entity using @field', ['@entity' => $entity_type->getLabel(), '@field' => $label]), diff --git a/core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php b/core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php index d69ab74005ab..9fa11db2f69e 100644 --- a/core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php +++ b/core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php @@ -175,7 +175,7 @@ protected function prepareAttributes(array $additional_attributes = []) { * TRUE if the MIME type applies, FALSE otherwise. */ protected static function mimeTypeApplies($mime_type) { - list($type) = explode('/', $mime_type, 2); + [$type] = explode('/', $mime_type, 2); return $type === static::getMediaType(); } diff --git a/core/modules/file/src/Plugin/migrate/process/d6/FileUri.php b/core/modules/file/src/Plugin/migrate/process/d6/FileUri.php index c14b5ea50aea..32c30b45bbb0 100644 --- a/core/modules/file/src/Plugin/migrate/process/d6/FileUri.php +++ b/core/modules/file/src/Plugin/migrate/process/d6/FileUri.php @@ -24,7 +24,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable if ($row->isStub()) { return NULL; } - list($filepath, $file_directory_path, $temp_directory_path, $is_public) = $value; + [$filepath, $file_directory_path, $temp_directory_path, $is_public] = $value; // Specific handling using $temp_directory_path for temporary files. if (substr($filepath, 0, strlen($temp_directory_path)) === $temp_directory_path) { diff --git a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php index 12f0887391c9..005bc1badbba 100644 --- a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php @@ -132,7 +132,7 @@ public function testFileExtension() { $this->createFileField($field_name, 'node', $type_name); $test_file = $this->getTestFile('image'); - list(, $test_file_extension) = explode('.', $test_file->getFilename()); + [, $test_file_extension] = explode('.', $test_file->getFilename()); // Disable extension checking. $this->updateFileField($field_name, $type_name, ['file_extensions' => '']); diff --git a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php index 7fd93354ba18..6a112fb9ff96 100644 --- a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php +++ b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php @@ -70,7 +70,7 @@ protected function setUp(): void { $image_files = $this->drupalGetTestFiles('image'); $this->image = File::create((array) current($image_files)); - list(, $this->imageExtension) = explode('.', $this->image->getFilename()); + [, $this->imageExtension] = explode('.', $this->image->getFilename()); $this->assertFileExists($this->image->getFileUri()); $this->phpfile = current($this->drupalGetTestFiles('php')); diff --git a/core/modules/file/tests/src/Functional/SaveUploadTest.php b/core/modules/file/tests/src/Functional/SaveUploadTest.php index a3a7760dbb0d..5fb1f1a8117d 100644 --- a/core/modules/file/tests/src/Functional/SaveUploadTest.php +++ b/core/modules/file/tests/src/Functional/SaveUploadTest.php @@ -67,7 +67,7 @@ protected function setUp(): void { $image_files = $this->drupalGetTestFiles('image'); $this->image = File::create((array) current($image_files)); - list(, $this->imageExtension) = explode('.', $this->image->getFilename()); + [, $this->imageExtension] = explode('.', $this->image->getFilename()); $this->assertFileExists($this->image->getFileUri()); $this->phpfile = current($this->drupalGetTestFiles('php')); diff --git a/core/modules/file/tests/src/Kernel/UsageTest.php b/core/modules/file/tests/src/Kernel/UsageTest.php index b9a2f7134b59..1e1a43cec265 100644 --- a/core/modules/file/tests/src/Kernel/UsageTest.php +++ b/core/modules/file/tests/src/Kernel/UsageTest.php @@ -195,7 +195,7 @@ public function createTempFiles() { * Ensure that temporary files are removed by default. */ public function testTempFileCleanupDefault() { - list($temp_old, $temp_new, $perm_old, $perm_new) = $this->createTempFiles(); + [$temp_old, $temp_new, $perm_old, $perm_new] = $this->createTempFiles(); // Run cron and then ensure that only the old, temp file was deleted. $this->container->get('cron')->run(); @@ -209,7 +209,7 @@ public function testTempFileCleanupDefault() { * Ensure that temporary files are kept as configured. */ public function testTempFileNoCleanup() { - list($temp_old, $temp_new, $perm_old, $perm_new) = $this->createTempFiles(); + [$temp_old, $temp_new, $perm_old, $perm_new] = $this->createTempFiles(); // Set the max age to 0, meaning no temporary files will be deleted. $this->config('system.file') @@ -228,7 +228,7 @@ public function testTempFileNoCleanup() { * Ensure that temporary files are kept as configured. */ public function testTempFileCustomCleanup() { - list($temp_old, $temp_new, $perm_old, $perm_new) = $this->createTempFiles(); + [$temp_old, $temp_new, $perm_old, $perm_new] = $this->createTempFiles(); // Set the max age to older than default. $this->config('system.file') diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 04d73fce7aaf..d068ae03acda 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -706,7 +706,7 @@ function _filter_autop($text) { } // Opening or closing tag? $open = ($chunk[1] != '/'); - list($tag) = preg_split('/[ >]/', substr($chunk, 2 - $open), 2); + [$tag] = preg_split('/[ >]/', substr($chunk, 2 - $open), 2); if (!$ignore) { if ($open) { $ignore = TRUE; diff --git a/core/modules/filter/tests/src/Functional/FilterDefaultFormatTest.php b/core/modules/filter/tests/src/Functional/FilterDefaultFormatTest.php index 150a2a1a97cf..a2a9a415ebf3 100644 --- a/core/modules/filter/tests/src/Functional/FilterDefaultFormatTest.php +++ b/core/modules/filter/tests/src/Functional/FilterDefaultFormatTest.php @@ -43,7 +43,7 @@ public function testDefaultTextFormats() { $this->resetFilterCaches(); $formats[] = FilterFormat::load($edit['format']); } - list($first_format, $second_format) = $formats; + [$first_format, $second_format] = $formats; $second_format_permission = $second_format->getPermissionName(); $first_user = $this->drupalCreateUser([ $first_format->getPermissionName(), diff --git a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php index f3c513b2373e..d6a9c66e44be 100644 --- a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php +++ b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php @@ -97,7 +97,7 @@ protected function setUp(): void { $this->resetFilterCaches(); $formats[] = FilterFormat::load($edit['format']); } - list($this->allowedFormat, $this->secondAllowedFormat, $this->disallowedFormat) = $formats; + [$this->allowedFormat, $this->secondAllowedFormat, $this->disallowedFormat] = $formats; $this->drupalLogout(); // Create a regular user with access to two of the formats. diff --git a/core/modules/help_topics/src/HelpTopicDiscovery.php b/core/modules/help_topics/src/HelpTopicDiscovery.php index 37a81299472f..684453faa0af 100644 --- a/core/modules/help_topics/src/HelpTopicDiscovery.php +++ b/core/modules/help_topics/src/HelpTopicDiscovery.php @@ -99,7 +99,7 @@ public function findAll() { foreach ($files as $file => $provider) { $plugin_id = substr(basename($file), 0, -10); // The plugin ID begins with provider. - list($file_name_provider,) = explode('.', $plugin_id, 2); + [$file_name_provider] = explode('.', $plugin_id, 2); // Only the Help Topics module can provide help for other extensions. // @todo https://www.drupal.org/project/drupal/issues/3072312 Remove // help_topics special case once Help Topics is stable and core diff --git a/core/modules/image/image.views.inc b/core/modules/image/image.views.inc index 483f989faf9f..553678ccd835 100644 --- a/core/modules/image/image.views.inc +++ b/core/modules/image/image.views.inc @@ -45,7 +45,7 @@ function image_field_views_data_views_data_alter(array &$data, FieldStorageConfi /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */ $table_mapping = $entity_type_manager->getStorage($entity_type_id)->getTableMapping(); - list($label) = views_entity_field_label($entity_type_id, $field_name); + [$label] = views_entity_field_label($entity_type_id, $field_name); $data['file_managed'][$pseudo_field_name]['relationship'] = [ 'title' => t('@entity using @field', ['@entity' => $entity_type->getLabel(), '@field' => $label]), diff --git a/core/modules/image/src/PathProcessor/PathProcessorImageStyles.php b/core/modules/image/src/PathProcessor/PathProcessorImageStyles.php index f40d083ac482..b154bd4df398 100644 --- a/core/modules/image/src/PathProcessor/PathProcessorImageStyles.php +++ b/core/modules/image/src/PathProcessor/PathProcessorImageStyles.php @@ -63,7 +63,7 @@ public function processInbound($path, Request $request) { // Get the image style, scheme and path. if (substr_count($rest, '/') >= 2) { - list($image_style, $scheme, $file) = explode('/', $rest, 3); + [$image_style, $scheme, $file] = explode('/', $rest, 3); // Set the file as query parameter. $request->query->set('file', $file); diff --git a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php index 204a1ac5c70a..fa6ea636e290 100644 --- a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php +++ b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php @@ -377,7 +377,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin $file = $images[$extension][$min_resolution][$max_resolution][$image_index]; } - list($width, $height) = getimagesize($file->getFileUri()); + [$width, $height] = getimagesize($file->getFileUri()); $values = [ 'target_id' => $file->id(), 'alt' => $random->sentences(4), diff --git a/core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php b/core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php index 87536e643d35..cdacda96b7cf 100644 --- a/core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php +++ b/core/modules/image/src/Plugin/ImageEffect/CropImageEffect.php @@ -20,7 +20,7 @@ class CropImageEffect extends ResizeImageEffect { * {@inheritdoc} */ public function applyEffect(ImageInterface $image) { - list($x, $y) = explode('-', $this->configuration['anchor']); + [$x, $y] = explode('-', $this->configuration['anchor']); $x = image_filter_keyword($x, $image->getWidth(), $this->configuration['width']); $y = image_filter_keyword($y, $image->getHeight(), $this->configuration['height']); if (!$image->crop($x, $y, $this->configuration['width'], $this->configuration['height'])) { diff --git a/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php b/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php index 5f06674dd6e2..b496341a417c 100644 --- a/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php +++ b/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php @@ -23,7 +23,7 @@ public function applyEffect(ImageInterface $image) { $height = $this->configuration['height']; $scale = max($width / $image->getWidth(), $height / $image->getHeight()); - list($x, $y) = explode('-', $this->configuration['anchor']); + [$x, $y] = explode('-', $this->configuration['anchor']); $x = image_filter_keyword($x, $image->getWidth() * $scale, $width); $y = image_filter_keyword($y, $image->getHeight() * $scale, $height); diff --git a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php index 65ebc66f6338..4e3d31cfa749 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php @@ -239,7 +239,7 @@ public function testImageFieldSettings() { $renderer = $this->container->get('renderer'); $node_storage = $this->container->get('entity_type.manager')->getStorage('node'); $test_image = current($this->drupalGetTestFiles('image')); - list(, $test_image_extension) = explode('.', $test_image->filename); + [, $test_image_extension] = explode('.', $test_image->filename); $field_name = strtolower($this->randomMachineName()); $field_settings = [ 'alt_field' => 1, diff --git a/core/modules/jsonapi/src/Access/TemporaryQueryGuard.php b/core/modules/jsonapi/src/Access/TemporaryQueryGuard.php index 1c5c34db1612..6225bf3aa69f 100644 --- a/core/modules/jsonapi/src/Access/TemporaryQueryGuard.php +++ b/core/modules/jsonapi/src/Access/TemporaryQueryGuard.php @@ -150,7 +150,7 @@ protected static function secureQuery(QueryInterface $query, $entity_type_id, ar // portion. JSON:API will have already validated that the property // exists. $split_specifier = explode(':', $specifier, 2); - list($property_name, $target_entity_type_id) = array_merge($split_specifier, count($split_specifier) === 2 ? [] : [NULL]); + [$property_name, $target_entity_type_id] = array_merge($split_specifier, count($split_specifier) === 2 ? [] : [NULL]); // The specifier is either a field property or a delta. If it is a data // reference or a delta, then it needs to be traversed to the next // specifier. However, if the specific is a simple field property, i.e. diff --git a/core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php b/core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php index 667eb83d2562..c16a23be8a9d 100644 --- a/core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php +++ b/core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php @@ -110,7 +110,7 @@ public function saveOnTerminate(ResourceObject $object, array $normalization_par */ public function onTerminate(TerminateEvent $event) { foreach ($this->toCache as $value) { - list($object, $normalization_parts) = $value; + [$object, $normalization_parts] = $value; $this->set($object, $normalization_parts); } } diff --git a/core/modules/jsonapi/src/Revisions/VersionNegotiator.php b/core/modules/jsonapi/src/Revisions/VersionNegotiator.php index 76bd43f0f19b..857582a4119f 100644 --- a/core/modules/jsonapi/src/Revisions/VersionNegotiator.php +++ b/core/modules/jsonapi/src/Revisions/VersionNegotiator.php @@ -65,7 +65,7 @@ public function addVersionNegotiator(VersionNegotiatorInterface $version_negotia */ public function getRevision(EntityInterface $entity, $resource_version_identifier) { try { - list($version_negotiator_name, $version_argument) = explode(VersionNegotiator::SEPARATOR, $resource_version_identifier, 2); + [$version_negotiator_name, $version_argument] = explode(VersionNegotiator::SEPARATOR, $resource_version_identifier, 2); if (!isset($this->negotiators[$version_negotiator_name])) { static::throwBadRequestHttpException($resource_version_identifier); } diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php index 58838f000275..ada184a7d820 100644 --- a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php +++ b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php @@ -2284,7 +2284,7 @@ public function testPatchIndividual() { $this->assertResourceErrorResponse(403, "The current user is not allowed to PATCH the selected field (field_rest_test).", $url, $response, '/data/attributes/field_rest_test'); // DX: 403 when sending PATCH request with updated read-only fields. - list($modified_entity, $original_values) = static::getModifiedEntityForPatchTesting($this->entity); + [$modified_entity, $original_values] = static::getModifiedEntityForPatchTesting($this->entity); // Send PATCH request by serializing the modified entity, assert the error // response, change the modified entity field that caused the error response // back to its original value, repeat. diff --git a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php index 9fe25c95b9fc..c9154a6d445f 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php @@ -224,7 +224,7 @@ public function tearDown(): void { * @covers ::normalize */ public function testNormalize() { - list($request, $resource_type) = $this->generateProphecies('node', 'article'); + [$request, $resource_type] = $this->generateProphecies('node', 'article'); $resource_object = ResourceObject::createFromEntity($resource_type, $this->node); $includes = $this->includeResolver->resolve($resource_object, 'uid,field_tags,field_image'); @@ -327,7 +327,7 @@ public function testNormalize() { public function testNormalizeRelated() { $this->markTestIncomplete('This fails and should be fixed by https://www.drupal.org/project/drupal/issues/2922121'); - list($request, $resource_type) = $this->generateProphecies('node', 'article', 'uid'); + [$request, $resource_type] = $this->generateProphecies('node', 'article', 'uid'); $request->query = new ParameterBag([ 'fields' => [ 'user--user' => 'name,roles', @@ -362,7 +362,7 @@ public function testNormalizeRelated() { * @covers ::normalize */ public function testNormalizeUuid() { - list($request, $resource_type) = $this->generateProphecies('node', 'article', 'uuid'); + [$request, $resource_type] = $this->generateProphecies('node', 'article', 'uuid'); $resource_object = ResourceObject::createFromEntity($resource_type, $this->node); $include_param = 'uid,field_tags'; $includes = $this->includeResolver->resolve($resource_object, $include_param); @@ -452,11 +452,11 @@ public function testAliasFieldRouteException() { $this->assertSame('user_roles', $this->resourceTypeRepository->getByTypeName('user--user')->getPublicName('roles')); // Create the request to fetch the articles and fetch included user. - list($request, $resource_type) = $this->generateProphecies('node', 'article'); + [$request, $resource_type] = $this->generateProphecies('node', 'article'); $user = User::load($this->node->getOwnerId()); $resource_object = ResourceObject::createFromEntity($resource_type, $this->node); - list($request, $user_resource_type) = $this->generateProphecies('user', 'user'); + [$request, $user_resource_type] = $this->generateProphecies('user', 'user'); $resource_object_user = LabelOnlyResourceObject::createFromEntity($user_resource_type, $user); $includes = $this->includeResolver->resolve($resource_object_user, 'user_roles'); @@ -499,7 +499,7 @@ public function testAliasFieldRouteException() { * @covers ::normalize */ public function testNormalizeConfig() { - list($request, $resource_type) = $this->generateProphecies('node_type', 'node_type', 'id'); + [$request, $resource_type] = $this->generateProphecies('node_type', 'node_type', 'id'); $resource_object = ResourceObject::createFromEntity($resource_type, $this->nodeType); $document_wrapper = new JsonApiDocumentTopLevel(new ResourceObjectData([$resource_object], 1), new NullIncludedData(), new LinkCollection([])); @@ -532,7 +532,7 @@ public function testNormalizeConfig() { public function testDenormalize() { $payload = '{"data":{"type":"article","attributes":{"title":"Testing article"}}}'; - list($request, $resource_type) = $this->generateProphecies('node', 'article', 'id'); + [$request, $resource_type] = $this->generateProphecies('node', 'article', 'id'); $node = $this ->getNormalizer() ->denormalize(Json::decode($payload), NULL, 'api_json', [ @@ -598,10 +598,10 @@ public function testDenormalizeUuid() { ]; foreach ($configurations as $configuration) { - list($payload_data, $expected) = $this->denormalizeUuidProviderBuilder($configuration); + [$payload_data, $expected] = $this->denormalizeUuidProviderBuilder($configuration); $payload = Json::encode($payload_data); - list($request, $resource_type) = $this->generateProphecies('node', 'article'); + [$request, $resource_type] = $this->generateProphecies('node', 'article'); $this->container->get('request_stack')->push($request); try { $node = $this @@ -671,7 +671,7 @@ public function testDenormalizeInvalidTypeAndNoType() { // Test relationship member with invalid type. $payload = Json::encode($payload_data); - list($request, $resource_type) = $this->generateProphecies('node', 'article'); + [$request, $resource_type] = $this->generateProphecies('node', 'article'); $this->container->get('request_stack')->push($request); try { $this @@ -690,7 +690,7 @@ public function testDenormalizeInvalidTypeAndNoType() { unset($payload_data['data']['relationships']['field_tags']['data'][0]['type']); $payload = Json::encode($payload_data); - list($request, $resource_type) = $this->generateProphecies('node', 'article'); + [$request, $resource_type] = $this->generateProphecies('node', 'article'); $this->container->get('request_stack')->push($request); try { $this->container->get('jsonapi_test_normalizers_kernel.jsonapi_document_toplevel') @@ -715,9 +715,9 @@ public function testDenormalizeInvalidTypeAndNoType() { * The test data. */ protected function denormalizeUuidProviderBuilder(array $options) { - list($input, $expected) = $options; - list($input_tag_uuids, $input_user_uuid) = $input; - list($expected_tag_ids, $expected_user_id) = $expected; + [$input, $expected] = $options; + [$input_tag_uuids, $input_user_uuid] = $input; + [$expected_tag_ids, $expected_user_id] = $expected; $node = [ [ @@ -773,7 +773,7 @@ protected function denormalizeUuidProviderBuilder(array $options) { * @dataProvider testCacheableMetadataProvider */ public function testCacheableMetadata(CacheableMetadata $expected_metadata, $fields = NULL, $includes = NULL) { - list($request, $resource_type) = $this->generateProphecies('node', 'article'); + [$request, $resource_type] = $this->generateProphecies('node', 'article'); $resource_object = ResourceObject::createFromEntity($resource_type, $this->node); $context = [ 'resource_type' => $resource_type, diff --git a/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php b/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php index 2dcafb191df2..e6c1c566cfaa 100644 --- a/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php +++ b/core/modules/jsonapi/tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php @@ -190,7 +190,7 @@ public function validateResponseProvider() { ]; $test_cases = array_map(function ($input) use ($defaults) { - list($json, $expected, $description, $route_name, $resource_type) = array_values($input + $defaults); + [$json, $expected, $description, $route_name, $resource_type] = array_values($input + $defaults); return [ $this->createRequest($route_name, $resource_type), $this->createResponse($json), diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php index 7436a3f3a010..48ee5e028b5c 100644 --- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php +++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php @@ -164,7 +164,7 @@ public function processOutbound($path, &$options = [], Request $request = NULL, // In case either the original base URL or the HTTP host contains a // port, retain it. if (isset($normalized_base_url) && strpos($normalized_base_url, ':') !== FALSE) { - list(, $port) = explode(':', $normalized_base_url); + [, $port] = explode(':', $normalized_base_url); $options['base_url'] .= ':' . $port; } elseif (($url_scheme == 'http' && $port != 80) || ($url_scheme == 'https' && $port != 443)) { diff --git a/core/modules/language/src/Plugin/migrate/process/ContentTranslationEnabledSetting.php b/core/modules/language/src/Plugin/migrate/process/ContentTranslationEnabledSetting.php index 15a953897a2e..513b93343f90 100644 --- a/core/modules/language/src/Plugin/migrate/process/ContentTranslationEnabledSetting.php +++ b/core/modules/language/src/Plugin/migrate/process/ContentTranslationEnabledSetting.php @@ -29,7 +29,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable throw new MigrateException('Input should be an array'); } - list($language_content_type, $entity_translation_entity_types, $entity_type) = $value; + [$language_content_type, $entity_translation_entity_types, $entity_type] = $value; switch ($language_content_type) { // In the case of being 0, it will be skipped. We are not actually setting diff --git a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php index 1f5ec54495a3..98a2bd4352fb 100644 --- a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php +++ b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php @@ -97,7 +97,7 @@ protected function doTestLanguageBlockAuthenticated($block_label) { $labels = []; foreach ($language_switchers as $list_item) { $classes = explode(" ", $list_item->getAttribute('class')); - list($langcode) = array_intersect($classes, ['en', 'fr']); + [$langcode] = array_intersect($classes, ['en', 'fr']); $list_items[] = [ 'langcode_class' => $langcode, 'data-drupal-link-system-path' => $list_item->getAttribute('data-drupal-link-system-path'), @@ -156,7 +156,7 @@ protected function doTestLanguageBlockAnonymous($block_label) { $labels = []; foreach ($language_switchers as $list_item) { $classes = explode(" ", $list_item->getAttribute('class')); - list($langcode) = array_intersect($classes, ['en', 'fr']); + [$langcode] = array_intersect($classes, ['en', 'fr']); if (in_array('is-active', $classes)) { $links['active'][] = $langcode; } diff --git a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php index 8d8b6711bd62..31a2c1c48acb 100644 --- a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php +++ b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php @@ -240,7 +240,7 @@ public function providerIsDefaultConfiguration() { * @dataProvider providerLoadByEntityTypeBundle */ public function testLoadByEntityTypeBundle($config_id, ContentLanguageSettings $existing_config = NULL, $expected_langcode, $expected_language_alterable) { - list($type, $bundle) = explode('.', $config_id); + [$type, $bundle] = explode('.', $config_id); $nullConfig = new ContentLanguageSettings([ 'target_entity_type_id' => $type, diff --git a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php index c0794f9e2707..70e86f699913 100644 --- a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php +++ b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php @@ -504,7 +504,7 @@ private function getQuickEditSectionComponent() { // Builder component. It follows the structure prescribed by the // documentation of hook_quickedit_render_field(). if (count($parts) === 6 && $parts[0] === 'layout_builder') { - list(, $delta, $component_uuid, $entity_id) = QuickEditIntegration::deconstructViewModeId($original_mode); + [, $delta, $component_uuid, $entity_id] = QuickEditIntegration::deconstructViewModeId($original_mode); $entity = $this->entityTypeManager()->getStorage($this->getTargetEntityTypeId())->load($entity_id); $sections = $this->getEntitySections($entity); if (isset($sections[$delta])) { @@ -539,7 +539,7 @@ private function getSectionComponentForFieldName($field_name) { if ($plugin instanceof DerivativeInspectionInterface && in_array($plugin->getBaseId(), ['field_block', 'extra_field_block'], TRUE)) { // FieldBlock derivative IDs are in the format // [entity_type]:[bundle]:[field]. - list(, , $field_block_field_name) = explode(PluginBase::DERIVATIVE_SEPARATOR, $plugin->getDerivativeId()); + [, , $field_block_field_name] = explode(PluginBase::DERIVATIVE_SEPARATOR, $plugin->getDerivativeId()); if ($field_block_field_name === $field_name) { return $component; } diff --git a/core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php b/core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php index 56875deb35f1..35c9ee905d89 100644 --- a/core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php +++ b/core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php @@ -72,7 +72,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition $this->entityTypeManager = $entity_type_manager; $this->entityFieldManager = $entity_field_manager; // Get field name from the plugin ID. - list (, , , $field_name) = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 4); + [, , , $field_name] = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 4); assert(!empty($field_name)); $this->fieldName = $field_name; diff --git a/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php b/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php index 80d9b97315bf..b3b7b919ae2e 100644 --- a/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php +++ b/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php @@ -118,7 +118,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition $this->logger = $logger; // Get the entity type and field name from the plugin ID. - list (, $entity_type_id, $bundle, $field_name) = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 4); + [, $entity_type_id, $bundle, $field_name] = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 4); $this->entityTypeId = $entity_type_id; $this->bundle = $bundle; $this->fieldName = $field_name; diff --git a/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php b/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php index 140a91213cc6..dc0f35707b41 100644 --- a/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php +++ b/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php @@ -261,7 +261,7 @@ private function extractEntityFromRoute($value, array $defaults) { } if (is_string($value) && strpos($value, '.') !== FALSE) { - list($entity_type_id, $bundle, $view_mode) = explode('.', $value, 3); + [$entity_type_id, $bundle, $view_mode] = explode('.', $value, 3); } elseif (!empty($defaults['entity_type_id']) && !empty($defaults['bundle']) && !empty($defaults['view_mode_name'])) { $entity_type_id = $defaults['entity_type_id']; diff --git a/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php b/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php index d6c0729643a7..219a3c6a0a84 100644 --- a/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php +++ b/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php @@ -195,7 +195,7 @@ public function deriveContextsFromRoute($value, $definition, $name, array $defau */ private function extractEntityFromRoute($value, array $defaults) { if (strpos($value, '.') !== FALSE) { - list($entity_type_id, $entity_id) = explode('.', $value, 2); + [$entity_type_id, $entity_id] = explode('.', $value, 2); } elseif (isset($defaults['entity_type_id']) && !empty($defaults[$defaults['entity_type_id']])) { $entity_type_id = $defaults['entity_type_id']; diff --git a/core/modules/layout_builder/src/QuickEditIntegration.php b/core/modules/layout_builder/src/QuickEditIntegration.php index 9ee5045fbda9..c087f90971f5 100644 --- a/core/modules/layout_builder/src/QuickEditIntegration.php +++ b/core/modules/layout_builder/src/QuickEditIntegration.php @@ -219,7 +219,7 @@ private static function getViewModeId(EntityInterface $entity, EntityViewDisplay * @see \Drupal\layout_builder\QuickEditIntegration::getViewModeId() */ public static function deconstructViewModeId($quick_edit_view_mode_id) { - list(, $entity_view_mode_id, $delta, $component_uuid, $entity_id) = explode('-', $quick_edit_view_mode_id, 7); + [, $entity_view_mode_id, $delta, $component_uuid, $entity_id] = explode('-', $quick_edit_view_mode_id, 7); return [ $entity_view_mode_id, // @todo Explicitly cast delta to an integer, remove this in @@ -247,7 +247,7 @@ public static function deconstructViewModeId($quick_edit_view_mode_id) { * The re-rendered field. */ public function quickEditRenderField(FieldableEntityInterface $entity, $field_name, $quick_edit_view_mode_id, $langcode) { - list($entity_view_mode, $delta, $component_uuid) = static::deconstructViewModeId($quick_edit_view_mode_id); + [$entity_view_mode, $delta, $component_uuid] = static::deconstructViewModeId($quick_edit_view_mode_id); $entity_build = $this->entityTypeManager->getViewBuilder($entity->getEntityTypeId())->view($entity, $entity_view_mode, $langcode); $this->buildEntityView($entity_build); diff --git a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php index 721841f1ae4a..8c6816d8dede 100644 --- a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php +++ b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php @@ -71,7 +71,7 @@ protected static function getUriAsDisplayableString($uri) { $displayable_string = $uri_reference; } elseif ($scheme === 'entity') { - list($entity_type, $entity_id) = explode('/', substr($uri, 7), 2); + [$entity_type, $entity_id] = explode('/', substr($uri, 7), 2); // Show the 'entity:' URI as the entity autocomplete would. // @todo Support entity types other than 'node'. Will be fixed in // https://www.drupal.org/node/2423093. diff --git a/core/modules/link/tests/src/Functional/LinkFieldUITest.php b/core/modules/link/tests/src/Functional/LinkFieldUITest.php index 4b485c2955d6..7045a04fa3d7 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldUITest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldUITest.php @@ -74,7 +74,7 @@ protected function setUp(): void { */ public function testFieldUI() { foreach ($this->providerTestFieldUI() as $item) { - list($cardinality, $link_type, $title, $label, $field_name, $default_uri) = $item; + [$cardinality, $link_type, $title, $label, $field_name, $default_uri] = $item; $this->runFieldUIItem($cardinality, $link_type, $title, $label, $field_name, $default_uri); } } diff --git a/core/modules/locale/src/Plugin/QueueWorker/LocaleTranslation.php b/core/modules/locale/src/Plugin/QueueWorker/LocaleTranslation.php index 2d07fab3d6a5..0d73a2995c0f 100644 --- a/core/modules/locale/src/Plugin/QueueWorker/LocaleTranslation.php +++ b/core/modules/locale/src/Plugin/QueueWorker/LocaleTranslation.php @@ -80,7 +80,7 @@ public static function create(ContainerInterface $container, array $configuratio */ public function processItem($data) { $this->moduleHandler->loadInclude('locale', 'batch.inc'); - list($function, $args) = $data; + [$function, $args] = $data; // We execute batch operation functions here to check, download and import // the translation files. Batch functions use a context variable as last diff --git a/core/modules/locale/src/PoDatabaseWriter.php b/core/modules/locale/src/PoDatabaseWriter.php index aab9c72c1a3c..6763a79e675c 100644 --- a/core/modules/locale/src/PoDatabaseWriter.php +++ b/core/modules/locale/src/PoDatabaseWriter.php @@ -177,7 +177,7 @@ public function setHeader(PoHeader $header) { // Get and store the plural formula if available. $plural = $header->getPluralForms(); if (isset($plural) && $p = $header->parsePluralForms($plural)) { - list($nplurals, $formula) = $p; + [$nplurals, $formula] = $p; \Drupal::service('locale.plural.formula')->setPluralFormula($langcode, $nplurals, $formula); } } diff --git a/core/modules/media/src/OEmbed/ResourceFetcher.php b/core/modules/media/src/OEmbed/ResourceFetcher.php index 05a6b2d0adc5..39e7dd147f67 100644 --- a/core/modules/media/src/OEmbed/ResourceFetcher.php +++ b/core/modules/media/src/OEmbed/ResourceFetcher.php @@ -74,7 +74,7 @@ public function fetchResource($url) { throw new ResourceException('Could not retrieve the oEmbed resource.', $url, [], $e); } - list($format) = $response->getHeader('Content-Type'); + [$format] = $response->getHeader('Content-Type'); $content = (string) $response->getBody(); if (strstr($format, 'text/xml') || strstr($format, 'application/xml')) { diff --git a/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php b/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php index a7525c0ddc3d..6bffb46a373f 100644 --- a/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php +++ b/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php @@ -111,7 +111,7 @@ public function buildEntity(array $form, FormStateInterface $form_state) { /** @var \Drupal\menu_link_content\MenuLinkContentInterface $entity */ $entity = parent::buildEntity($form, $form_state); - list($menu_name, $parent) = explode(':', $form_state->getValue('menu_parent'), 2); + [$menu_name, $parent] = explode(':', $form_state->getValue('menu_parent'), 2); $entity->parent->value = $parent; $entity->menu_name->value = $menu_name; diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module index aaa740624153..ad49bf10f701 100644 --- a/core/modules/menu_ui/menu_ui.module +++ b/core/modules/menu_ui/menu_ui.module @@ -331,7 +331,7 @@ function menu_ui_form_node_form_submit($form, FormStateInterface $form_state) { // Decompose the selected menu parent option into 'menu_name' and 'parent', // if the form used the default parent selection widget. if (!empty($values['menu_parent'])) { - list($menu_name, $parent) = explode(':', $values['menu_parent'], 2); + [$menu_name, $parent] = explode(':', $values['menu_parent'], 2); $values['menu_name'] = $menu_name; $values['parent'] = $parent; } diff --git a/core/modules/menu_ui/src/Plugin/Validation/Constraint/MenuSettingsConstraintValidator.php b/core/modules/menu_ui/src/Plugin/Validation/Constraint/MenuSettingsConstraintValidator.php index 3fa8f2695cbb..2f6d6f85341a 100644 --- a/core/modules/menu_ui/src/Plugin/Validation/Constraint/MenuSettingsConstraintValidator.php +++ b/core/modules/menu_ui/src/Plugin/Validation/Constraint/MenuSettingsConstraintValidator.php @@ -25,7 +25,7 @@ public function validate($entity, Constraint $constraint) { } if (trim($values['title']) && !empty($values['menu_parent'])) { - list($menu_name, $parent) = explode(':', $values['menu_parent'], 2); + [$menu_name, $parent] = explode(':', $values['menu_parent'], 2); $values['menu_name'] = $menu_name; $values['parent'] = $parent; } diff --git a/core/modules/menu_ui/tests/src/Traits/MenuUiTrait.php b/core/modules/menu_ui/tests/src/Traits/MenuUiTrait.php index c4718235102d..0d0d14bf0d75 100644 --- a/core/modules/menu_ui/tests/src/Traits/MenuUiTrait.php +++ b/core/modules/menu_ui/tests/src/Traits/MenuUiTrait.php @@ -28,7 +28,7 @@ protected function assertMenuLink(array $expected_item, $menu_plugin_id) { // Pull the path from the menu link content. if (strpos($menu_plugin_id, 'menu_link_content') === 0) { - list(, $uuid) = explode(':', $menu_plugin_id, 2); + [, $uuid] = explode(':', $menu_plugin_id, 2); /** @var \Drupal\menu_link_content\Entity\MenuLinkContent $entity */ $entity = \Drupal::service('entity.repository') ->loadEntityByUuid('menu_link_content', $uuid); diff --git a/core/modules/migrate/src/EntityFieldDefinitionTrait.php b/core/modules/migrate/src/EntityFieldDefinitionTrait.php index bc8af81909b9..37446d23b809 100644 --- a/core/modules/migrate/src/EntityFieldDefinitionTrait.php +++ b/core/modules/migrate/src/EntityFieldDefinitionTrait.php @@ -48,7 +48,7 @@ protected function getDefinitionFromEntity($key) { protected static function getEntityTypeId($plugin_id) { $entity_type_id = NULL; if (strpos($plugin_id, static::DERIVATIVE_SEPARATOR)) { - list(, $entity_type_id) = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2); + [, $entity_type_id] = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2); } return $entity_type_id; } diff --git a/core/modules/migrate/src/Plugin/migrate/process/Download.php b/core/modules/migrate/src/Plugin/migrate/process/Download.php index aedb204d410a..a2832b66e8a7 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/Download.php +++ b/core/modules/migrate/src/Plugin/migrate/process/Download.php @@ -117,7 +117,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable if ($row->isStub()) { return NULL; } - list($source, $destination) = $value; + [$source, $destination] = $value; // Modify the destination filename if necessary. $final_destination = $this->fileSystem->getDestinationFilename($destination, $this->configuration['file_exists']); diff --git a/core/modules/migrate/src/Plugin/migrate/process/FileCopy.php b/core/modules/migrate/src/Plugin/migrate/process/FileCopy.php index 65b5c8ec7735..f4d006c09190 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/FileCopy.php +++ b/core/modules/migrate/src/Plugin/migrate/process/FileCopy.php @@ -123,7 +123,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable if ($row->isStub()) { return NULL; } - list($source, $destination) = $value; + [$source, $destination] = $value; // If the source path or URI represents a remote resource, delegate to the // download plugin. diff --git a/core/modules/migrate/src/Plugin/migrate/process/Route.php b/core/modules/migrate/src/Plugin/migrate/process/Route.php index ebb9a4d6fddd..63c10200727f 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/Route.php +++ b/core/modules/migrate/src/Plugin/migrate/process/Route.php @@ -97,7 +97,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable $options = []; } else { - list($link_path, $options) = $value; + [$link_path, $options] = $value; } $extracted = $this->pathValidator->getUrlIfValidWithoutAccessCheck($link_path); diff --git a/core/modules/migrate/tests/src/Kernel/QueryBatchTest.php b/core/modules/migrate/tests/src/Kernel/QueryBatchTest.php index 86dd2059dc88..7844e4144dc3 100644 --- a/core/modules/migrate/tests/src/Kernel/QueryBatchTest.php +++ b/core/modules/migrate/tests/src/Kernel/QueryBatchTest.php @@ -100,7 +100,7 @@ public function queryDataProvider() { $tests = []; $data_set = 0; foreach ($test_parameters as $data) { - list($num_rows, $batch_size) = $data; + [$num_rows, $batch_size] = $data; for ($i = 0; $i < $num_rows; $i++) { $tests[$data_set]['source_data'][$table][] = [ 'id' => $i, diff --git a/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php b/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php index 1d94110e6e96..ae52f6c6fe7a 100644 --- a/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php +++ b/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php @@ -65,7 +65,7 @@ public function testSuccessfulCopies() { ], ]; foreach ($data_sets as $data) { - list($source_path, $destination_path) = $data; + [$source_path, $destination_path] = $data; $actual_destination = $this->doTransform($source_path, $destination_path); $this->assertFileExists($destination_path); // Make sure we didn't accidentally do a move. @@ -149,7 +149,7 @@ public function testSuccessfulMoves() { ], ]; foreach ($data_sets as $data) { - list($source_path, $destination_path) = $data; + [$source_path, $destination_path] = $data; $actual_destination = $this->doTransform($source_path, $destination_path, ['move' => TRUE]); $this->assertFileExists($destination_path); $this->assertFileDoesNotExist($source_path); diff --git a/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php index c148213e5c3a..a6ff0931ea56 100644 --- a/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php +++ b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php @@ -58,7 +58,7 @@ public function testDependencyBuilding($migrations_data, $result_ids) { $requirements = array_combine($requirements, $requirements); $this->assertCount(1, $migration->set); - list($set_prop, $set_requirements) = reset($migration->set); + [$set_prop, $set_requirements] = reset($migration->set); $this->assertEquals('requirements', $set_prop); $this->assertEquals($requirements, $set_requirements); } diff --git a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeFormBase.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeFormBase.php index 30c1091b1008..989b7ee630c0 100644 --- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeFormBase.php +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeFormBase.php @@ -68,7 +68,7 @@ public static function create(ContainerInterface $container) { */ public function buildForm(array $form, FormStateInterface $form_state) { // Get the current major version. - list($this->destinationSiteVersion) = explode('.', \Drupal::VERSION, 2); + [$this->destinationSiteVersion] = explode('.', \Drupal::VERSION, 2); $form = []; $form['actions']['#type'] = 'actions'; $form['actions']['submit'] = [ diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php index 2ce1446efbd1..1d86b61ef8b3 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php @@ -63,7 +63,7 @@ public function testMigrateUpgradeReviewPage() { // form. $session = $this->assertSession(); // Get the current major version. - list($destination_site_version) = explode('.', \Drupal::VERSION, 2); + [$destination_site_version] = explode('.', \Drupal::VERSION, 2); $expected['initial'] = "Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $destination_site_version."; $expected['incremental'] = "An upgrade has already been performed on this site."; diff --git a/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php b/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php index 7d93e7201a58..35203168a544 100644 --- a/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php +++ b/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php @@ -104,7 +104,7 @@ public function onException(ExceptionEvent $event) { $old_nid = $parameters['node']; $collection = $this->keyValue->get('node_translation_redirect'); if ($old_nid && $value = $collection->get($old_nid)) { - list($nid, $langcode) = $value; + [$nid, $langcode] = $value; $language = $this->languageManager->getLanguage($langcode); $url = $this->urlGenerator->generateFromRoute('entity.node.canonical', ['node' => $nid], ['language' => $language]); $response = new RedirectResponse($url, 301); diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php index 5412541a49b7..0342c5f01d29 100644 --- a/core/modules/node/src/Plugin/Search/NodeSearch.php +++ b/core/modules/node/src/Plugin/Search/NodeSearch.php @@ -757,7 +757,7 @@ protected function parseAdvancedDefaults($f, $keys) { // Split out the advanced search parameters. foreach ($f as $advanced) { - list($key, $value) = explode(':', $advanced, 2); + [$key, $value] = explode(':', $advanced, 2); if (!isset($defaults[$key])) { $defaults[$key] = []; } diff --git a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php index 731ba0404589..d96ff7601229 100644 --- a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php +++ b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php @@ -610,7 +610,7 @@ public function testNoUrlNormalization() { ], ]; - foreach ($tests as list($url_raw, $url_normalized)) { + foreach ($tests as [$url_raw, $url_normalized]) { // Initialize cache on raw URL. $headers = $this->getHeaders($url_raw); $this->assertEquals('MISS', $headers['X-Drupal-Cache']); @@ -651,7 +651,7 @@ protected function getHeaders($url) { $headers = []; foreach (explode("\n", $output) as $header) { if (strpos($header, ':')) { - list($key, $value) = explode(':', $header, 2); + [$key, $value] = explode(':', $header, 2); $headers[trim($key)] = trim($value); } } diff --git a/core/modules/quickedit/src/QuickEditController.php b/core/modules/quickedit/src/QuickEditController.php index 455b7bfa6ca3..6a2a794ea2af 100644 --- a/core/modules/quickedit/src/QuickEditController.php +++ b/core/modules/quickedit/src/QuickEditController.php @@ -126,7 +126,7 @@ public function metadata(Request $request) { $metadata = []; foreach ($fields as $field) { - list($entity_type, $entity_id, $field_name, $langcode, $view_mode) = explode('/', $field); + [$entity_type, $entity_id, $field_name, $langcode, $view_mode] = explode('/', $field); // Load the entity. if (!$entity_type || !$this->entityTypeManager()->getDefinition($entity_type)) { diff --git a/core/modules/responsive_image/src/Plugin/migrate/process/ImageStyleMappings.php b/core/modules/responsive_image/src/Plugin/migrate/process/ImageStyleMappings.php index 5e6848380dda..30f40bae9889 100644 --- a/core/modules/responsive_image/src/Plugin/migrate/process/ImageStyleMappings.php +++ b/core/modules/responsive_image/src/Plugin/migrate/process/ImageStyleMappings.php @@ -24,7 +24,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable throw new MigrateException('Input should be an array'); } - list($mappings, $breakpoint_group) = $value; + [$mappings, $breakpoint_group] = $value; $new_value = []; foreach ($mappings as $mapping_id => $mapping) { diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index e3df96112dc1..40c401bdf802 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -999,7 +999,7 @@ public function testPatch() { // DX: 403 when sending PATCH request with updated read-only fields. $this->assertPatchProtectedFieldNamesStructure(); - list($modified_entity, $original_values) = static::getModifiedEntityForPatchTesting($this->entity); + [$modified_entity, $original_values] = static::getModifiedEntityForPatchTesting($this->entity); // Send PATCH request by serializing the modified entity, assert the error // response, change the modified entity field that caused the error response // back to its original value, repeat. diff --git a/core/modules/search/src/SearchIndex.php b/core/modules/search/src/SearchIndex.php index df6005685c8b..1334992e452a 100644 --- a/core/modules/search/src/SearchIndex.php +++ b/core/modules/search/src/SearchIndex.php @@ -117,7 +117,7 @@ public function index($type, $sid, $langcode, $text, $update_weights = TRUE) { foreach ($split as $value) { if ($tag) { // Increase or decrease score per word based on tag. - list($tagname) = explode(' ', $value, 2); + [$tagname] = explode(' ', $value, 2); $tagname = mb_strtolower($tagname); // Closing or opening tag? if ($tagname[0] == '/') { diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php index 92a1e10a74b3..6869da434f71 100644 --- a/core/modules/search/src/SearchQuery.php +++ b/core/modules/search/src/SearchQuery.php @@ -316,7 +316,7 @@ protected function parseSearchExpression() { $has_new_scores = FALSE; $queryor = $this->connection->condition('OR'); foreach ($key as $or) { - list($num_new_scores) = $this->parseWord($or); + [$num_new_scores] = $this->parseWord($or); $has_new_scores |= $num_new_scores; $queryor->condition('d.data', "% $or %", 'LIKE'); } @@ -329,7 +329,7 @@ protected function parseSearchExpression() { // Single ANDed term. else { $has_and = TRUE; - list($num_new_scores, $num_valid_words) = $this->parseWord($key); + [$num_new_scores, $num_valid_words] = $this->parseWord($key); $this->conditions->condition('d.data', "% $key %", 'LIKE'); if (!$num_valid_words) { $this->simple = FALSE; diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 65fb20a62b06..2c166df999e4 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -88,7 +88,7 @@ function template_preprocess_system_admin_index(&$variables) { $stripe = 0; // Iterate over all modules. foreach ($variables['menu_items'] as $module => $block) { - list($description, $items) = $block; + [$description, $items] = $block; $position = ++$stripe % 2 ? 'left' : 'right'; // Output links. if (count($items)) { diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 1295b6d18b3f..522159f005a9 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -605,7 +605,7 @@ function system_page_attachments(array &$page) { } // Get the major Drupal version. - list($version,) = explode('.', \Drupal::VERSION); + [$version] = explode('.', \Drupal::VERSION); // Attach default meta tags. $meta_default = [ diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectColspanForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectColspanForm.php index becce376f282..3d0277cd76fc 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectColspanForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectColspanForm.php @@ -22,7 +22,7 @@ public function getFormId() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { - list($header, $options) = _form_test_tableselect_get_data(); + [$header, $options] = _form_test_tableselect_get_data(); // Change the data so that the third column has colspan=2. $header['three'] = ['data' => 'Three', 'colspan' => 2]; diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php index af41782cb3e1..356b1d8ab6be 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectFormBase.php @@ -26,7 +26,7 @@ abstract class FormTestTableSelectFormBase extends FormBase { * A form with a tableselect element and a submit button. */ public function tableselectFormBuilder($form, FormStateInterface $form_state, $element_properties) { - list($header, $options) = _form_test_tableselect_get_data(); + [$header, $options] = _form_test_tableselect_get_data(); $form['tableselect'] = $element_properties; diff --git a/core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php b/core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php index e8fde75693f5..402ac866622e 100644 --- a/core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php +++ b/core/modules/system/tests/src/Functional/Ajax/FrameworkTest.php @@ -58,7 +58,7 @@ public function testOrder() { $build['#attached']['library'][] = 'ajax_test/order-header-js-command'; $build['#attached']['library'][] = 'ajax_test/order-footer-js-command'; $assets = AttachedAssets::createFromRenderArray($build); - list($js_assets_header, $js_assets_footer) = $asset_resolver->getJsAssets($assets, FALSE); + [$js_assets_header, $js_assets_footer] = $asset_resolver->getJsAssets($assets, FALSE); $js_header_render_array = $js_collection_renderer->render($js_assets_header); $js_footer_render_array = $js_collection_renderer->render($js_assets_footer); $expected_commands[2] = new PrependCommand('head', $js_header_render_array); diff --git a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php index e5b8dc2494a4..9c17f03c7ca8 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php @@ -91,10 +91,10 @@ protected function setUp() { } // Create a referencing and a non-referencing entity. - list( + [ $this->referencingEntity, $this->nonReferencingEntity, - ) = $this->createReferenceTestEntities($this->entity); + ] = $this->createReferenceTestEntities($this->entity); } /** diff --git a/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php b/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php index 7643dda23b27..76be86fcac4a 100644 --- a/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php +++ b/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php @@ -156,7 +156,7 @@ public function testAdvancedSelect() { */ public function testMultipleTrueOptionchecker() { - list($header, $options) = _form_test_tableselect_get_data(); + [$header, $options] = _form_test_tableselect_get_data(); $form['tableselect'] = [ '#type' => 'tableselect', @@ -165,11 +165,11 @@ public function testMultipleTrueOptionchecker() { ]; // Test with a valid value. - list(, , $errors) = $this->formSubmitHelper($form, ['tableselect' => ['row1' => 'row1']]); + [, , $errors] = $this->formSubmitHelper($form, ['tableselect' => ['row1' => 'row1']]); $this->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for checkboxes.'); // Test with an invalid value. - list(, , $errors) = $this->formSubmitHelper($form, ['tableselect' => ['non_existing_value' => 'non_existing_value']]); + [, , $errors] = $this->formSubmitHelper($form, ['tableselect' => ['non_existing_value' => 'non_existing_value']]); $this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for checkboxes.'); } @@ -180,7 +180,7 @@ public function testMultipleTrueOptionchecker() { */ public function testMultipleFalseOptionchecker() { - list($header, $options) = _form_test_tableselect_get_data(); + [$header, $options] = _form_test_tableselect_get_data(); $form['tableselect'] = [ '#type' => 'tableselect', @@ -190,11 +190,11 @@ public function testMultipleFalseOptionchecker() { ]; // Test with a valid value. - list(, , $errors) = $this->formSubmitHelper($form, ['tableselect' => 'row1']); + [, , $errors] = $this->formSubmitHelper($form, ['tableselect' => 'row1']); $this->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for radio buttons.'); // Test with an invalid value. - list(, , $errors) = $this->formSubmitHelper($form, ['tableselect' => 'non_existing_value']); + [, , $errors] = $this->formSubmitHelper($form, ['tableselect' => 'non_existing_value']); $this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for radio buttons.'); } diff --git a/core/modules/system/tests/src/Functional/Menu/LocalActionTest.php b/core/modules/system/tests/src/Functional/Menu/LocalActionTest.php index bf313a301893..fcea5966ad92 100644 --- a/core/modules/system/tests/src/Functional/Menu/LocalActionTest.php +++ b/core/modules/system/tests/src/Functional/Menu/LocalActionTest.php @@ -78,7 +78,7 @@ protected function assertLocalAction(array $actions) { $index = 0; foreach ($actions as $action) { /** @var \Drupal\Core\Url $url */ - list($url, $title) = $action; + [$url, $title] = $action; // SimpleXML gives us the unescaped text, not the actual escaped markup, // so use a pattern instead to check the raw content. // This behavior is a bug in libxml, see diff --git a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php index 0c4524dfde4f..7c74f5aaedf8 100644 --- a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php +++ b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php @@ -58,7 +58,7 @@ protected function assertLocalTasks(array $routes, $level = 0) { ]); $this->assertGreaterThan(0, count($elements), 'Local tasks found.'); foreach ($routes as $index => $route_info) { - list($route_name, $route_parameters) = $route_info; + [$route_name, $route_parameters] = $route_info; $expected = Url::fromRoute($route_name, $route_parameters)->toString(); $this->assertEquals($expected, $elements[$index]->getAttribute('href'), "Task " . ($index + 1) . "number href " . $elements[$index]->getAttribute('href') . " equals $expected."); } diff --git a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php index 04ea17f6d171..9b6a3cb856f3 100644 --- a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php @@ -293,7 +293,7 @@ protected function assertInstallModuleUpdates($module) { $all_update_functions = $post_update_registry->getPendingUpdateFunctions(); $empty_result = TRUE; foreach ($all_update_functions as $function) { - list($function_module,) = explode('_post_update_', $function); + [$function_module] = explode('_post_update_', $function); if ($module === $function_module) { $empty_result = FALSE; break; diff --git a/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php b/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php index 187a82c9857f..bcce6148bf90 100644 --- a/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php +++ b/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php @@ -20,7 +20,7 @@ class AdminMetaTagTest extends BrowserTestBase { * Verify that the meta tag HTML is generated correctly. */ public function testMetaTag() { - list($version,) = explode('.', \Drupal::VERSION); + [$version] = explode('.', \Drupal::VERSION); $string = '<meta name="Generator" content="Drupal ' . $version . ' (https://www.drupal.org)" />'; $this->drupalGet('node'); $this->assertSession()->responseContains($string); diff --git a/core/modules/system/tests/src/Functional/System/ResponseGeneratorTest.php b/core/modules/system/tests/src/Functional/System/ResponseGeneratorTest.php index db6039fed133..38d842dddf30 100644 --- a/core/modules/system/tests/src/Functional/System/ResponseGeneratorTest.php +++ b/core/modules/system/tests/src/Functional/System/ResponseGeneratorTest.php @@ -42,7 +42,7 @@ public function testGeneratorHeaderAdded() { $node = $this->drupalCreateNode(); - list($version) = explode('.', \Drupal::VERSION, 2); + [$version] = explode('.', \Drupal::VERSION, 2); $expectedGeneratorHeader = 'Drupal ' . $version . ' (https://www.drupal.org)'; // Check to see if the header is added when viewing a normal content page diff --git a/core/modules/system/tests/src/Kernel/Common/UrlTest.php b/core/modules/system/tests/src/Kernel/Common/UrlTest.php index 295fb1ecaae3..447d056e3a01 100644 --- a/core/modules/system/tests/src/Kernel/Common/UrlTest.php +++ b/core/modules/system/tests/src/Kernel/Common/UrlTest.php @@ -59,7 +59,7 @@ public function testLinkBubbleableMetadata() { ]; foreach ($cases as $case) { - list($title, $uri, $options, $expected_cacheability, $expected_attachments) = $case; + [$title, $uri, $options, $expected_cacheability, $expected_attachments] = $case; $expected_cacheability['contexts'] = Cache::mergeContexts($expected_cacheability['contexts'], ['languages:language_interface', 'theme', 'user.permissions']); $link = [ '#type' => 'link', diff --git a/core/modules/system/tests/src/Kernel/Mail/MailTest.php b/core/modules/system/tests/src/Kernel/Mail/MailTest.php index c6c254569480..1eed7c500777 100644 --- a/core/modules/system/tests/src/Kernel/Mail/MailTest.php +++ b/core/modules/system/tests/src/Kernel/Mail/MailTest.php @@ -305,7 +305,7 @@ public function testRenderedElementsUseAbsolutePaths() { // Test images. foreach ($path_pairs as $test_type => $paths) { - list($input_path, $expected_path) = $paths; + [$input_path, $expected_path] = $paths; // Reset the state variable that holds sent messages. \Drupal::state()->set('system.test_mail_collector', []); @@ -336,7 +336,7 @@ public function testRenderedElementsUseAbsolutePaths() { ]; foreach ($path_pairs as $paths) { - list($input_path, $expected_path) = $paths; + [$input_path, $expected_path] = $paths; // Reset the state variable that holds sent messages. \Drupal::state()->set('system.test_mail_collector', []); diff --git a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php index a3275470d4a0..fce63ffde228 100644 --- a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php +++ b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php @@ -193,7 +193,7 @@ public function providerTestBuildCacheability() { ]; for ($i = 0; $i < count($access_scenarios); $i++) { - list($access, $access_cache_contexts) = $access_scenarios[$i]; + [$access, $access_cache_contexts] = $access_scenarios[$i]; for ($j = 0; $j < count($links_scenarios); $j++) { $links = $links_scenarios[$j]; diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php index e41a918cfe02..99d4a1e74957 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php @@ -443,7 +443,7 @@ public function testTermReorder() { // Fetch the created terms in the default alphabetical order, i.e. term1 // precedes term2 alphabetically, and term2 precedes term3. $taxonomy_storage->resetCache(); - list($term1, $term2, $term3) = $taxonomy_storage->loadTree($this->vocabulary->id(), 0, NULL, TRUE); + [$term1, $term2, $term3] = $taxonomy_storage->loadTree($this->vocabulary->id(), 0, NULL, TRUE); $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview'); diff --git a/core/modules/toolbar/src/Controller/ToolbarController.php b/core/modules/toolbar/src/Controller/ToolbarController.php index c94e35b307b0..75986f901b0f 100644 --- a/core/modules/toolbar/src/Controller/ToolbarController.php +++ b/core/modules/toolbar/src/Controller/ToolbarController.php @@ -21,7 +21,7 @@ class ToolbarController extends ControllerBase implements TrustedCallbackInterfa * @return \Drupal\Core\Ajax\AjaxResponse */ public function subtreesAjax() { - list($subtrees, $cacheability) = toolbar_get_rendered_subtrees(); + [$subtrees, $cacheability] = toolbar_get_rendered_subtrees(); $response = new AjaxResponse(); $response->addCommand(new SetSubtreesCommand($subtrees)); diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 5451dcb75156..a1def5da6892 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -164,7 +164,7 @@ function toolbar_toolbar() { // toolbar_subtrees route. We provide the JavaScript requesting that JSONP // script here with the hash parameter that is needed for that route. // @see toolbar_subtrees_jsonp() - list($hash, $hash_cacheability) = _toolbar_get_subtrees_hash(); + [$hash, $hash_cacheability] = _toolbar_get_subtrees_hash(); $subtrees_attached['drupalSettings']['toolbar'] = [ 'subtreesHash' => $hash, ]; @@ -286,7 +286,7 @@ function toolbar_get_rendered_subtrees() { * The hash of the admin_menu subtrees. */ function _toolbar_get_subtrees_hash() { - list($subtrees, $cacheability) = toolbar_get_rendered_subtrees(); + [$subtrees, $cacheability] = toolbar_get_rendered_subtrees(); $hash = Crypt::hashBase64(serialize($subtrees)); return [$hash, $cacheability]; } diff --git a/core/modules/update/src/ProjectSecurityRequirement.php b/core/modules/update/src/ProjectSecurityRequirement.php index b14acf5af741..440be9222fd4 100644 --- a/core/modules/update/src/ProjectSecurityRequirement.php +++ b/core/modules/update/src/ProjectSecurityRequirement.php @@ -97,7 +97,7 @@ public static function createFromProjectDataAndSecurityCoverageInfo(array $proje return new static(); } if (isset($project_data['existing_version'])) { - list($major, $minor) = explode('.', $project_data['existing_version']); + [$major, $minor] = explode('.', $project_data['existing_version']); $existing_version = "$major.$minor"; $next_version = "$major." . ((int) $minor + 1); return new static($project_data['title'], $security_coverage_info, $existing_version, $next_version); diff --git a/core/modules/user/src/AccountForm.php b/core/modules/user/src/AccountForm.php index 7f51ad6fc43f..34e5d401a4bc 100644 --- a/core/modules/user/src/AccountForm.php +++ b/core/modules/user/src/AccountForm.php @@ -418,7 +418,7 @@ protected function flagViolations(EntityConstraintViolationListInterface $violat 'preferred_admin_langcode', ]; foreach ($violations->getByFields($field_names) as $violation) { - list($field_name) = explode('.', $violation->getPropertyPath(), 2); + [$field_name] = explode('.', $violation->getPropertyPath(), 2); $form_state->setErrorByName($field_name, $violation->getMessage()); } parent::flagViolations($violations, $form, $form_state); diff --git a/core/modules/user/src/Event/UserFloodEvent.php b/core/modules/user/src/Event/UserFloodEvent.php index c45bf80adc33..c62cb3da57a3 100644 --- a/core/modules/user/src/Event/UserFloodEvent.php +++ b/core/modules/user/src/Event/UserFloodEvent.php @@ -74,7 +74,7 @@ public function __construct($name, $threshold, $window, $identifier) { return; } if (strpos($identifier, '-') !== FALSE) { - list($uid, $ip) = explode('-', $identifier); + [$uid, $ip] = explode('-', $identifier); $this->uid = $uid; $this->ip = $ip; return; diff --git a/core/modules/user/src/Plugin/migrate/process/d6/ProfileFieldOptionTranslation.php b/core/modules/user/src/Plugin/migrate/process/d6/ProfileFieldOptionTranslation.php index fb9874339302..7087dc4e80b8 100644 --- a/core/modules/user/src/Plugin/migrate/process/d6/ProfileFieldOptionTranslation.php +++ b/core/modules/user/src/Plugin/migrate/process/d6/ProfileFieldOptionTranslation.php @@ -20,7 +20,7 @@ class ProfileFieldOptionTranslation extends ProcessPluginBase { * {@inheritdoc} */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - list($field_type, $translation) = $value; + [$field_type, $translation] = $value; $new_value = NULL; if (isset($translation)) { diff --git a/core/modules/user/tests/src/Kernel/UserValidationTest.php b/core/modules/user/tests/src/Kernel/UserValidationTest.php index 89ede173b211..73886da53eae 100644 --- a/core/modules/user/tests/src/Kernel/UserValidationTest.php +++ b/core/modules/user/tests/src/Kernel/UserValidationTest.php @@ -69,7 +69,7 @@ public function testUsernames() { ]; // cSpell:enable foreach ($test_cases as $name => $test_case) { - list($description, $test) = $test_case; + [$description, $test] = $test_case; $result = user_validate_name($name); $this->$test($result, $description . ' (' . $name . ')'); } diff --git a/core/modules/views/src/EventSubscriber/RouteSubscriber.php b/core/modules/views/src/EventSubscriber/RouteSubscriber.php index 2f5b52c8eea0..50a3ca11d7ce 100644 --- a/core/modules/views/src/EventSubscriber/RouteSubscriber.php +++ b/core/modules/views/src/EventSubscriber/RouteSubscriber.php @@ -94,7 +94,7 @@ protected function getViewsDisplayIDsWithRoute() { // @todo Convert this method to some service. $views = $this->getApplicableViews(); foreach ($views as $data) { - list($view_id, $display_id) = $data; + [$view_id, $display_id] = $data; $this->viewsDisplayPairs[] = $view_id . '.' . $display_id; } $this->viewsDisplayPairs = array_combine($this->viewsDisplayPairs, $this->viewsDisplayPairs); @@ -111,7 +111,7 @@ protected function getViewsDisplayIDsWithRoute() { public function routes() { $collection = new RouteCollection(); foreach ($this->getViewsDisplayIDsWithRoute() as $pair) { - list($view_id, $display_id) = explode('.', $pair); + [$view_id, $display_id] = explode('.', $pair); $view = $this->viewStorage->load($view_id); // @todo This should have an executable factory injected. if (($view = $view->getExecutable()) && $view instanceof ViewExecutable) { @@ -133,7 +133,7 @@ public function routes() { */ protected function alterRoutes(RouteCollection $collection) { foreach ($this->getViewsDisplayIDsWithRoute() as $pair) { - list($view_id, $display_id) = explode('.', $pair); + [$view_id, $display_id] = explode('.', $pair); $view = $this->viewStorage->load($view_id); // @todo This should have an executable factory injected. if (($view = $view->getExecutable()) && $view instanceof ViewExecutable) { diff --git a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php index ac041a2e04a0..3cd675153413 100644 --- a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php +++ b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php @@ -64,7 +64,7 @@ abstract class ViewsBlockBase extends BlockBase implements ContainerFactoryPlugi public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewExecutableFactory $executable_factory, EntityStorageInterface $storage, AccountInterface $user) { $this->pluginId = $plugin_id; $delta = $this->getDerivativeId(); - list($name, $this->displayID) = explode('-', $delta, 2); + [$name, $this->displayID] = explode('-', $delta, 2); // Load the view. $view = $storage->load($name); $this->view = $executable_factory->get($view); diff --git a/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php index 358620440f79..72347530181f 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php @@ -72,7 +72,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { $view_route_names = $this->state->get('views.view_route_names'); foreach ($this->getApplicableMenuViews() as $pair) { /** @var \Drupal\views\ViewExecutable $executable */ - list($view_id, $display_id) = $pair; + [$view_id, $display_id] = $pair; $executable = $this->viewStorage->load($view_id)->getExecutable(); $executable->setDisplay($display_id); @@ -109,7 +109,7 @@ public function alterLocalTasks(&$local_tasks) { $view_route_names = $this->state->get('views.view_route_names'); foreach ($this->getApplicableMenuViews() as $pair) { - list($view_id, $display_id) = $pair; + [$view_id, $display_id] = $pair; /** @var \Drupal\views\ViewExecutable $executable */ $executable = $this->viewStorage->load($view_id)->getExecutable(); diff --git a/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php b/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php index c73846514b0c..7ddca09b3e81 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsMenuLink.php @@ -50,7 +50,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { $views = Views::getApplicableViews('uses_menu_links'); foreach ($views as $data) { - list($view_id, $display_id) = $data; + [$view_id, $display_id] = $data; /** @var \Drupal\views\ViewExecutable $executable */ $executable = $this->viewStorage->load($view_id)->getExecutable(); $executable->initDisplay(); diff --git a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php index dff33a3e0dc0..cf80704f6b3f 100644 --- a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php +++ b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php @@ -134,7 +134,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta $options = []; foreach ($displays as $data) { - list($view_id, $display_id) = $data; + [$view_id, $display_id] = $data; $view = $view_storage->load($view_id); if (in_array($view->get('base_table'), [$entity_type->getBaseTable(), $entity_type->getDataTable()])) { $display = $view->get('display'); @@ -318,7 +318,7 @@ public function validateReferenceableEntities(array $ids) { public static function settingsFormValidate($element, FormStateInterface $form_state, $form) { // Split view name and display name from the 'view_and_display' value. if (!empty($element['view_and_display']['#value'])) { - list($view, $display) = explode(':', $element['view_and_display']['#value']); + [$view, $display] = explode(':', $element['view_and_display']['#value']); } else { $form_state->setError($element, t('The views entity selection mode requires a view.')); diff --git a/core/modules/views/src/Plugin/views/area/View.php b/core/modules/views/src/Plugin/views/area/View.php index 932e7a6a2595..0f2d5bc91e7b 100644 --- a/core/modules/views/src/Plugin/views/area/View.php +++ b/core/modules/views/src/Plugin/views/area/View.php @@ -102,7 +102,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { */ public function render($empty = FALSE) { if (!empty($this->options['view_to_insert'])) { - list($view_name, $display_id) = explode(':', $this->options['view_to_insert']); + [$view_name, $display_id] = explode(':', $this->options['view_to_insert']); $view = $this->viewStorage->load($view_name)->getExecutable(); @@ -152,7 +152,7 @@ public function isEmpty() { public function calculateDependencies() { $dependencies = parent::calculateDependencies(); - list($view_id) = explode(':', $this->options['view_to_insert'], 2); + [$view_id] = explode(':', $this->options['view_to_insert'], 2); // Don't call the current view, as it would result into an infinite recursion. if ($view_id && $this->view->storage->id() != $view_id) { $view = $this->viewStorage->load($view_id); diff --git a/core/modules/views/src/Plugin/views/display/Page.php b/core/modules/views/src/Plugin/views/display/Page.php index e2104da8a751..68fe5c4ee226 100644 --- a/core/modules/views/src/Plugin/views/display/Page.php +++ b/core/modules/views/src/Plugin/views/display/Page.php @@ -488,7 +488,7 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'menu': $menu = $form_state->getValue('menu'); - list($menu['menu_name'], $menu['parent']) = explode(':', $menu['parent'], 2); + [$menu['menu_name'], $menu['parent']] = explode(':', $menu['parent'], 2); $this->setOption('menu', $menu); // send ajax form to options page if we use it. if ($form_state->getValue(['menu', 'type']) == 'default tab') { diff --git a/core/modules/views/src/Plugin/views/field/EntityField.php b/core/modules/views/src/Plugin/views/field/EntityField.php index 61db27cd1033..7d38ab2ae839 100644 --- a/core/modules/views/src/Plugin/views/field/EntityField.php +++ b/core/modules/views/src/Plugin/views/field/EntityField.php @@ -541,7 +541,7 @@ public function multiple_options_form(&$form, FormStateInterface $form_state) { // Make the string translatable by keeping it as a whole rather than // translating prefix and suffix separately. - list($prefix, $suffix) = explode('@count', $this->t('Display @count value(s)')); + [$prefix, $suffix] = explode('@count', $this->t('Display @count value(s)')); if ($field->getCardinality() == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) { $type = 'textfield'; @@ -600,7 +600,7 @@ public function multiple_options_form(&$form, FormStateInterface $form_state) { '#fieldset' => 'multiple_field_settings', ]; - list($prefix, $suffix) = explode('@count', $this->t('starting from @count')); + [$prefix, $suffix] = explode('@count', $this->t('starting from @count')); $form['delta_offset'] = [ '#type' => 'textfield', '#size' => 5, diff --git a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php index 34e1b086ec4c..3632b95cb3e0 100644 --- a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php +++ b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php @@ -196,7 +196,7 @@ protected function leftQuery($options) { // select field. See https://www.drupal.org/node/844910. // We work around this further down. $sort = $options['subquery_sort']; - list($sort_table, $sort_field) = explode('.', $sort); + [$sort_table, $sort_field] = explode('.', $sort); $sort_options = ['order' => $options['subquery_order']]; $temp_view->addHandler('default', 'sort', $sort_table, $sort_field, $sort_options); } @@ -215,7 +215,7 @@ protected function leftQuery($options) { $relationship_id = NULL; // Add the used relationship for the subjoin, if defined. if (isset($this->definition['relationship'])) { - list($relationship_table, $relationship_field) = explode(':', $this->definition['relationship']); + [$relationship_table, $relationship_field] = explode(':', $this->definition['relationship']); $relationship_id = $temp_view->addHandler('default', 'relationship', $relationship_table, $relationship_field); } $temp_item_options = ['relationship' => $relationship_id]; @@ -269,7 +269,7 @@ protected function leftQuery($options) { foreach ($orders as $order_key => $order) { // But if we're using a whole view, we don't know what we have! if ($options['subquery_view']) { - list($sort_table, $sort_field) = explode('.', $order_key); + [$sort_table, $sort_field] = explode('.', $order_key); } $orders[$sort_table . $this->subquery_namespace . '.' . $sort_field] = $order; unset($orders[$order_key]); diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php index 335ac065e005..0488df1c0434 100644 --- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php @@ -1022,7 +1022,7 @@ protected function defaultDisplaySortsUser($form, FormStateInterface $form_state // Don't add a sort if there is no form value or the user set the sort to // 'none'. if (($sort_type = $form_state->getValue(['show', 'sort'])) && $sort_type != 'none') { - list($column, $sort) = explode(':', $sort_type); + [$column, $sort] = explode(':', $sort_type); // Column either be a column-name or the table-column-name. $column = explode('-', $column); if (count($column) > 1) { @@ -1096,7 +1096,7 @@ protected function pageDisplayOptions(array $form, FormStateInterface $form_stat if (!empty($page['link'])) { $display_options['menu']['type'] = 'normal'; $display_options['menu']['title'] = $page['link_properties']['title']; - list($display_options['menu']['menu_name'], $display_options['menu']['parent']) = explode(':', $page['link_properties']['parent'], 2); + [$display_options['menu']['menu_name'], $display_options['menu']['parent']] = explode(':', $page['link_properties']['parent'], 2); } return $display_options; } diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php index 114b72748cd9..03218ac94e90 100644 --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -327,7 +327,7 @@ public static function getViewsAsOptions($views_only = FALSE, $filter = 'all', $ else { // Append a ':' to the $exclude_view string so we always have more than one // item to explode. - list($exclude_view_name, $exclude_view_display) = explode(':', "$exclude_view:"); + [$exclude_view_name, $exclude_view_display] = explode(':', "$exclude_view:"); } $options = []; diff --git a/core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php b/core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php index 3392e2853533..5785730c22d4 100644 --- a/core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php @@ -91,7 +91,7 @@ public function testNumericFormatPlural() { $this->submitForm($edit, 'Add language'); $formula = 'nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);'; $header = new PoHeader(); - list($nplurals, $formula) = $header->parsePluralForms($formula); + [$nplurals, $formula] = $header->parsePluralForms($formula); \Drupal::service('locale.plural.formula')->setPluralFormula('sl', $nplurals, $formula); // Change the view to Slovenian. diff --git a/core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php b/core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php index 2ae071a4e8dc..9c25d3aead6d 100644 --- a/core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php +++ b/core/modules/views/tests/src/Kernel/EventSubscriber/ViewsEntitySchemaSubscriberIntegrationTest.php @@ -327,14 +327,14 @@ public function testVariousTableUpdates() { // base <-> base + translation $this->updateEntityTypeToTranslatable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); $this->assertEquals('entity_test_update_data', $display['display_options']['fields']['name']['table']); $this->updateEntityTypeToNotTranslatable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); @@ -344,21 +344,21 @@ public function testVariousTableUpdates() { // base + translation <-> base + translation + revision $this->updateEntityTypeToTranslatable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); $this->assertEquals('entity_test_update_data', $display['display_options']['fields']['name']['table']); $this->updateEntityTypeToRevisionable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); $this->assertEquals('entity_test_update_data', $display['display_options']['fields']['name']['table']); $this->updateEntityTypeToNotRevisionable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); @@ -368,21 +368,21 @@ public function testVariousTableUpdates() { // base + revision <-> base + translation + revision $this->updateEntityTypeToRevisionable(); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); $this->assertEquals('entity_test_update', $display['display_options']['fields']['name']['table']); $this->updateEntityTypeToTranslatable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); $this->assertEquals('entity_test_update_data', $display['display_options']['fields']['name']['table']); $this->updateEntityTypeToNotTranslatable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); @@ -392,14 +392,14 @@ public function testVariousTableUpdates() { // base <-> base + revision $this->updateEntityTypeToRevisionable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); $this->assertEquals('entity_test_update', $display['display_options']['fields']['name']['table']); $this->updateEntityTypeToNotRevisionable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); @@ -410,7 +410,7 @@ public function testVariousTableUpdates() { // base <-> base + translation + revision $this->updateEntityTypeToRevisionable(TRUE); $this->updateEntityTypeToTranslatable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); @@ -418,7 +418,7 @@ public function testVariousTableUpdates() { $this->updateEntityTypeToNotRevisionable(TRUE); $this->updateEntityTypeToNotTranslatable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(); + [$view, $display] = $this->getUpdatedViewAndDisplay(); $this->assertEquals('entity_test_update', $view->get('base_table')); $this->assertEquals('entity_test_update', $display['display_options']['fields']['id']['table']); @@ -439,21 +439,21 @@ public function testVariousTableUpdatesForRevisionView() { // base + revision <-> base + translation + revision $this->updateEntityTypeToRevisionable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(TRUE); + [$view, $display] = $this->getUpdatedViewAndDisplay(TRUE); $this->assertEquals('entity_test_update_revision', $view->get('base_table')); $this->assertEquals('entity_test_update_revision', $display['display_options']['fields']['id']['table']); $this->assertEquals('entity_test_update_revision', $display['display_options']['fields']['name']['table']); $this->updateEntityTypeToTranslatable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(TRUE); + [$view, $display] = $this->getUpdatedViewAndDisplay(TRUE); $this->assertEquals('entity_test_update_revision', $view->get('base_table')); $this->assertEquals('entity_test_update_revision', $display['display_options']['fields']['id']['table']); $this->assertEquals('entity_test_update_revision_data', $display['display_options']['fields']['name']['table']); $this->updateEntityTypeToNotTranslatable(TRUE); - list($view, $display) = $this->getUpdatedViewAndDisplay(TRUE); + [$view, $display] = $this->getUpdatedViewAndDisplay(TRUE); $this->assertEquals('entity_test_update_revision', $view->get('base_table')); $this->assertEquals('entity_test_update_revision', $display['display_options']['fields']['id']['table']); diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php index 8060460627b9..55fe86c00225 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -229,7 +229,7 @@ public function testViewsPluginList() { $plugin_list = Views::pluginList(); // Only plugins used by 'test_view' should be in the plugin list. foreach (['display:default', 'pager:none'] as $key) { - list($plugin_type, $plugin_id) = explode(':', $key); + [$plugin_type, $plugin_id] = explode(':', $key); $plugin_def = $this->container->get("plugin.manager.views.$plugin_type")->getDefinition($plugin_id); $this->assertTrue(isset($plugin_list[$key]), new FormattableMarkup('The expected @key plugin list key was found.', ['@key' => $key])); diff --git a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php index 8964cecc0c97..f0e3ba9ce91e 100644 --- a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php @@ -188,7 +188,7 @@ public function testAjaxView() { $request->request->set('ajax_page_state', 'drupal.settings[]'); $request->request->set('type', 'article'); - list($view, $executable) = $this->setupValidMocks(); + [$view, $executable] = $this->setupValidMocks(); $this->redirectDestination->expects($this->atLeastOnce()) ->method('set') @@ -217,7 +217,7 @@ public function testAjaxViewViewPathNoSlash() { $request->request->set('ajax_page_state', 'drupal.settings[]'); $request->request->set('type', 'article'); - list($view, $executable) = $this->setupValidMocks(); + [$view, $executable] = $this->setupValidMocks(); $this->redirectDestination->expects($this->atLeastOnce()) ->method('set') @@ -261,7 +261,7 @@ public function testAjaxViewWithArguments() { $request->request->set('view_display_id', 'page_1'); $request->request->set('view_args', 'arg1/arg2'); - list($view, $executable) = $this->setupValidMocks(); + [$view, $executable] = $this->setupValidMocks(); $executable->expects($this->once()) ->method('preview') ->with('page_1', ['arg1', 'arg2']); @@ -282,7 +282,7 @@ public function testAjaxViewWithEmptyArguments() { // Simulate a request that has a second, empty argument. $request->request->set('view_args', 'arg1/'); - list($view, $executable) = $this->setupValidMocks(); + [$view, $executable] = $this->setupValidMocks(); $executable->expects($this->once()) ->method('preview') ->with('page_1', $this->identicalTo(['arg1', NULL])); @@ -302,7 +302,7 @@ public function testAjaxViewWithHtmlEntityArguments() { $request->request->set('view_display_id', 'page_1'); $request->request->set('view_args', 'arg1 & arg2/arg3'); - list($view, $executable) = $this->setupValidMocks(); + [$view, $executable] = $this->setupValidMocks(); $executable->expects($this->once()) ->method('preview') ->with('page_1', ['arg1 & arg2', 'arg3']); @@ -324,7 +324,7 @@ public function testAjaxViewWithPager() { $request->request->set('view_dom_id', $dom_id); $request->request->set('pager_element', '0'); - list($view, $executable) = $this->setupValidMocks(); + [$view, $executable] = $this->setupValidMocks(); $display_handler = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase') ->disableOriginalConstructor() diff --git a/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php b/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php index ec59ed0b0079..8a466182444c 100644 --- a/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php +++ b/core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php @@ -65,7 +65,7 @@ protected function setUp(): void { * @covers ::routeRebuildFinished */ public function testRouteRebuildFinished() { - list($display_1, $display_2) = $this->setupMocks(); + [$display_1, $display_2] = $this->setupMocks(); $display_1->expects($this->once()) ->method('collectRoutes') @@ -96,7 +96,7 @@ public function testOnAlterRoutes() { $route_event = new RouteBuildEvent($collection, 'views'); - list($display_1, $display_2) = $this->setupMocks(); + [$display_1, $display_2] = $this->setupMocks(); // The page_1 display overrides an existing route, so the dynamicRoutes // should only call the second display. diff --git a/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php index 7429aefb8a6c..6c67ab2e3fc4 100644 --- a/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php @@ -89,7 +89,7 @@ public function setupContainer() { * @see \Drupal\views\Plugin\views\display\PathPluginBase::collectRoutes() */ public function testCollectRoutes() { - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -117,7 +117,7 @@ public function testCollectRoutes() { * @see \Drupal\views\Plugin\views\display\PathPluginBase::collectRoutes() */ public function testCollectRoutesWithDisplayReturnResponse() { - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -144,7 +144,7 @@ public function testCollectRoutesWithDisplayReturnResponse() { * @see \Drupal\views\Plugin\views\display\PathPluginBase::collectRoutes() */ public function testCollectRoutesWithArguments() { - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -172,7 +172,7 @@ public function testCollectRoutesWithArguments() { * @see \Drupal\views\Plugin\views\display\PathPluginBase::collectRoutes() */ public function testCollectRoutesWithArgumentsNotSpecifiedInPath() { - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -201,7 +201,7 @@ public function testCollectRoutesWithArgumentsNotSpecifiedInPath() { * Tests the collect routes method with an alternative route name in the UI. */ public function testCollectRoutesWithSpecialRouteName() { - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -232,7 +232,7 @@ public function testAlterRoute() { $route_2 = new Route('test_route/example', ['_controller' => 'Drupal\Tests\Core\Controller\TestController::content']); $collection->add('test_route_2', $route_2); - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -269,7 +269,7 @@ public function testAlterPostRestRoute() { $route->setMethods(['POST']); $collection->add('test_route', $route); - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -308,7 +308,7 @@ public function testGetRestRoute() { $route->setRequirement('_format', 'json'); $collection->add('test_route', $route); - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -346,7 +346,7 @@ public function testAlterRouteWithAlterCallback() { $route_2 = new Route('test_route/example', ['_controller' => 'Drupal\Tests\Core\Controller\TestController::content']); $collection->add('test_route_2', $route_2); - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -381,7 +381,7 @@ public function testAlterRouteWithAlterCallback() { */ public function testCollectRoutesWithNamedParameters() { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $view->argument = []; $view->argument['nid'] = $this->getMockBuilder('Drupal\views\Plugin\views\argument\ArgumentPluginBase') @@ -416,7 +416,7 @@ public function testAlterRoutesWithParameters() { $collection = new RouteCollection(); $collection->add('test_route', new Route('test_route/{parameter}', ['_controller' => 'Drupal\Tests\Core\Controller\TestController::content'])); - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); // Manually set up an argument handler. $argument = $this->getMockBuilder('Drupal\views\Plugin\views\argument\ArgumentPluginBase') @@ -453,7 +453,7 @@ public function testAlterRoutesWithParametersAndUpcasting() { $collection = new RouteCollection(); $collection->add('test_route', new Route('test_route/{parameter}', ['_controller' => 'Drupal\Tests\Core\Controller\TestController::content'], [], ['parameters' => ['taxonomy_term' => 'entity:entity_test']])); - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); // Manually set up an argument handler. $argument = $this->getMockBuilder('Drupal\views\Plugin\views\argument\ArgumentPluginBase') @@ -491,7 +491,7 @@ public function testAlterRoutesWithOptionalParameters() { $collection = new RouteCollection(); $collection->add('test_route', new Route('test_route/{parameter}', ['_controller' => 'Drupal\Tests\Core\Controller\TestController::content'])); - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; @@ -523,7 +523,7 @@ public function testAlterRoutesWithOptionalParameters() { * Tests the getRouteName method. */ public function testGetRouteName() { - list($view) = $this->setupViewExecutableAccessPlugin(); + [$view] = $this->setupViewExecutableAccessPlugin(); $display = []; $display['display_plugin'] = 'page'; diff --git a/core/modules/views/tests/src/Unit/ViewExecutableTest.php b/core/modules/views/tests/src/Unit/ViewExecutableTest.php index f24c0d1428a7..8654aaeffcb2 100644 --- a/core/modules/views/tests/src/Unit/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Unit/ViewExecutableTest.php @@ -300,7 +300,7 @@ public function testGetUrlWithPlaceholdersAndWithoutArgsAndExceptionValue() { public function testBuildThemeFunctions() { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); unset($view->display_handler); $expected = [ @@ -361,7 +361,7 @@ public function testGenerateHandlerId() { public function testAddHandler($option, $handler_type) { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $views_data = []; $views_data['test_field'] = [ @@ -403,7 +403,7 @@ public function testAddHandler($option, $handler_type) { public function testAddHandlerWithEntityField($option, $handler_type) { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $views_data = []; $views_data['table']['entity type'] = 'test_entity_type'; @@ -467,7 +467,7 @@ public function addHandlerProvider() { public function testAttachDisplays($display_enabled, $access_granted, $expected_to_be_attached) { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $display->expects($this->atLeastOnce()) ->method('acceptAttachments') @@ -583,7 +583,7 @@ protected function setupBaseViewAndDisplay() { public function testSetItemsPerPageBeforePreRender() { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $view->setItemsPerPage(12); $this->assertEquals(12, $view->getItemsPerPage()); @@ -597,7 +597,7 @@ public function testSetItemsPerPageBeforePreRender() { public function testSetItemsPerPageDuringPreRender() { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $elements = &$view->element; $elements['#cache'] += ['keys' => []]; @@ -615,7 +615,7 @@ public function testSetItemsPerPageDuringPreRender() { public function testSetOffsetBeforePreRender() { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $view->setOffset(12); $this->assertEquals(12, $view->getOffset()); @@ -629,7 +629,7 @@ public function testSetOffsetBeforePreRender() { public function testSetOffsetDuringPreRender() { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $elements = &$view->element; $elements['#cache'] += ['keys' => []]; @@ -647,7 +647,7 @@ public function testSetOffsetDuringPreRender() { public function testSetCurrentPageBeforePreRender() { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $view->setCurrentPage(12); $this->assertEquals(12, $view->getCurrentPage()); @@ -661,7 +661,7 @@ public function testSetCurrentPageBeforePreRender() { public function testSetCurrentPageDuringPreRender() { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $elements = &$view->element; $elements['#cache'] += ['keys' => []]; @@ -678,7 +678,7 @@ public function testSetCurrentPageDuringPreRender() { public function testCacheIsIgnoredDuringPreview() { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); // Pager needs to be set to avoid false test failures. $view->pager = $this->getMockBuilder(NonePager::class) @@ -713,7 +713,7 @@ public function testCacheIsIgnoredDuringPreview() { public function testExecuteReturn($display_enabled, $expected_result) { /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */ /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */ - list($view, $display) = $this->setupBaseViewAndDisplay(); + [$view, $display] = $this->setupBaseViewAndDisplay(); $display->expects($this->any()) ->method('isEnabled') diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php index 18a607073326..8e8d89d08e4d 100644 --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -559,7 +559,7 @@ function hook_field_views_data_alter(array &$data, \Drupal\field\FieldStorageCon $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id; $table_mapping = \Drupal::entityTypeManager()->getStorage($entity_type_id)->getTableMapping(); - list($label) = views_entity_field_label($entity_type_id, $field_name); + [$label] = views_entity_field_label($entity_type_id, $field_name); $data['file_managed'][$pseudo_field_name]['relationship'] = [ 'title' => t('@entity using @field', ['@entity' => $entity_type->getLabel(), '@field' => $label]), @@ -614,7 +614,7 @@ function hook_field_views_data_views_data_alter(array &$data, \Drupal\field\Fiel $entity_type_id = $field->entity_type; $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id); $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id; - list($label) = views_entity_field_label($entity_type_id, $field_name); + [$label] = views_entity_field_label($entity_type_id, $field_name); $table_mapping = \Drupal::entityTypeManager()->getStorage($entity_type_id)->getTableMapping(); // Views data for this field is in $data[$data_key]. diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc index 7c236e68c4cb..de7977332108 100644 --- a/core/modules/views/views.views.inc +++ b/core/modules/views/views.views.inc @@ -507,7 +507,7 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora // Determine the label to use for the field. We don't have a label available // at the field level, so we just go through all fields and take the one // which is used the most frequently. - list($label, $all_labels) = views_entity_field_label($entity_type_id, $field_name); + [$label, $all_labels] = views_entity_field_label($entity_type_id, $field_name); // Expose data for the field as a whole. foreach ($field_tables as $type => $table_info) { diff --git a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php index 20f61fe773b5..3a7336ce847f 100644 --- a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php +++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php @@ -266,7 +266,7 @@ public function remove(&$form, FormStateInterface $form_state) { $type = $form_state->get('type'); $id = $form_state->get('id'); // Store the item back on the view - list($was_defaulted, $is_defaulted) = $view->getOverrideValues($form, $form_state); + [$was_defaulted, $is_defaulted] = $view->getOverrideValues($form, $form_state); $executable = $view->getExecutable(); // If the display selection was changed toggle the override value. if ($was_defaulted != $is_defaulted) { diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 3dbe2b33fe90..0dfaec0f44b8 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -215,7 +215,7 @@ public function standardSubmit($form, FormStateInterface $form_state) { // Determine whether the values the user entered are intended to apply to // the current display or the default display. - list($was_defaulted, $is_defaulted, $revert) = $this->getOverrideValues($form, $form_state); + [$was_defaulted, $is_defaulted, $revert] = $this->getOverrideValues($form, $form_state); // Based on the user's choice in the display dropdown, determine which display // these changes apply to. @@ -429,7 +429,7 @@ public function submitItemAdd($form, FormStateInterface $form_state) { $display_id = $form_state->get('display_id'); // Handle the override select. - list($was_defaulted, $is_defaulted) = $this->getOverrideValues($form, $form_state); + [$was_defaulted, $is_defaulted] = $this->getOverrideValues($form, $form_state); if ($was_defaulted && !$is_defaulted) { // We were using the default display's values, but we're now overriding // the default display and saving values specific to this display. @@ -450,7 +450,7 @@ public function submitItemAdd($form, FormStateInterface $form_state) { if (!$form_state->isValueEmpty('name') && is_array($form_state->getValue('name'))) { // Loop through each of the items that were checked and add them to the view. foreach (array_keys(array_filter($form_state->getValue('name'))) as $field) { - list($table, $field) = explode('.', $field, 2); + [$table, $field] = explode('.', $field, 2); if ($cut = strpos($field, '$')) { $field = substr($field, 0, $cut); diff --git a/core/modules/workflows/src/WorkflowAccessControlHandler.php b/core/modules/workflows/src/WorkflowAccessControlHandler.php index 1e0456cf6dfa..63ad30f6d831 100644 --- a/core/modules/workflows/src/WorkflowAccessControlHandler.php +++ b/core/modules/workflows/src/WorkflowAccessControlHandler.php @@ -55,7 +55,7 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter /** @var \Drupal\workflows\Entity\Workflow $entity */ $workflow_type = $entity->getTypePlugin(); if (strpos($operation, 'delete-state') === 0) { - list(, $state_id) = explode(':', $operation, 2); + [, $state_id] = explode(':', $operation, 2); // Deleting a state is editing a workflow, but also we should forbid // access if there is only one state. return AccessResult::allowedIf(count($entity->getTypePlugin()->getStates()) > 1) diff --git a/core/modules/workspaces/src/EntityQuery/Tables.php b/core/modules/workspaces/src/EntityQuery/Tables.php index 28b16d4a9f88..66600211b2aa 100644 --- a/core/modules/workspaces/src/EntityQuery/Tables.php +++ b/core/modules/workspaces/src/EntityQuery/Tables.php @@ -94,7 +94,7 @@ protected function addJoin($type, $table, $join_condition, $langcode, $delta = N // to also look for a possible workspace-specific revision using COALESCE. $condition_parts = explode(' = ', $join_condition); $condition_parts_1 = str_replace(['[', ']'], '', $condition_parts[1]); - list($base_table, $id_field) = explode('.', $condition_parts_1); + [$base_table, $id_field] = explode('.', $condition_parts_1); if (isset($this->baseTablesEntityType[$base_table])) { $entity_type_id = $this->baseTablesEntityType[$base_table]; diff --git a/core/modules/workspaces/src/Form/WorkspaceForm.php b/core/modules/workspaces/src/Form/WorkspaceForm.php index fe022162d7f6..13a5b60ffd7d 100644 --- a/core/modules/workspaces/src/Form/WorkspaceForm.php +++ b/core/modules/workspaces/src/Form/WorkspaceForm.php @@ -114,7 +114,7 @@ protected function flagViolations(EntityConstraintViolationListInterface $violat 'id', ]; foreach ($violations->getByFields($field_names) as $violation) { - list($field_name) = explode('.', $violation->getPropertyPath(), 2); + [$field_name] = explode('.', $violation->getPropertyPath(), 2); $form_state->setErrorByName($field_name, $violation->getMessage()); } parent::flagViolations($violations, $form, $form_state); diff --git a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php index e689d8549c6f..f1d17a6cb42f 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php @@ -727,7 +727,7 @@ protected function importContentFromFile($entity_type, $bundle_machine_name) { $filename = $entity_type . '/' . $bundle_machine_name . '.csv'; // Read all multilingual content from the file. - list($all_content, $translated_languages) = $this->readMultilingualContent($filename); + [$all_content, $translated_languages] = $this->readMultilingualContent($filename); // English is no longer needed in the list of languages to translate. $key = array_search('en', $translated_languages); diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index edb6cab39de0..17ec49b9a484 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -41,7 +41,7 @@ const SIMPLETEST_SCRIPT_EXIT_EXCEPTION = 2; // Set defaults and get overrides. -list($args, $count) = simpletest_script_parse_args(); +[$args, $count] = simpletest_script_parse_args(); if ($args['help'] || $count == 0) { simpletest_script_help(); @@ -467,7 +467,7 @@ function simpletest_script_init() { elseif ($sudo = getenv('SUDO_COMMAND')) { // 'SUDO_COMMAND' is an environment variable set by the sudo program. // Extract only the PHP interpreter, not the rest of the command. - list($php) = explode(' ', $sudo, 2); + [$php] = explode(' ', $sudo, 2); } else { simpletest_script_print_error('Unable to automatically determine the path to the PHP interpreter. Supply the --php command line argument.'); @@ -824,7 +824,7 @@ function simpletest_script_run_one_test($test_id, $test_class) { // tests and that none ran. $status = SIMPLETEST_SCRIPT_EXIT_SUCCESS; if (strpos($test_class, '::') > 0) { - list($class_name, $method) = explode('::', $test_class, 2); + [$class_name, $method] = explode('::', $test_class, 2); $methods = [$method]; } else { @@ -1048,7 +1048,7 @@ function simpletest_script_get_test_list() { if ($args['class']) { $test_list = []; foreach ($args['test_names'] as $test_class) { - list($class_name) = explode('::', $test_class, 2); + [$class_name] = explode('::', $test_class, 2); if (class_exists($class_name)) { $test_list[] = $test_class; } @@ -1264,7 +1264,7 @@ function simpletest_script_reporter_write_xml_results() { $case = $dom_document->createElement('testcase'); $case->setAttribute('classname', $test_class); if (strpos($result->function, '->') !== FALSE) { - list($class, $name) = explode('->', $result->function, 2); + [$class, $name] = explode('->', $result->function, 2); } else { $name = $result->function; diff --git a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php index 221de328ca7e..54700f93f05e 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php @@ -64,7 +64,7 @@ protected function setUp(): void { public function testDefault() { $assets = new AttachedAssets(); $this->assertEquals([], $this->assetResolver->getCssAssets($assets, FALSE), 'Default CSS is empty.'); - list($js_assets_header, $js_assets_footer) = $this->assetResolver->getJsAssets($assets, FALSE); + [$js_assets_header, $js_assets_footer] = $this->assetResolver->getJsAssets($assets, FALSE); $this->assertEquals([], $js_assets_header, 'Default header JavaScript is empty.'); $this->assertEquals([], $js_assets_footer, 'Default footer JavaScript is empty.'); } @@ -181,7 +181,7 @@ public function testAggregation() { $this->assertCount(1, $this->assetResolver->getCssAssets($assets, TRUE), 'There is a sole aggregated CSS asset.'); - list($header_js, $footer_js) = $this->assetResolver->getJsAssets($assets, TRUE); + [$header_js, $footer_js] = $this->assetResolver->getJsAssets($assets, TRUE); $this->assertEquals([], \Drupal::service('asset.js.collection_renderer')->render($header_js), 'There are 0 JavaScript assets in the header.'); $rendered_footer_js = \Drupal::service('asset.js.collection_renderer')->render($footer_js); $this->assertCount(2, $rendered_footer_js, 'There are 2 JavaScript assets in the footer.'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php index c255d8885b96..89e98bf4a204 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php @@ -65,7 +65,7 @@ public function testVulnerableComment() { $connection = Database::getConnection(); foreach ($this->makeCommentsProvider() as $test_set) { - list($expected, $comments) = $test_set; + [$expected, $comments] = $test_set; $this->assertEquals($expected, $connection->makeComment($comments)); } } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php index ffbf5a59d31e..176413cf6988 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -140,7 +140,7 @@ protected function setUp(): void { foreach (array_reverse(str_split(decbin($i))) as $key => $bit) { if ($bit) { // @todo https://www.drupal.org/project/drupal/issues/3001920 Doing - // list($field_name, $langcode, $values) = $units[$key]; causes + // [$field_name, $langcode, $values] = $units[$key]; causes // problems in PHP 7.3. Revert to better variable names once // https://bugs.php.net/bug.php?id=76937 is fixed. $entity->getTranslation($units[$key][1])->{$units[$key][0]}[] = $units[$key][2]; diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php index 7a81c54d7903..f4c5844e039f 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php @@ -337,7 +337,7 @@ public function testCleanUpStorageDefinition() { $entity_type_id_count = 0; foreach (array_keys($schema) as $storage_definition_name) { - list($entity_type_id, ,) = explode('.', $storage_definition_name); + [$entity_type_id] = explode('.', $storage_definition_name); if (in_array($entity_type_id, $entity_type_ids)) { $entity_type_id_count++; } @@ -358,7 +358,7 @@ public function testCleanUpStorageDefinition() { $entity_type_id_count = 0; foreach (array_keys($schema) as $storage_definition_name) { - list($entity_type_id, ,) = explode('.', $storage_definition_name); + [$entity_type_id] = explode('.', $storage_definition_name); if (in_array($entity_type_id, $entity_type_ids)) { $entity_type_id_count++; } diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 9e5376eb4a53..d4703ed2c9c2 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -718,7 +718,7 @@ protected function translatePostValues(array $values) { // string and convert the resulting key/value pairs back into a flat array. $query = http_build_query($values); foreach (explode('&', $query) as $item) { - list($key, $value) = explode('=', $item); + [$key, $value] = explode('=', $item); $edit[urldecode($key)] = urldecode($value); } return $edit; diff --git a/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php b/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php index 84c909e1a3b5..0d000d59d633 100644 --- a/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php +++ b/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php @@ -30,7 +30,7 @@ class PoHeaderTest extends TestCase { public function testPluralsFormula($plural, $expected) { $p = new PoHeader(); $parsed = $p->parsePluralForms($plural); - list($nplurals, $new_plural) = $parsed; + [$nplurals, $new_plural] = $parsed; foreach ($expected as $number => $plural_form) { $result = $new_plural[$number] ?? $new_plural['default']; $this->assertEquals($result, $plural_form, 'Difference found at ' . $number . ': ' . $plural_form . ' versus ' . $result); diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php index c04bed5b902e..2d939a75ab85 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php @@ -96,7 +96,7 @@ public function testAddCacheTags() { ]; foreach ($add_expected as $row => $data) { - list($add, $expected) = $data; + [$add, $expected] = $data; $metadata->addCacheTags($add); $this->assertEquals($expected, $metadata->getCacheTags(), sprintf("Dataset in %d row failed on validation.", $row + 1)); } diff --git a/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php b/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php index 8da6fa436026..929ad62b1df7 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php @@ -25,7 +25,7 @@ class ExtensionListTest extends UnitTestCase { * @covers ::getName */ public function testGetNameWithNonExistingExtension() { - list($cache, $info_parser, $module_handler, $state) = $this->getMocks(); + [$cache, $info_parser, $module_handler, $state] = $this->getMocks(); $test_extension_list = new TestExtension($this->randomMachineName(), 'test_extension', $cache->reveal(), $info_parser->reveal(), $module_handler->reveal(), $state->reveal(), 'testing'); $extension_discovery = $this->prophesize(ExtensionDiscovery::class); @@ -49,7 +49,7 @@ public function testGetName() { * @covers ::get */ public function testGetWithNonExistingExtension() { - list($cache, $info_parser, $module_handler, $state) = $this->getMocks(); + [$cache, $info_parser, $module_handler, $state] = $this->getMocks(); $test_extension_list = new TestExtension($this->randomMachineName(), 'test_extension', $cache->reveal(), $info_parser->reveal(), $module_handler->reveal(), $state->reveal(), 'testing'); $extension_discovery = $this->prophesize(ExtensionDiscovery::class); @@ -292,7 +292,7 @@ protected function setupTestExtensionList(array $extension_names = ['test_name'] touch("vfs://drupal_root/example/$extension_name/$extension_name.info.yml", 123456789); } - list($cache, $info_parser, $module_handler, $state) = $this->getMocks(); + [$cache, $info_parser, $module_handler, $state] = $this->getMocks(); $info_parser->parse(Argument::any())->will(function ($args) { return Yaml::decode(file_get_contents('vfs://drupal_root/' . $args[0])); }); diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php index cfd3439baa5f..ae0f753ef7ec 100644 --- a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php @@ -587,7 +587,7 @@ public function testCoreIncompatibility($test_case, $constraint, $expected) { * Data provider for testCoreIncompatibility(). */ public function providerCoreIncompatibility() { - list($major, $minor) = explode('.', \Drupal::VERSION); + [$major, $minor] = explode('.', \Drupal::VERSION); $next_minor = $minor + 1; $next_major = $major + 1; diff --git a/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php b/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php index 2588c2ebf268..980e715323ba 100644 --- a/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php +++ b/core/tests/Drupal/Tests/Core/Field/BaseFieldDefinitionTestBase.php @@ -27,7 +27,7 @@ protected function setUp() { parent::setUp(); // getModuleAndPath() returns an array of the module name and directory. - list($module_name, $module_dir) = $this->getModuleAndPath(); + [$module_name, $module_dir] = $this->getModuleAndPath(); $namespaces = new \ArrayObject(); $namespaces["Drupal\\$module_name"] = $module_dir . '/src'; diff --git a/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php index c2075afb04e4..84a3981e0a8e 100644 --- a/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php @@ -23,7 +23,7 @@ public function testWrapMail() { $headers_in_body .= 'Content-Description: ' . $this->randomMachineName(64); $body = $this->randomMachineName(76) . ' ' . $this->randomMachineName(6); $wrapped_text = MailFormatHelper::wrapMail($headers_in_body . $delimiter . $body); - list($processed_headers, $processed_body) = explode($delimiter, $wrapped_text); + [$processed_headers, $processed_body] = explode($delimiter, $wrapped_text); // Check that the body headers were not wrapped even though some exceeded // 77 characters. diff --git a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php index f0d693ba0d81..69fa66bdd4d7 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php @@ -33,7 +33,7 @@ protected function setUpRenderRecursionComplexElements() { * @covers ::doRender */ public function testRenderRecursionWithNestedRenderRoot() { - list($complex_child_markup, $parent_markup, $complex_child_template) = $this->setUpRenderRecursionComplexElements(); + [$complex_child_markup, $parent_markup, $complex_child_template] = $this->setUpRenderRecursionComplexElements(); $renderer = $this->renderer; $this->setUpRequest(); @@ -65,7 +65,7 @@ public function testRenderRecursionWithNestedRenderRoot() { * @covers ::doRender */ public function testRenderRecursionWithNestedRender() { - list($complex_child_markup, $parent_markup, $complex_child_template) = $this->setUpRenderRecursionComplexElements(); + [$complex_child_markup, $parent_markup, $complex_child_template] = $this->setUpRenderRecursionComplexElements(); $renderer = $this->renderer; $this->setUpRequest(); @@ -99,7 +99,7 @@ public function testRenderRecursionWithNestedRender() { * @covers ::renderPlain */ public function testRenderRecursionWithNestedRenderPlain() { - list($complex_child_markup, $parent_markup, $complex_child_template) = $this->setUpRenderRecursionComplexElements(); + [$complex_child_markup, $parent_markup, $complex_child_template] = $this->setUpRenderRecursionComplexElements(); $renderer = $this->renderer; $this->setUpRequest(); diff --git a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListenerTrait.php index 34f305e36596..aac9b3056b6f 100644 --- a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListenerTrait.php +++ b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListenerTrait.php @@ -102,7 +102,7 @@ private function checkValidCoversForTest(TestCase $test) { $class = $covers; $method = ''; if (strpos($covers, '::') !== FALSE) { - list($class, $method) = explode('::', $covers); + [$class, $method] = explode('::', $covers); } // Check for the existence of the class if it's specified by @covers. if (!empty($class)) { diff --git a/core/tests/Drupal/Tests/XdebugRequestTrait.php b/core/tests/Drupal/Tests/XdebugRequestTrait.php index 5da86a51bde0..48c19a6c7c26 100644 --- a/core/tests/Drupal/Tests/XdebugRequestTrait.php +++ b/core/tests/Drupal/Tests/XdebugRequestTrait.php @@ -35,7 +35,7 @@ protected function extractCookiesFromRequest(Request $request) { // $_SERVER['XDEBUG_CONFIG'] has the form "key1=value1 key2=value2 ...". $pairs = explode(' ', $server->get('XDEBUG_CONFIG')); foreach ($pairs as $pair) { - list($key, $value) = explode('=', $pair); + [$key, $value] = explode('=', $pair); // Account for key-value pairs being separated by multiple spaces. if (trim($key, ' ') == 'idekey') { $cookies['XDEBUG_SESSION'][] = trim($value, ' '); -- GitLab