diff options
445 files changed, 1576 insertions, 1199 deletions
diff --git a/core/includes/batch.inc b/core/includes/batch.inc index 080b2867bc5..5b85df06fdb 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -223,7 +223,8 @@ function _batch_progress_page() { 'batch_progress_meta_refresh', ], ], - // Adds JavaScript code and settings for clients where JavaScript is enabled. + // Adds JavaScript code and settings for clients where JavaScript is + // enabled. 'drupalSettings' => [ 'batch' => [ 'errorMessage' => $current_set['error_message'] . '<br />' . $batch['error_message'], diff --git a/core/includes/errors.inc b/core/includes/errors.inc index 3ec342aa29d..17c8a2c9285 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -198,8 +198,8 @@ function _drupal_log_error($error, $fatal = FALSE) { if (\Drupal::hasRequest() && \Drupal::request()->isXmlHttpRequest()) { if ($fatal) { if (error_displayable($error)) { - // When called from JavaScript, simply output the error message. - // Should not translate the string to avoid errors producing more errors. + // When called from JavaScript, simply output the error message. Should + // not translate the string to avoid errors producing more errors. $response->setContent(new FormattableMarkup(Error::DEFAULT_ERROR_MESSAGE, $error)); $response->send(); } @@ -259,8 +259,8 @@ function _drupal_log_error($error, $fatal = FALSE) { } if ($fatal) { - // We fallback to a maintenance page at this point, because the page generation - // itself can generate errors. + // We fallback to a maintenance page at this point, because the page + // generation itself can generate errors. // Should not translate the string to avoid errors producing more errors. $message = 'The website encountered an unexpected error. Try again later.' . '<br />' . $message; diff --git a/core/includes/form.inc b/core/includes/form.inc index 238f4ac96d8..945c625dcb6 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -84,8 +84,8 @@ function form_select_options($element, $choices = NULL) { unset($choices['#sort_start']); } - // array_key_exists() accommodates the rare event where $element['#value'] is NULL. - // isset() fails in this situation. + // array_key_exists() accommodates the rare event where $element['#value'] is + // NULL. isset() fails in this situation. $value_valid = \array_key_exists('#value', $element); $value_is_array = $value_valid && is_array($element['#value']); // Check if the element is multiple select and no value has been selected. @@ -934,7 +934,8 @@ function batch_process($redirect = NULL, ?Url $url = NULL, $redirect_callback = // Store the batch. \Drupal::service(BatchStorageInterface::class)->create($batch); - // Set the batch number in the session to guarantee that it will stay alive. + // Set the batch number in the session to guarantee that it will stay + // alive. $session = \Drupal::request()->getSession(); $batches = $session->get('batches', []); $batches[$batch['id']] = TRUE; diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 2e774a8fb06..b1c6683eec8 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1835,8 +1835,8 @@ function _install_prepare_import($langcodes, $server_pattern) { // version number. if (isset($matches[1]) && $version = $matches[1]) { $info = _install_get_version_info($version); - // Picking the first file does not necessarily result in the right file. So - // we check if at least the major version number is available. + // Picking the first file does not necessarily result in the right file. + // So we check if at least the major version number is available. if ($info['major']) { $core = $info['major'] . '.x'; $data = [ diff --git a/core/includes/theme.inc b/core/includes/theme.inc index e781e0d5835..21a6f7a87f5 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -825,8 +825,8 @@ function template_preprocess_table(&$variables): void { // Track responsive classes for each column as needed. Only the header // cells for a column are marked up with the responsive classes by a - // module developer or themer. The responsive classes on the header cells - // must be transferred to the content cells. + // module developer or themer. The responsive classes on the header + // cells must be transferred to the content cells. if (!empty($cell['class']) && is_array($cell['class'])) { if (in_array(RESPONSIVE_PRIORITY_MEDIUM, $cell['class'])) { $responsive_classes[$responsive_index] = RESPONSIVE_PRIORITY_MEDIUM; diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index dab448749dd..528a3a89bbc 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -27,7 +27,8 @@ function _drupal_maintenance_theme() { require_once __DIR__ . '/common.inc'; require_once __DIR__ . '/module.inc'; - // Install and update pages are treated differently to prevent theming overrides. + // Install and update pages are treated differently to prevent theming + // overrides. if (defined('MAINTENANCE_MODE') && (MAINTENANCE_MODE == 'install' || MAINTENANCE_MODE == 'update')) { if (InstallerKernel::installationAttempted()) { $custom_theme = $GLOBALS['install_state']['theme']; diff --git a/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php index 066de2072c4..5eb9cfc7af4 100644 --- a/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -123,7 +123,8 @@ class AnnotatedClassDiscovery implements DiscoveryInterface { if ($fileinfo->getExtension() == 'php') { if ($cached = $this->fileCache->get($fileinfo->getPathName())) { if (isset($cached['id'])) { - // Explicitly unserialize this to create a new object instance. + // Explicitly unserialize this to create a new object + // instance. $definitions[$cached['id']] = unserialize($cached['content']); } continue; diff --git a/core/lib/Drupal/Component/Datetime/DateTimePlus.php b/core/lib/Drupal/Component/Datetime/DateTimePlus.php index bb3a9b97891..d37dc44e96a 100644 --- a/core/lib/Drupal/Component/Datetime/DateTimePlus.php +++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php @@ -262,11 +262,11 @@ class DateTimePlus { $datetime_plus->setTimestamp($date->getTimestamp()); $datetime_plus->setTimezone($date->getTimezone()); - // Functions that parse date is forgiving, it might create a date that - // is not exactly a match for the provided value, so test for that by - // re-creating the date/time formatted string and comparing it to the input. For - // instance, an input value of '11' using a format of Y (4 digits) gets - // created as '0011' instead of '2011'. + // Functions that parse date is forgiving, it might create a date that is + // not exactly a match for the provided value, so test for that by + // re-creating the date/time formatted string and comparing it to the + // input. For instance, an input value of '11' using a format of Y (4 + // digits) gets created as '0011' instead of '2011'. if ($settings['validate_format'] && $date->format($format) != $time) { throw new \UnexpectedValueException('The created date does not match the input value.'); } diff --git a/core/lib/Drupal/Component/FileCache/FileCacheFactory.php b/core/lib/Drupal/Component/FileCache/FileCacheFactory.php index ca68757bc8a..922074213b8 100644 --- a/core/lib/Drupal/Component/FileCache/FileCacheFactory.php +++ b/core/lib/Drupal/Component/FileCache/FileCacheFactory.php @@ -39,7 +39,8 @@ class FileCacheFactory { * The initialized FileCache object. */ public static function get($collection, $default_configuration = []) { - // If there is a special key in the configuration, disable FileCache completely. + // If there is a special key in the configuration, disable FileCache + // completely. if (!empty(static::$configuration[static::DISABLE_CACHE])) { return new NullFileCache('', ''); } diff --git a/core/lib/Drupal/Component/FileSystem/FileSystem.php b/core/lib/Drupal/Component/FileSystem/FileSystem.php index a0486604316..b4e8389d755 100644 --- a/core/lib/Drupal/Component/FileSystem/FileSystem.php +++ b/core/lib/Drupal/Component/FileSystem/FileSystem.php @@ -37,8 +37,8 @@ class FileSystem { foreach ($directories as $directory) { if (is_dir($directory) && is_writable($directory)) { - // Both sys_get_temp_dir() and ini_get('upload_tmp_dir') can return paths - // with a trailing directory separator. + // Both sys_get_temp_dir() and ini_get('upload_tmp_dir') can return + // paths with a trailing directory separator. return rtrim($directory, DIRECTORY_SEPARATOR); } } diff --git a/core/lib/Drupal/Component/Gettext/PoStreamReader.php b/core/lib/Drupal/Component/Gettext/PoStreamReader.php index 46a18498aee..4aa14541e66 100644 --- a/core/lib/Drupal/Component/Gettext/PoStreamReader.php +++ b/core/lib/Drupal/Component/Gettext/PoStreamReader.php @@ -337,7 +337,8 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface { $this->currentItem = []; } elseif ($this->context == 'MSGID') { - // We are currently already in the context, meaning we passed an id with no data. + // We are currently already in the context, meaning we passed an id + // with no data. $this->errors[] = new FormattableMarkup('The translation stream %uri contains an error: "msgid" is unexpected on line %line.', $log_vars); return FALSE; } @@ -455,7 +456,8 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface { return; } elseif ($line != '') { - // Anything that is not a token may be a continuation of a previous token. + // Anything that is not a token may be a continuation of a previous + // token. $quoted = $this->parseQuoted($line); if ($quoted === FALSE) { diff --git a/core/lib/Drupal/Component/Graph/Graph.php b/core/lib/Drupal/Component/Graph/Graph.php index bae085f65e6..d0a9381a54e 100644 --- a/core/lib/Drupal/Component/Graph/Graph.php +++ b/core/lib/Drupal/Component/Graph/Graph.php @@ -101,7 +101,8 @@ class Graph { * @see \Drupal\Component\Graph\Graph::searchAndSort() */ protected function depthFirstSearch(&$state, $start, &$component = NULL) { - // Assign new component for each new vertex, i.e. when not called recursively. + // Assign new component for each new vertex, i.e. when not called + // recursively. if (!isset($component)) { $component = $start; } diff --git a/core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php b/core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php index 59a220d4f1a..cc7cb5f1684 100644 --- a/core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php +++ b/core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php @@ -71,7 +71,8 @@ class AttributeClassDiscovery implements DiscoveryInterface { if ($fileinfo->getExtension() === 'php') { if ($cached = $this->fileCache->get($fileinfo->getPathName())) { if (isset($cached['id'])) { - // Explicitly unserialize this to create a new object instance. + // Explicitly unserialize this to create a new object + // instance. $definitions[$cached['id']] = unserialize($cached['content']); } continue; diff --git a/core/lib/Drupal/Component/Utility/DeprecationHelper.php b/core/lib/Drupal/Component/Utility/DeprecationHelper.php index 398d2811d49..f9a4aebba43 100644 --- a/core/lib/Drupal/Component/Utility/DeprecationHelper.php +++ b/core/lib/Drupal/Component/Utility/DeprecationHelper.php @@ -37,8 +37,9 @@ final class DeprecationHelper { * @template Deprecated */ public static function backwardsCompatibleCall(string $currentVersion, string $deprecatedVersion, callable $currentCallable, callable $deprecatedCallable): mixed { - // Normalize the version string when it's a dev version to the first point release of that minor. E.g. 10.2.x-dev - // and 10.2-dev both translate to 10.2.0 + // Normalize the version string when it's a dev version to the first point + // release of that minor. E.g. 10.2.x-dev and 10.2-dev both translate to + // 10.2.0 $normalizedVersion = str_ends_with($currentVersion, '-dev') ? str_replace(['.x-dev', '-dev'], '.0', $currentVersion) : $currentVersion; return version_compare($normalizedVersion, $deprecatedVersion, '>=') ? $currentCallable() : $deprecatedCallable(); diff --git a/core/lib/Drupal/Component/Utility/Html.php b/core/lib/Drupal/Component/Utility/Html.php index 31a89e62ea1..dc9fbb26757 100644 --- a/core/lib/Drupal/Component/Utility/Html.php +++ b/core/lib/Drupal/Component/Utility/Html.php @@ -129,7 +129,8 @@ class Html { // - ISO 10646 characters U+00A1 and higher // We strip out any character not in the above list. $identifier = preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $identifier); - // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. + // Identifiers cannot start with a digit, two hyphens, or a hyphen followed + // by a digit. $identifier = preg_replace([ '/^[0-9]/', '/^(-[0-9])|^(--)/', @@ -225,12 +226,12 @@ class Html { public static function getId($id) { $id = str_replace([' ', '_', '[', ']'], ['-', '-', '-', ''], mb_strtolower($id)); - // As defined in https://www.w3.org/TR/html4/types.html#type-name, HTML IDs can - // only contain letters, digits ([0-9]), hyphens ("-"), underscores ("_"), - // colons (":"), and periods ("."). We strip out any character not in that - // list. Note that the CSS spec doesn't allow colons or periods in identifiers - // (https://www.w3.org/TR/CSS21/syndata.html#characters), so we strip those two - // characters as well. + // As defined in https://www.w3.org/TR/html4/types.html#type-name, HTML IDs + // can only contain letters, digits ([0-9]), hyphens ("-"), underscores + // ("_"), colons (":"), and periods ("."). We strip out any character not in + // that list. Note that the CSS spec doesn't allow colons or periods in + // identifiers (https://www.w3.org/TR/CSS21/syndata.html#characters), so we + // strip those two characters as well. $id = preg_replace('/[^A-Za-z0-9\-_]/', '', $id); // Removing multiple consecutive hyphens. diff --git a/core/lib/Drupal/Component/Utility/NestedArray.php b/core/lib/Drupal/Component/Utility/NestedArray.php index b26eec3e46a..7f943fd9791 100644 --- a/core/lib/Drupal/Component/Utility/NestedArray.php +++ b/core/lib/Drupal/Component/Utility/NestedArray.php @@ -147,8 +147,8 @@ class NestedArray { public static function setValue(array &$array, array $parents, $value, $force = FALSE) { $ref = &$array; foreach ($parents as $parent) { - // PHP auto-creates container arrays and NULL entries without error if $ref - // is NULL, but throws an error if $ref is set, but not an array. + // PHP auto-creates container arrays and NULL entries without error if + // $ref is NULL, but throws an error if $ref is set, but not an array. if (isset($ref) && !is_array($ref)) { if (!$force) { throw new \LogicException('Cannot create key "' . $parent . '" on non-array value.'); diff --git a/core/lib/Drupal/Component/Utility/Number.php b/core/lib/Drupal/Component/Utility/Number.php index 7fbcb03ef2e..6c7c0ab6bbd 100644 --- a/core/lib/Drupal/Component/Utility/Number.php +++ b/core/lib/Drupal/Component/Utility/Number.php @@ -48,8 +48,8 @@ class Number { // $remainder is a double precision floating point number. Remainders that // can't be represented with single precision floats are acceptable. The - // fractional part of a float has 24 bits. That means remainders smaller than - // $step * 2^-24 are acceptable. + // fractional part of a float has 24 bits. That means remainders smaller + // than $step * 2^-24 are acceptable. $computed_acceptable_error = (double) ($step / pow(2.0, 24)); return $computed_acceptable_error >= $remainder || $remainder >= ($step - $computed_acceptable_error); diff --git a/core/lib/Drupal/Component/Utility/Unicode.php b/core/lib/Drupal/Component/Utility/Unicode.php index 07533665622..c7228d18c55 100644 --- a/core/lib/Drupal/Component/Utility/Unicode.php +++ b/core/lib/Drupal/Component/Utility/Unicode.php @@ -328,9 +328,9 @@ EOD; if ($wordsafe) { $matches = []; - // Find the last word boundary, if there is one within $min_wordsafe_length - // to $max_length characters. preg_match() is always greedy, so it will - // find the longest string possible. + // Find the last word boundary, if there is one within + // $min_wordsafe_length to $max_length characters. preg_match() is always + // greedy, so it will find the longest string possible. $found = preg_match('/^(.{' . $min_wordsafe_length . ',' . $max_length . '})[' . Unicode::PREG_CLASS_WORD_BOUNDARY . ']/us', $string, $matches); if ($found) { $string = $matches[1]; diff --git a/core/lib/Drupal/Component/Utility/UrlHelper.php b/core/lib/Drupal/Component/Utility/UrlHelper.php index 135d7e0cbdf..9ad996c2398 100644 --- a/core/lib/Drupal/Component/Utility/UrlHelper.php +++ b/core/lib/Drupal/Component/Utility/UrlHelper.php @@ -409,8 +409,8 @@ class UrlHelper { // We found a colon, possibly a protocol. Verify. $protocol = substr($uri, 0, $colon_position); // If a colon is preceded by a slash, question mark or hash, it cannot - // possibly be part of the URL scheme. This must be a relative URL, which - // inherits the (safe) protocol of the base document. + // possibly be part of the URL scheme. This must be a relative URL, + // which inherits the (safe) protocol of the base document. if (preg_match('![/?#]!', $protocol)) { break; } diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php index 369d47ac0e9..db55fe16caf 100644 --- a/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php +++ b/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php @@ -192,7 +192,8 @@ class EmailAction extends ConfigurableActionBase implements ContainerFactoryPlug */ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { if (!$this->emailValidator->isValid($form_state->getValue('recipient')) && !str_contains($form_state->getValue('recipient'), ':mail')) { - // We want the literal %author placeholder to be emphasized in the error message. + // We want the literal %author placeholder to be emphasized in the error + // message. $form_state->setErrorByName('recipient', $this->t('Enter a valid email address or use a token email address such as %author.', ['%author' => '[node:author:mail]'])); } } diff --git a/core/lib/Drupal/Core/Asset/CssOptimizer.php b/core/lib/Drupal/Core/Asset/CssOptimizer.php index c7ad2920987..062b4d42286 100644 --- a/core/lib/Drupal/Core/Asset/CssOptimizer.php +++ b/core/lib/Drupal/Core/Asset/CssOptimizer.php @@ -90,7 +90,8 @@ class CssOptimizer implements AssetOptimizerInterface { // Store base path. $this->rewriteFileURIBasePath = $css_base_path . '/'; - // Anchor all paths in the CSS with its base URL, ignoring external and absolute paths and paths starting with '#'. + // Anchor all paths in the CSS with its base URL, ignoring external and + // absolute paths and paths starting with '#'. return preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+|#|%23)([^\'")]+)[\'"]?\s*\)/i', [$this, 'rewriteFileURI'], $contents); } @@ -151,7 +152,8 @@ class CssOptimizer implements AssetOptimizerInterface { if ($encoding = (Unicode::encodingFromBOM($contents))) { $contents = mb_substr(Unicode::convertToUtf8($contents, $encoding), 1); } - // If no BOM, check for fallback encoding. Per CSS spec the regex is very strict. + // If no BOM, check for fallback encoding. Per CSS spec the regex is very + // strict. elseif (preg_match('/^@charset "([^"]+)";/', $contents, $matches)) { if ($matches[1] !== 'utf-8' && $matches[1] !== 'UTF-8') { $contents = substr($contents, strlen($matches[0])); diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationCollector.php b/core/lib/Drupal/Core/Authentication/AuthenticationCollector.php index dc20e051874..570d5321b51 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationCollector.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationCollector.php @@ -71,7 +71,8 @@ class AuthenticationCollector implements AuthenticationCollectorInterface { // Sort the providers according to priority. krsort($this->providerOrders); - // Merge nested providers from $this->providers into $this->sortedProviders. + // Merge nested providers from $this->providers into + // $this->sortedProviders. $this->sortedProviders = array_merge(...$this->providerOrders); } diff --git a/core/lib/Drupal/Core/Batch/Percentage.php b/core/lib/Drupal/Core/Batch/Percentage.php index e6c911945a3..48c8d885c63 100644 --- a/core/lib/Drupal/Core/Batch/Percentage.php +++ b/core/lib/Drupal/Core/Batch/Percentage.php @@ -41,9 +41,9 @@ class Percentage { $percentage = sprintf('%01.' . $decimal_places . 'f', round($current / $total * 100, $decimal_places)); // When $current is an integer, the above calculation will always be // correct. However, if $current is a floating point number (in the case - // of a multi-step batch operation that is not yet complete), $percentage - // may be erroneously rounded up to 100%. To prevent that, we add one - // more decimal place and try again. + // of a multi-step batch operation that is not yet complete), + // $percentage may be erroneously rounded up to 100%. To prevent that, + // we add one more decimal place and try again. $decimal_places++; } while ($percentage == '100'); } diff --git a/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php b/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php index 9ee43fa8d8c..9c36bcb0fed 100644 --- a/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php @@ -26,8 +26,8 @@ class CookiesCacheContext extends RequestStackCacheContextBase implements Calcul public function getContext($cookie = NULL) { if ($cookie === NULL) { $cookies = $this->requestStack->getCurrentRequest()->cookies->all(); - // Sort the cookies by names, to always set the same context if the cookies - // are the same but in a different order. + // Sort the cookies by names, to always set the same context if the + // cookies are the same but in a different order. ksort($cookies); // Use http_build_query() to get a short string from the cookies array. return http_build_query($cookies); diff --git a/core/lib/Drupal/Core/Command/ServerCommand.php b/core/lib/Drupal/Core/Command/ServerCommand.php index 776cfdab3d6..6ec1b992eb7 100644 --- a/core/lib/Drupal/Core/Command/ServerCommand.php +++ b/core/lib/Drupal/Core/Command/ServerCommand.php @@ -245,8 +245,8 @@ class ServerCommand extends Command { $server = proc_open($process->getCommandLine(), $descriptors, $pipes, $kernel->getAppRoot()); if (is_resource($server)) { if ($io->isVerbose()) { - // Write a blank line so that server output and the useful information are - // visually separated. + // Write a blank line so that server output and the useful information + // are visually separated. $io->writeln(''); } $server_status = proc_get_status($server); diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 81b5cfcb68f..3113aed2424 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -198,8 +198,8 @@ class ConfigInstaller implements ConfigInstallerInterface { // @see install_install_profile() $profile_installed = in_array($this->drupalGetProfile(), $this->getEnabledExtensions(), TRUE); if (!$this->isSyncing() && (!InstallerKernel::installationAttempted() || $profile_installed)) { - // Install any optional configuration entities whose dependencies can now - // be met. This searches all the installed modules config/optional + // Install any optional configuration entities whose dependencies can + // now be met. This searches all the installed modules config/optional // directories. $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, FALSE, $this->installProfile); $this->installOptionalConfig($storage, [$type => $name]); @@ -555,7 +555,8 @@ class ConfigInstaller implements ConfigInstallerInterface { $previous_config_names = []; foreach ($names as $name) { - // Add the extension that will be enabled to the list of enabled extensions. + // Add the extension that will be enabled to the list of enabled + // extensions. $enabled_extensions[] = $name; $config_install_path = $this->getDefaultConfigDirectory($type, $name); @@ -580,9 +581,10 @@ class ConfigInstaller implements ConfigInstallerInterface { // Install profiles can not have config clashes. Configuration that // has the same name as a module's configuration will be used instead. if ($name !== $this->drupalGetProfile()) { - // Throw an exception if the module being installed contains configuration - // that already exists. Additionally, can not continue installing more - // modules because those may depend on the current module being installed. + // Throw an exception if the module being installed contains + // configuration that already exists. Additionally, can not continue + // installing more modules because those may depend on the current + // module being installed. $existing_configuration = $this->findPreExistingConfiguration($storage, $previous_config_names); if (!empty($existing_configuration)) { throw PreExistingConfigException::create($name, $existing_configuration); diff --git a/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php index 72e33d1c542..21b40363398 100644 --- a/core/lib/Drupal/Core/Config/ConfigManager.php +++ b/core/lib/Drupal/Core/Config/ConfigManager.php @@ -166,9 +166,10 @@ class ConfigManager implements ConfigManagerInterface { if (!isset($target_name)) { $target_name = $source_name; } - // The output should show configuration object differences formatted as YAML. - // But the configuration is not necessarily stored in files. Therefore, they - // need to be read and parsed, and lastly, dumped into YAML strings. + // The output should show configuration object differences formatted as + // YAML. But the configuration is not necessarily stored in files. + // Therefore, they need to be read and parsed, and lastly, dumped into YAML + // strings. $source_data = explode("\n", Yaml::encode($source_storage->read($source_name))); $target_data = explode("\n", Yaml::encode($target_storage->read($target_name))); diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php index dfc6f71a7a1..3b15335a205 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php @@ -195,8 +195,8 @@ class ConfigEntityType extends EntityType implements ConfigEntityTypeInterface { // If there is an ID key for this config entity type, make it immutable by // default. Individual config entities can override this with an - // `ImmutableProperties` constraint in their definition that is either empty, - // or with an alternative set of immutable properties. + // `ImmutableProperties` constraint in their definition that is either + // empty, or with an alternative set of immutable properties. $id_key = $this->getKey('id'); if ($id_key) { $constraints += [ diff --git a/core/lib/Drupal/Core/Config/Schema/Mapping.php b/core/lib/Drupal/Core/Config/Schema/Mapping.php index 3f555e0a081..22f3040a6f7 100644 --- a/core/lib/Drupal/Core/Config/Schema/Mapping.php +++ b/core/lib/Drupal/Core/Config/Schema/Mapping.php @@ -166,7 +166,8 @@ class Mapping extends ArrayElement { $all_type_definitions = $typed_data_manager->getDefinitions(); $possible_type_definitions = array_intersect_key($all_type_definitions, array_fill_keys($possible_types, TRUE)); // TRICKY: \Drupal\Core\Config\TypedConfigManager::getDefinition() does the - // necessary resolving, but TypedConfigManager::getDefinitions() does not! 🤷♂️ + // necessary resolving, but TypedConfigManager::getDefinitions() does not! + // 🤷♂️ // @see \Drupal\Core\Config\TypedConfigManager::getDefinitionWithReplacements() // @see ::getValidKeys() $valid_keys_per_type = []; diff --git a/core/lib/Drupal/Core/CoreServiceProvider.php b/core/lib/Drupal/Core/CoreServiceProvider.php index 959ca643c44..7f0c897b654 100644 --- a/core/lib/Drupal/Core/CoreServiceProvider.php +++ b/core/lib/Drupal/Core/CoreServiceProvider.php @@ -56,7 +56,8 @@ class CoreServiceProvider implements ServiceProviderInterface, ServiceModifierIn public function register(ContainerBuilder $container) { $this->registerTest($container); - // Only register the private file stream wrapper if a file path has been set. + // Only register the private file stream wrapper if a file path has been + // set. if (Settings::get('file_private_path')) { $container->register('stream_wrapper.private', 'Drupal\Core\StreamWrapper\PrivateStream') ->addTag('stream_wrapper', ['scheme' => 'private']); diff --git a/core/lib/Drupal/Core/Database/Query/Insert.php b/core/lib/Drupal/Core/Database/Query/Insert.php index 3bae7ab74bd..4657e5c3e5e 100644 --- a/core/lib/Drupal/Core/Database/Query/Insert.php +++ b/core/lib/Drupal/Core/Database/Query/Insert.php @@ -149,8 +149,8 @@ class Insert extends Query implements \Countable { // We have to assume that the used aliases match the insert fields. // Regular fields are added to the query before expressions, maintain the // same order for the insert fields. - // This behavior can be overridden by calling fields() manually as only the - // first call to fields() does have an effect. + // This behavior can be overridden by calling fields() manually as only + // the first call to fields() does have an effect. $this->fields(array_merge(array_keys($this->fromQuery->getFields()), array_keys($this->fromQuery->getExpressions()))); } else { diff --git a/core/lib/Drupal/Core/Database/Query/InsertTrait.php b/core/lib/Drupal/Core/Database/Query/InsertTrait.php index 808c9f53a11..dff1d86d98c 100644 --- a/core/lib/Drupal/Core/Database/Query/InsertTrait.php +++ b/core/lib/Drupal/Core/Database/Query/InsertTrait.php @@ -155,8 +155,8 @@ trait InsertTrait { foreach ($nested_insert_values as $insert_values) { $placeholders = []; - // Default fields aren't really placeholders, but this is the most convenient - // way to handle them. + // Default fields aren't really placeholders, but this is the most + // convenient way to handle them. $placeholders = array_pad($placeholders, count($default_fields), 'default'); $new_placeholder = $max_placeholder + count($insert_values); @@ -168,7 +168,8 @@ trait InsertTrait { } } else { - // If there are no values, then this is a default-only query. We still need to handle that. + // If there are no values, then this is a default-only query. We still + // need to handle that. $placeholders = array_fill(0, count($default_fields), 'default'); $values[] = '(' . implode(', ', $placeholders) . ')'; } diff --git a/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php b/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php index 91e79d7c09c..7dd41ec1323 100644 --- a/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php +++ b/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php @@ -77,7 +77,8 @@ class PagerSelectExtender extends SelectExtender { $pager = $this->connection->getPagerManager()->createPager($total_items, $this->limit, $this->element); $this->range($pager->getCurrentPage() * $this->limit, $this->limit); - // Now that we've added our pager-based range instructions, run the query normally. + // Now that we've added our pager-based range instructions, run the query + // normally. return $this->query->execute(); } diff --git a/core/lib/Drupal/Core/Database/Query/Select.php b/core/lib/Drupal/Core/Database/Query/Select.php index 295fd46a0a6..d284ea285a5 100644 --- a/core/lib/Drupal/Core/Database/Query/Select.php +++ b/core/lib/Drupal/Core/Database/Query/Select.php @@ -511,8 +511,8 @@ class Select extends Query implements SelectInterface { * {@inheritdoc} */ public function execute() { - // If validation fails, simply return NULL. - // Note that validation routines in preExecute() may throw exceptions instead. + // If validation fails, simply return NULL. Note that validation routines in + // preExecute() may throw exceptions instead. if (!$this->preExecute()) { return NULL; } @@ -543,7 +543,8 @@ class Select extends Query implements SelectInterface { $alias = $table_alias . '_' . $field; } - // If that is already used, just add a counter until we find an unused alias. + // If that is already used, just add a counter until we find an unused + // alias. $alias_candidate = $alias; $count = 2; while (!empty($this->fields[$alias_candidate])) { @@ -762,8 +763,8 @@ class Select extends Query implements SelectInterface { } } - // Also remove 'all_fields' statements, which are expanded into tablename.* - // when the query is executed. + // Also remove 'all_fields' statements, which are expanded into + // tablename.* when the query is executed. foreach ($count->tables as &$table) { unset($table['all_fields']); } @@ -780,7 +781,8 @@ class Select extends Query implements SelectInterface { if ($count->distinct && !empty($group_by)) { // If the query is distinct and contains a GROUP BY, we need to remove the - // distinct because SQL99 does not support counting on distinct multiple fields. + // distinct because SQL99 does not support counting on distinct multiple + // fields. $count->distinct = FALSE; } @@ -834,7 +836,8 @@ class Select extends Query implements SelectInterface { } $query .= implode(', ', $fields); - // FROM - We presume all queries have a FROM, as any query that doesn't won't need the query builder anyway. + // FROM - We presume all queries have a FROM, as any query that doesn't + // won't need the query builder anyway. $query .= "\nFROM"; foreach ($this->tables as $table) { $query .= "\n"; @@ -842,7 +845,8 @@ class Select extends Query implements SelectInterface { $query .= $table['join type'] . ' JOIN '; } - // If the table is a subquery, compile it and integrate it into this query. + // If the table is a subquery, compile it and integrate it into this + // query. if ($table['table'] instanceof SelectInterface) { // Run preparation steps on this sub-query before converting to string. $subquery = $table['table']; diff --git a/core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php b/core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php index df91f670d52..aa663d94226 100644 --- a/core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php +++ b/core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php @@ -379,8 +379,8 @@ abstract class TransactionManagerBase implements TransactionManagerInterface { // transaction. The transaction is closed. $this->processRootRollback(); if ($this->getConnectionTransactionState() === ClientConnectionTransactionState::RolledBack) { - // The Transaction object remains open, and when it will get destructed - // no commit should happen. Void the stack item. + // The Transaction object remains open, and when it will get + // destructed no commit should happen. Void the stack item. $this->voidStackItem($id); } } diff --git a/core/lib/Drupal/Core/Datetime/DateFormatter.php b/core/lib/Drupal/Core/Datetime/DateFormatter.php index db5404fec16..91581d37649 100644 --- a/core/lib/Drupal/Core/Datetime/DateFormatter.php +++ b/core/lib/Drupal/Core/Datetime/DateFormatter.php @@ -270,7 +270,8 @@ class DateFormatter implements DateFormatterInterface { } else { // If we did not output days, set the granularity to 0 so that we - // will not output hours and get things like "@count week @count hour". + // will not output hours and get things like "@count week @count + // hour". $granularity = 0; } break; @@ -296,7 +297,8 @@ class DateFormatter implements DateFormatterInterface { } elseif ($output) { // Break if there was previous output but not any output at this level, - // to avoid skipping levels and getting output like "@count year @count second". + // to avoid skipping levels and getting output like "@count year @count + // second". break; } diff --git a/core/lib/Drupal/Core/Datetime/Element/Datelist.php b/core/lib/Drupal/Core/Datetime/Element/Datelist.php index bd8e5d2860c..97152b6a25e 100644 --- a/core/lib/Drupal/Core/Datetime/Element/Datelist.php +++ b/core/lib/Drupal/Core/Datetime/Element/Datelist.php @@ -345,7 +345,8 @@ class Datelist extends DateElementBase { // The object key does not represent an input value, see // \Drupal\Core\Datetime\Element\Datelist::valueCallback(). unset($input['object']); - // Filters out empty array values, any valid value would have a string length. + // Filters out empty array values, any valid value would have a string + // length. $filtered_input = FilterArray::removeEmptyStrings($input); return array_diff($parts, array_keys($filtered_input)); } diff --git a/core/lib/Drupal/Core/DefaultContent/Importer.php b/core/lib/Drupal/Core/DefaultContent/Importer.php index c54ba0e1168..26b0695537b 100644 --- a/core/lib/Drupal/Core/DefaultContent/Importer.php +++ b/core/lib/Drupal/Core/DefaultContent/Importer.php @@ -368,12 +368,11 @@ final class Importer implements LoggerAwareInterface { private function verifyNormalizedLanguage(array $data): array { $default_langcode = $data['_meta']['default_langcode']; $default_language = $this->languageManager->getDefaultLanguage(); - // Check the language. If the default language isn't known, import as one - // of the available translations if one exists with those values. If none - // exists, create the entity in the default language. - // During the installer, when installing with an alternative language, - // `en` is still the default when modules are installed so check the default language - // instead. + // Check the language. If the default language isn't known, import as one of + // the available translations if one exists with those values. If none + // exists, create the entity in the default language. During the installer, + // when installing with an alternative language, `en` is still the default + // when modules are installed so check the default language instead. if (!$this->languageManager->getLanguage($default_langcode) || (InstallerKernel::installationAttempted() && $default_language->getId() !== $default_langcode)) { $use_default = TRUE; foreach ($data['translations'] ?? [] as $langcode => $translation_data) { diff --git a/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php b/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php index 6e6cabd244c..6be8704e166 100644 --- a/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php +++ b/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php @@ -53,8 +53,8 @@ trait DependencySerializationTrait { } elseif ($service_id = $reverse_container->getId($value)) { // If a class member was instantiated by the dependency injection - // container, only store its ID so it can be used to get a fresh object - // on unserialization. + // container, only store its ID so it can be used to get a fresh + // object on unserialization. $this->_serviceIds[$key] = $service_id; unset($vars[$key]); } diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index b475adb53fd..c0f9befe71a 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -1019,9 +1019,9 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { if ($test_prefix = drupal_valid_test_ua()) { $test_db = new TestDatabase($test_prefix); // Only code that interfaces directly with tests should rely on this - // constant; e.g., the error/exception handler conditionally adds further - // error information into HTTP response headers that are consumed by - // the internal browser. + // constant; e.g., the error/exception handler conditionally adds + // further error information into HTTP response headers that are + // consumed by the internal browser. define('DRUPAL_TEST_IN_CHILD_SITE', TRUE); // Log fatal errors to the test site directory. diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index e787bfc21de..28a261697c4 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -233,8 +233,8 @@ abstract class ContentEntityBase extends EntityBase implements \IteratorAggregat } } else { - // We save translatable fields such as the publishing status of a node - // into an entity key array keyed by langcode as a performance + // We save translatable fields such as the publishing status of a + // node into an entity key array keyed by langcode as a performance // optimization, so we don't have to go through TypedData when we // need these values. foreach ($this->values[$field_name] as $langcode => $field_value) { diff --git a/core/lib/Drupal/Core/Entity/EntityTypeBundleInfo.php b/core/lib/Drupal/Core/Entity/EntityTypeBundleInfo.php index 8aef5ee039e..0d763133855 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeBundleInfo.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeBundleInfo.php @@ -93,8 +93,8 @@ class EntityTypeBundleInfo implements EntityTypeBundleInfoInterface { else { $this->bundleInfo = $this->moduleHandler->invokeAll('entity_bundle_info'); foreach ($this->entityTypeManager->getDefinitions() as $type => $entity_type) { - // First look for entity types that act as bundles for others, load them - // and add them as bundles. + // First look for entity types that act as bundles for others, load + // them and add them as bundles. if ($bundle_entity_type = $entity_type->getBundleEntityType()) { foreach ($this->entityTypeManager->getStorage($bundle_entity_type)->loadMultiple() as $entity) { $this->bundleInfo[$type][$entity->id()]['label'] = $entity->label(); diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php index 7b813c309ec..eeb714f6ad4 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php @@ -944,8 +944,9 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt ->fields((array) $record) ->execute(); // Even if this is a new entity the ID key might have been set, in which - // case we should not override the provided ID. An ID key that is not set - // to any value is interpreted as NULL (or DEFAULT) and thus overridden. + // case we should not override the provided ID. An ID key that is not + // set to any value is interpreted as NULL (or DEFAULT) and thus + // overridden. if (!isset($record->{$this->idKey})) { $record->{$this->idKey} = $insert_id; } diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index eef672700fe..087ac1e1d24 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -766,8 +766,9 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage try { if ($this->database->supportsTransactionalDDL()) { - // If the database supports transactional DDL, we can go ahead and rely - // on it. If not, we will have to rollback manually if something fails. + // If the database supports transactional DDL, we can go ahead and + // rely on it. If not, we will have to rollback manually if something + // fails. $transaction = $this->database->startTransaction(); } @@ -1724,8 +1725,9 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage // There is no data. Re-create the tables completely. try { if ($this->database->supportsTransactionalDDL()) { - // If the database supports transactional DDL, we can go ahead and rely - // on it. If not, we will have to rollback manually if something fails. + // If the database supports transactional DDL, we can go ahead and + // rely on it. If not, we will have to rollback manually if something + // fails. $transaction = $this->database->startTransaction(); } // Since there is no data we may be switching from a shared table schema @@ -1817,8 +1819,9 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage if (!$this->storage->countFieldData($original, TRUE)) { try { if ($this->database->supportsTransactionalDDL()) { - // If the database supports transactional DDL, we can go ahead and rely - // on it. If not, we will have to rollback manually if something fails. + // If the database supports transactional DDL, we can go ahead and + // rely on it. If not, we will have to rollback manually if something + // fails. $transaction = $this->database->startTransaction(); } // Since there is no data we may be switching from a dedicated table diff --git a/core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php index 2491b6cd698..69727c1d19b 100644 --- a/core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php @@ -82,10 +82,10 @@ class AjaxResponseSubscriber implements EventSubscriberInterface { if (str_contains($accept, 'text/html')) { $response->headers->set('Content-Type', 'text/html; charset=utf-8'); - // Browser IFRAMEs expect HTML. Browser extensions, such as Linkification - // and Skype's Browser Highlighter, convert URLs, phone numbers, etc. - // into links. This corrupts the JSON response. Protect the integrity of - // the JSON data by making it the value of a textarea. + // Browser IFRAMEs expect HTML. Browser extensions, such as + // Linkification and Skype's Browser Highlighter, convert URLs, phone + // numbers, etc. into links. This corrupts the JSON response. Protect + // the integrity of the JSON data by making it the value of a textarea. // @see http://malsup.com/jquery/form/#file-upload // @see https://www.drupal.org/node/1009382 $response->setContent('<textarea>' . $response->getContent() . '</textarea>'); diff --git a/core/lib/Drupal/Core/Extension/InfoParser.php b/core/lib/Drupal/Core/Extension/InfoParser.php index e44ef41e773..7f912f6c741 100644 --- a/core/lib/Drupal/Core/Extension/InfoParser.php +++ b/core/lib/Drupal/Core/Extension/InfoParser.php @@ -31,9 +31,9 @@ class InfoParser extends InfoParserDynamic { } else { // Just use a static file cache when there is no prefix. This code path is - // triggered when info is parsed prior to \Drupal\Core\DrupalKernel::boot() - // running. This occurs during the very early installer and in some test - // scenarios. + // triggered when info is parsed prior to + // \Drupal\Core\DrupalKernel::boot() running. This occurs during the very + // early installer and in some test scenarios. $this->fileCache = new FileCache('info_parser', 'info_parser'); } } diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 77ed2e29aba..b1b794bca58 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -722,10 +722,10 @@ class ModuleInstaller implements ModuleInstallerInterface { $source_storage = $config_installer->getSourceStorage(); if (!empty($module_filenames)) { - // This reboots the kernel to register the module's bundle and its services - // in the service container. The $module_filenames argument is taken over as - // %container.modules% parameter, which is passed to a fresh ModuleHandler - // instance upon first retrieval. + // This reboots the kernel to register the module's bundle and its + // services in the service container. The $module_filenames argument is + // taken over as %container.modules% parameter, which is passed to a fresh + // ModuleHandler instance upon first retrieval. $this->kernel->updateModules($module_filenames, $module_filenames); $container = $this->kernel->getContainer(); } diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php index c48eb0f8391..fd21961935c 100644 --- a/core/lib/Drupal/Core/Field/WidgetBase.php +++ b/core/lib/Drupal/Core/Field/WidgetBase.php @@ -352,7 +352,8 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface, // Add a DIV around the delta receiving the Ajax effect. $delta = $element['#max_delta']; - // Construct an attribute to add to div for use as selector to set the focus on. + // Construct an attribute to add to div for use as selector to set the focus + // on. $button_parent = NestedArray::getValue($form, array_slice($button['#array_parents'], 0, -1)); $focus_attribute = 'data-drupal-selector="field-' . $button_parent['#field_name'] . '-more-focus-target"'; $element[$delta]['#prefix'] = '<div class="ajax-new-content" ' . $focus_attribute . '>' . ($element[$delta]['#prefix'] ?? ''); diff --git a/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php b/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php index 8996fd6039f..7124b3b2297 100644 --- a/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php +++ b/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php @@ -119,8 +119,9 @@ class FileTransferAuthorizeForm extends FormBase { ], ], ]; - // We can't use #prefix on the container itself since then the header won't - // be hidden and shown when the containers are being manipulated via JS. + // We can't use #prefix on the container itself since then the header + // won't be hidden and shown when the containers are being manipulated via + // JS. $form['connection_settings'][$name]['header'] = [ '#markup' => '<h4>' . $this->t('@backend connection settings', ['@backend' => $backend['title']]) . '</h4>', ]; diff --git a/core/lib/Drupal/Core/Form/ConfigTarget.php b/core/lib/Drupal/Core/Form/ConfigTarget.php index 4eab41288b6..619bb6451e0 100644 --- a/core/lib/Drupal/Core/Form/ConfigTarget.php +++ b/core/lib/Drupal/Core/Form/ConfigTarget.php @@ -217,8 +217,8 @@ final class ConfigTarget { if ($this->toConfig) { $value = ($this->toConfig)($value, $form_state); if ($is_multi_target) { - // If we're targeting multiple property paths, $value needs to be an array - // with every targeted property path. + // If we're targeting multiple property paths, $value needs to be an + // array with every targeted property path. if (!is_array($value)) { throw new \LogicException(sprintf('The toConfig callable returned a %s, but it must be an array with a key-value pair for each of the targeted property paths.', gettype($value))); } diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 15ff4d64445..cf47614b181 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -1190,8 +1190,8 @@ class FormBuilder implements FormBuilderInterface, FormValidatorInterface, FormS // of how the element is themed or whether JavaScript is used to change the // control's attributes. However, it's good UI to let the user know that // input is not wanted for the control. HTML supports two attributes for: - // this: https://www.w3.org/TR/html401/interact/forms.html#h-17.12. If a form - // wants to start a control off with one of these attributes for UI + // this: https://www.w3.org/TR/html401/interact/forms.html#h-17.12. If a + // form wants to start a control off with one of these attributes for UI // purposes, only, but still allow input to be processed if it's submitted, // it can set the desired attribute in #attributes directly rather than // using #disabled. However, developers should think carefully about the diff --git a/core/lib/Drupal/Core/Form/FormSubmitter.php b/core/lib/Drupal/Core/Form/FormSubmitter.php index b1af51d6f14..a6c5c85f1d1 100644 --- a/core/lib/Drupal/Core/Form/FormSubmitter.php +++ b/core/lib/Drupal/Core/Form/FormSubmitter.php @@ -132,8 +132,8 @@ class FormSubmitter implements FormSubmitterInterface { } if ($url) { - // According to RFC 7231, 303 See Other status code must be used to redirect - // user agent (and not default 302 Found). + // According to RFC 7231, 303 See Other status code must be used to + // redirect user agent (and not default 302 Found). // @see http://tools.ietf.org/html/rfc7231#section-6.4.4 return new RedirectResponse($url, Response::HTTP_SEE_OTHER); } diff --git a/core/lib/Drupal/Core/Form/FormValidator.php b/core/lib/Drupal/Core/Form/FormValidator.php index d7ada923725..cdab87663db 100644 --- a/core/lib/Drupal/Core/Form/FormValidator.php +++ b/core/lib/Drupal/Core/Form/FormValidator.php @@ -142,8 +142,9 @@ class FormValidator implements FormValidatorInterface { * The unique string identifying the form. */ protected function handleErrorsWithLimitedValidation(&$form, FormStateInterface &$form_state, $form_id) { - // If validation errors are limited then remove any non validated form values, - // so that only values that passed validation are left for submit callbacks. + // If validation errors are limited then remove any non validated form + // values, so that only values that passed validation are left for submit + // callbacks. $triggering_element = $form_state->getTriggeringElement(); if (isset($triggering_element['#limit_validation_errors']) && $triggering_element['#limit_validation_errors'] !== FALSE) { $values = []; diff --git a/core/lib/Drupal/Core/Form/form.api.php b/core/lib/Drupal/Core/Form/form.api.php index 58d3c7d117b..ea14b3999ed 100644 --- a/core/lib/Drupal/Core/Form/form.api.php +++ b/core/lib/Drupal/Core/Form/form.api.php @@ -210,7 +210,8 @@ function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_stat '#default_value' => in_array($form['type']['#value'], $upload_enabled_types) ? 1 : 0, '#options' => [t('Disabled'), t('Enabled')], ]; - // Add a custom submit handler to save the array of types back to the config file. + // Add a custom submit handler to save the array of types back to the config + // file. $form['actions']['submit']['#submit'][] = 'my_module_upload_enabled_types_submit'; } } diff --git a/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php b/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php index 77b9399e23d..efd33ca54c3 100644 --- a/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php @@ -64,7 +64,8 @@ class SelectLanguageForm extends FormBase { '#title' => 'Choose language', '#title_display' => 'invisible', '#options' => $select_options, - // Use the browser detected language as default or English if nothing found. + // Use the browser detected language as default or English if nothing + // found. '#default_value' => !empty($browser_langcode) ? $browser_langcode : 'en', ]; $link_to_english = install_full_redirect_url(['parameters' => ['langcode' => 'en']]); diff --git a/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php b/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php index aea6327972a..1722051aace 100644 --- a/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php @@ -39,8 +39,8 @@ class SelectProfileForm extends FormBase { foreach ($install_state['profiles'] as $profile) { /** @var \Drupal\Core\Extension\Extension $profile */ $details = install_profile_info($profile->getName()); - // Don't show hidden profiles. This is used by to hide the testing profile, - // which only exists to speed up test runs. + // Don't show hidden profiles. This is used by to hide the testing + // profile, which only exists to speed up test runs. if ($details['hidden'] === TRUE && !drupal_valid_test_ua()) { continue; } @@ -57,9 +57,9 @@ class SelectProfileForm extends FormBase { natcasesort($names); if (isset($names['minimal'])) { // If the expert ("Minimal") core profile is present, put it in front of - // any non-core profiles rather than including it with them alphabetically, - // since the other profiles might be intended to group together in a - // particular way. + // any non-core profiles rather than including it with them + // alphabetically, since the other profiles might be intended to group + // together in a particular way. $names = ['minimal' => $names['minimal']] + $names; } if (isset($names['standard'])) { diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php index 81682b8278e..586195082a5 100644 --- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php @@ -88,18 +88,19 @@ class SiteSettingsForm extends FormBase { if (isset($input['driver'])) { $default_driver = $input['driver']; // In case of database connection info from settings.php, as well as for a - // programmed form submission (non-interactive installer), the table prefix - // information is usually normalized into an array already, but the form - // element only allows to configure one default prefix for all tables. + // programmed form submission (non-interactive installer), the table + // prefix information is usually normalized into an array already, but the + // form element only allows to configure one default prefix for all + // tables. $prefix = &$input[$default_driver]['prefix']; if (isset($prefix) && is_array($prefix)) { $prefix = $prefix['default']; } $default_options = $input[$default_driver]; } - // If there is no database information yet, suggest the first available driver - // as default value, so that its settings form is made visible via #states - // when JavaScript is enabled (see below). + // If there is no database information yet, suggest the first available + // driver as default value, so that its settings form is made visible via + // #states when JavaScript is enabled (see below). else { $default_driver = current($drivers_keys); $default_options = []; diff --git a/core/lib/Drupal/Core/Queue/DatabaseQueue.php b/core/lib/Drupal/Core/Queue/DatabaseQueue.php index 22c6ebfec05..2728bf7c166 100644 --- a/core/lib/Drupal/Core/Queue/DatabaseQueue.php +++ b/core/lib/Drupal/Core/Queue/DatabaseQueue.php @@ -246,8 +246,8 @@ class DatabaseQueue implements ReliableQueueInterface, QueueGarbageCollectionInt ->condition('name', 'drupal_batch:%', 'LIKE') ->execute(); - // Reset expired items in the default queue implementation table. If that's - // not used, this will simply be a no-op. + // Reset expired items in the default queue implementation table. If + // that's not used, this will simply be a no-op. $this->connection->update(static::TABLE_NAME) ->fields([ 'expire' => 0, diff --git a/core/lib/Drupal/Core/Render/Element/Link.php b/core/lib/Drupal/Core/Render/Element/Link.php index 8ee85654ce8..e93deb23d7f 100644 --- a/core/lib/Drupal/Core/Render/Element/Link.php +++ b/core/lib/Drupal/Core/Render/Element/Link.php @@ -67,8 +67,8 @@ class Link extends RenderElementBase { // in #options. $element += ['#options' => []]; // However, within the scope of renderable elements, #attributes is a valid - // way to specify attributes, too. Take them into account, but do not override - // attributes from #options. + // way to specify attributes, too. Take them into account, but do not + // override attributes from #options. if (isset($element['#attributes'])) { $element['#options'] += ['attributes' => []]; $element['#options']['attributes'] += $element['#attributes']; diff --git a/core/lib/Drupal/Core/Render/Element/MachineName.php b/core/lib/Drupal/Core/Render/Element/MachineName.php index 1cb485e6a43..ec03e46616e 100644 --- a/core/lib/Drupal/Core/Render/Element/MachineName.php +++ b/core/lib/Drupal/Core/Render/Element/MachineName.php @@ -139,8 +139,9 @@ class MachineName extends Textfield { '#suffix' => '', ]; // A form element that only wants to set one #machine_name property (usually - // 'source' only) would leave all other properties undefined, if the defaults - // were defined by an element plugin. Therefore, we apply the defaults here. + // 'source' only) would leave all other properties undefined, if the + // defaults were defined by an element plugin. Therefore, we apply the + // defaults here. $element['#machine_name'] += [ 'source' => ['label'], 'target' => '#' . $element['#id'], @@ -163,8 +164,8 @@ class MachineName extends Textfield { $form_state->set('machine_name.initial_values', $initial_values); } - // By default, machine names are restricted to Latin alphanumeric characters. - // So, default to LTR directionality. + // By default, machine names are restricted to Latin alphanumeric + // characters. So, default to LTR directionality. if (!isset($element['#attributes'])) { $element['#attributes'] = []; } diff --git a/core/lib/Drupal/Core/Render/Element/Radios.php b/core/lib/Drupal/Core/Render/Element/Radios.php index 79e9eb74185..7dc1815b36e 100644 --- a/core/lib/Drupal/Core/Render/Element/Radios.php +++ b/core/lib/Drupal/Core/Render/Element/Radios.php @@ -73,11 +73,11 @@ class Radios extends FormElementBase { $element[$key] += [ '#type' => 'radio', '#title' => $choice, - // The key is sanitized in Drupal\Core\Template\Attribute during output - // from the theme function. + // The key is sanitized in Drupal\Core\Template\Attribute during + // output from the theme function. '#return_value' => $key, - // Use default or FALSE. A value of FALSE means that the radio button is - // not 'checked'. + // Use default or FALSE. A value of FALSE means that the radio button + // is not 'checked'. '#default_value' => $element['#default_value'] ?? FALSE, '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], diff --git a/core/lib/Drupal/Core/Render/Element/RenderElementBase.php b/core/lib/Drupal/Core/Render/Element/RenderElementBase.php index aa2da90eba8..7981e30c0c4 100644 --- a/core/lib/Drupal/Core/Render/Element/RenderElementBase.php +++ b/core/lib/Drupal/Core/Render/Element/RenderElementBase.php @@ -200,8 +200,8 @@ abstract class RenderElementBase extends PluginBase implements ElementInterface elseif (!empty($element['#group_details'])) { // Intentionally empty to clarify the flow; we simply return $element. } - // Otherwise, this element belongs to a group and the group exists, so we do - // not render it. + // Otherwise, this element belongs to a group and the group exists, so we + // do not render it. elseif (Element::children($element['#groups'][$group])) { $element['#printed'] = TRUE; } @@ -285,23 +285,24 @@ abstract class RenderElementBase extends PluginBase implements ElementInterface case 'submit': case 'button': case 'image_button': - // Pressing the ENTER key within a textfield triggers the click event of - // the form's first submit button. Triggering Ajax in this situation - // leads to problems, like breaking autocomplete textfields, so we bind - // to mousedown instead of click. + // Pressing the ENTER key within a textfield triggers the click event + // of the form's first submit button. Triggering Ajax in this + // situation leads to problems, like breaking autocomplete textfields, + // so we bind to mousedown instead of click. // @see https://www.drupal.org/node/216059 $element['#ajax']['event'] = 'mousedown'; // Retain keyboard accessibility by setting 'keypress'. This causes - // ajax.js to trigger 'event' when SPACE or ENTER are pressed while the - // button has focus. + // ajax.js to trigger 'event' when SPACE or ENTER are pressed while + // the button has focus. $element['#ajax']['keypress'] = TRUE; // Binding to mousedown rather than click means that it is possible to - // trigger a click by pressing the mouse, holding the mouse button down - // until the Ajax request is complete and the button is re-enabled, and - // then releasing the mouse button. Set 'prevent' so that ajax.js binds - // an additional handler to prevent such a click from triggering a - // non-Ajax form submission. This also prevents a textfield's ENTER - // press triggering this button's non-Ajax form submission behavior. + // trigger a click by pressing the mouse, holding the mouse button + // down until the Ajax request is complete and the button is + // re-enabled, and then releasing the mouse button. Set 'prevent' so + // that ajax.js binds an additional handler to prevent such a click + // from triggering a non-Ajax form submission. This also prevents a + // textfield's ENTER press triggering this button's non-Ajax form + // submission behavior. if (!isset($element['#ajax']['prevent'])) { $element['#ajax']['prevent'] = 'click'; } @@ -351,11 +352,12 @@ abstract class RenderElementBase extends PluginBase implements ElementInterface // Assign default settings. When 'url' is set to NULL, ajax.js submits the // Ajax request to the same URL as the form or link destination is for - // someone with JavaScript disabled. This is generally preferred as a way to - // ensure consistent server processing for js and no-js users, and Drupal's - // content negotiation takes care of formatting the response appropriately. - // However, 'url' and 'options' may be set when wanting server processing - // to be substantially different for a JavaScript triggered submission. + // someone with JavaScript disabled. This is generally preferred as a way + // to ensure consistent server processing for js and no-js users, and + // Drupal's content negotiation takes care of formatting the response + // appropriately. However, 'url' and 'options' may be set when wanting + // server processing to be substantially different for a JavaScript + // triggered submission. $settings += [ 'url' => NULL, 'httpMethod' => 'POST', @@ -386,16 +388,17 @@ abstract class RenderElementBase extends PluginBase implements ElementInterface unset($settings['options']); // Add special data to $settings['submit'] so that when this element - // triggers an Ajax submission, Drupal's form processing can determine which - // element triggered it. + // triggers an Ajax submission, Drupal's form processing can determine + // which element triggered it. // @see _form_element_triggered_scripted_submission() if (isset($settings['trigger_as'])) { - // An element can add a 'trigger_as' key within #ajax to make the element - // submit as though another one (for example, a non-button can use this - // to submit the form as though a button were clicked). When using this, - // the 'name' key is always required to identify the element to trigger - // as. The 'value' key is optional, and only needed when multiple elements - // share the same name, which is commonly the case for buttons. + // An element can add a 'trigger_as' key within #ajax to make the + // element submit as though another one (for example, a non-button can + // use this to submit the form as though a button were clicked). When + // using this, the 'name' key is always required to identify the element + // to trigger as. The 'value' key is optional, and only needed when + // multiple elements share the same name, which is commonly the case for + // buttons. $settings['submit']['_triggering_element_name'] = $settings['trigger_as']['name']; if (isset($settings['trigger_as']['value'])) { $settings['submit']['_triggering_element_value'] = $settings['trigger_as']['value']; @@ -403,8 +406,8 @@ abstract class RenderElementBase extends PluginBase implements ElementInterface unset($settings['trigger_as']); } elseif (isset($element['#name'])) { - // Most of the time, elements can submit as themselves, in which case the - // 'trigger_as' key isn't needed, and the element's name is used. + // Most of the time, elements can submit as themselves, in which case + // the 'trigger_as' key isn't needed, and the element's name is used. $settings['submit']['_triggering_element_name'] = $element['#name']; // If the element is a (non-image) button, its name may not identify it // uniquely, in which case a match on value is also needed. @@ -453,8 +456,8 @@ abstract class RenderElementBase extends PluginBase implements ElementInterface public static function processGroup(&$element, FormStateInterface $form_state, &$complete_form) { $parents = implode('][', $element['#parents']); - // Each details element forms a new group. The #type 'vertical_tabs' basically - // only injects a new details element. + // Each details element forms a new group. The #type 'vertical_tabs' + // basically only injects a new details element. $groups = &$form_state->getGroups(); $groups[$parents]['#group_exists'] = TRUE; $element['#groups'] = &$groups; diff --git a/core/lib/Drupal/Core/Render/Element/Select.php b/core/lib/Drupal/Core/Render/Element/Select.php index 9fcf6b52640..db34862cdb4 100644 --- a/core/lib/Drupal/Core/Render/Element/Select.php +++ b/core/lib/Drupal/Core/Render/Element/Select.php @@ -130,8 +130,9 @@ class Select extends FormElementBase { $element['#attributes']['name'] = $element['#name'] . '[]'; } // A non-#multiple select needs special handling to prevent user agents from - // preselecting the first option without intention. #multiple select lists do - // not get an empty option, as it would not make sense, user interface-wise. + // preselecting the first option without intention. #multiple select lists + // do not get an empty option, as it would not make sense, user + // interface-wise. else { // If the element is set to #required through #states, override the // element's #required setting. diff --git a/core/lib/Drupal/Core/Render/Element/Table.php b/core/lib/Drupal/Core/Render/Element/Table.php index 94dbbd419d9..4d87ace04dc 100644 --- a/core/lib/Drupal/Core/Render/Element/Table.php +++ b/core/lib/Drupal/Core/Render/Element/Table.php @@ -151,7 +151,8 @@ class Table extends FormElementBase { * {@inheritdoc} */ public static function valueCallback(&$element, $input, FormStateInterface $form_state) { - // If #multiple is FALSE, the regular default value of radio buttons is used. + // If #multiple is FALSE, the regular default value of radio buttons is + // used. if (!empty($element['#tableselect']) && !empty($element['#multiple'])) { // Contrary to #type 'checkboxes', the default value of checkboxes in a // table is built from the array keys (instead of array values) of the @@ -424,9 +425,10 @@ class Table extends FormElementBase { $element['#attached']['library'][] = 'core/drupal.tableheader'; $element['#attributes']['class'][] = 'sticky-header'; } - // If the table has headers and it should react responsively to columns hidden - // with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM - // and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors. + // If the table has headers and it should react responsively to columns + // hidden with the classes represented by the constants + // RESPONSIVE_PRIORITY_MEDIUM and RESPONSIVE_PRIORITY_LOW, add the + // tableresponsive behaviors. if (count($element['#header']) && $element['#responsive']) { $element['#attached']['library'][] = 'core/drupal.tableresponsive'; // Add 'responsive-enabled' class to the table to identify it for JS. diff --git a/core/lib/Drupal/Core/Render/Element/Tableselect.php b/core/lib/Drupal/Core/Render/Element/Tableselect.php index ff6e139bb07..cb38a0722d2 100644 --- a/core/lib/Drupal/Core/Render/Element/Tableselect.php +++ b/core/lib/Drupal/Core/Render/Element/Tableselect.php @@ -194,8 +194,8 @@ class Tableselect extends Table { array_unshift($header, ['class' => ['select-all']]); } else { - // Add an empty header when radio buttons are displayed or a "Select all" - // checkbox is not desired. + // Add an empty header when radio buttons are displayed or a "Select + // all" checkbox is not desired. array_unshift($header, ''); } } diff --git a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php index 014897f8066..6ac379012c6 100644 --- a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php +++ b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php @@ -141,9 +141,9 @@ class HtmlResponseAttachmentsProcessor implements AttachmentsResponseProcessorIn ); unset($attached['feed']); } - // 'html_head_link' is a special case of 'html_head' which can be present - // as a head element, but also as a Link: HTTP header depending on - // settings in the render array. Processing it can add to both the + // 'html_head_link' is a special case of 'html_head' which can be + // present as a head element, but also as a Link: HTTP header depending + // on settings in the render array. Processing it can add to both the // 'html_head' and 'http_header' keys of '#attached', so we must address // it before 'html_head'. if (!empty($attached['html_head_link'])) { diff --git a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php index bcceafabee1..4a97ae88c9f 100644 --- a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php @@ -145,7 +145,8 @@ class HtmlRenderer implements MainContentRendererInterface { ]; // The special page regions will appear directly in html.html.twig, not in - // page.html.twig, hence add them here, just before rendering html.html.twig. + // page.html.twig, hence add them here, just before rendering + // html.html.twig. $this->buildPageTopAndBottom($html); // Render, but don't replace placeholders yet, because that happens later in diff --git a/core/lib/Drupal/Core/Render/Placeholder/ChainedPlaceholderStrategy.php b/core/lib/Drupal/Core/Render/Placeholder/ChainedPlaceholderStrategy.php index 7ca41237b43..ba1417e45a7 100644 --- a/core/lib/Drupal/Core/Render/Placeholder/ChainedPlaceholderStrategy.php +++ b/core/lib/Drupal/Core/Render/Placeholder/ChainedPlaceholderStrategy.php @@ -40,8 +40,8 @@ class ChainedPlaceholderStrategy implements PlaceholderStrategyInterface { $new_placeholders = []; // Give each placeholder strategy a chance to replace all not-yet replaced - // placeholders. The order of placeholder strategies is well defined - // and this uses a variation of the "chain of responsibility" design pattern. + // placeholders. The order of placeholder strategies is well defined and + // this uses a variation of the "chain of responsibility" design pattern. foreach ($this->placeholderStrategies as $strategy) { $processed_placeholders = $strategy->processPlaceholders($placeholders); assert(array_intersect_key($processed_placeholders, $placeholders) === $processed_placeholders, 'Processed placeholders must be a subset of all placeholders.'); diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index 0843c0d4cab..ef456eca519 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -315,7 +315,8 @@ class RouteProvider implements CacheableRouteProviderInterface, PreloadableRoute continue; } elseif ($i < (1 << $length)) { - // We have exhausted the masks of a given length, so decrease the length. + // We have exhausted the masks of a given length, so decrease the + // length. --$length; } $current = ''; diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php index 6daf9b34e1c..e4c7c836fda 100644 --- a/core/lib/Drupal/Core/Routing/UrlGenerator.php +++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php @@ -63,8 +63,9 @@ class UrlGenerator implements UrlGeneratorInterface { * @see \Symfony\Component\Routing\Generator\UrlGenerator */ protected $decodedChars = [ - // The slash can be used to designate a hierarchical structure and we want allow using it with this meaning - // some webservers don't allow the slash in encoded form in the path for security reasons anyway + // The slash can be used to designate a hierarchical structure and we want + // allow using it with this meaning some webservers don't allow the slash in + // encoded form in the path for security reasons anyway // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss // Map from these encoded characters. '%2F', @@ -186,7 +187,8 @@ class UrlGenerator implements UrlGeneratorInterface { // Tokens start from the end of the path and work to the beginning. The // first one or several variable tokens may be optional, but once we find a // supplied token or a static text portion of the path, all remaining - // variables up to the start of the path must be supplied to there is no gap. + // variables up to the start of the path must be supplied to there is no + // gap. $optional = TRUE; // Structure of $tokens from the compiled route: // If the path is /admin/config/user-interface/shortcut/manage/{shortcut_set}/add-link-inline @@ -306,11 +308,12 @@ class UrlGenerator implements UrlGeneratorInterface { // Drupal paths rarely include dots, so skip this processing if possible. if (str_contains($path, '/.')) { - // The path segments "." and ".." are interpreted as relative reference when - // resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3 - // so we need to encode them as they are not used for this purpose here - // otherwise we would generate a URI that, when followed by a user agent - // (e.g. browser), does not match this route + // The path segments "." and ".." are interpreted as relative reference + // when resolving a URI; see + // http://tools.ietf.org/html/rfc3986#section-3.3 so we need to encode + // them as they are not used for this purpose here otherwise we would + // generate a URI that, when followed by a user agent (e.g. browser), does + // not match this route $path = strtr($path, ['/../' => '/%2E%2E/', '/./' => '/%2E/']); if (str_ends_with($path, '/..')) { $path = substr($path, 0, -2) . '%2E%2E'; diff --git a/core/lib/Drupal/Core/Test/EnvironmentCleaner.php b/core/lib/Drupal/Core/Test/EnvironmentCleaner.php index 19af760a2cb..1fe0ee8e86b 100644 --- a/core/lib/Drupal/Core/Test/EnvironmentCleaner.php +++ b/core/lib/Drupal/Core/Test/EnvironmentCleaner.php @@ -81,8 +81,8 @@ class EnvironmentCleaner implements EnvironmentCleanerInterface { $tables = $schema->findTables('test%'); $count = 0; foreach ($tables as $table) { - // Only drop tables which begin wih 'test' followed by digits, for example, - // {test12345678node__body}. + // Only drop tables which begin wih 'test' followed by digits, for + // example, {test12345678node__body}. if (preg_match('/^test\d+.*/', $table, $matches)) { $schema->dropTable($matches[0]); $count++; diff --git a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php index 6a8a0fbd1b6..53a860fdc02 100644 --- a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php @@ -127,10 +127,10 @@ class PhpUnitTestRunner implements ContainerInjectionInterface { 'SIMPLETEST_DB' => Database::getConnectionInfoAsUrl(), ]; - // Setup an environment variable containing the base URL, if it is available. - // This allows functional tests to browse the site under test. When running - // tests via CLI, core/phpunit.xml.dist or core/scripts/run-tests.sh can set - // this variable. + // Setup an environment variable containing the base URL, if it is + // available. This allows functional tests to browse the site under test. + // When running tests via CLI, core/phpunit.xml.dist or + // core/scripts/run-tests.sh can set this variable. if ($base_url) { $process_environment_variables['SIMPLETEST_BASE_URL'] = $base_url; $process_environment_variables['BROWSERTEST_OUTPUT_DIRECTORY'] = $this->workingDirectory; diff --git a/core/lib/Drupal/Core/Theme/ComponentPluginManager.php b/core/lib/Drupal/Core/Theme/ComponentPluginManager.php index b3546022e79..a0c93317699 100644 --- a/core/lib/Drupal/Core/Theme/ComponentPluginManager.php +++ b/core/lib/Drupal/Core/Theme/ComponentPluginManager.php @@ -84,10 +84,11 @@ class ComponentPluginManager extends DefaultPluginManager implements Categorizin $this->moduleHandler = $module_handler; $this->factory = new ContainerFactory($this); $this->setCacheBackend($cacheBackend, 'component_plugins'); - // Note that we are intentionally skipping $this->alterInfo('component_info'); - // We want to ensure that everything related to a component is in the - // single directory. If the alteration of a component is necessary, - // component replacement is the preferred tool for that. + // Note that we are intentionally skipping + // $this->alterInfo('component_info'); We want to ensure that everything + // related to a component is in the single directory. If the alteration of a + // component is necessary, component replacement is the preferred tool for + // that. } /** diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index 9513c677d07..07e1c1dbed3 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -528,9 +528,9 @@ class Registry implements DestructableInterface { if ($result) { foreach ($result as $hook => $info) { // When a theme or engine overrides a module's theme function - // $result[$hook] will only contain key/value pairs for information being - // overridden. Pull the rest of the information from what was defined by - // an earlier hook. + // $result[$hook] will only contain key/value pairs for information + // being overridden. Pull the rest of the information from what was + // defined by an earlier hook. // Fill in the type and path of the module, theme, or engine that // implements this theme function. diff --git a/core/lib/Drupal/Core/Theme/ThemeCommonElements.php b/core/lib/Drupal/Core/Theme/ThemeCommonElements.php index a9ebe744004..05d5e168e1a 100644 --- a/core/lib/Drupal/Core/Theme/ThemeCommonElements.php +++ b/core/lib/Drupal/Core/Theme/ThemeCommonElements.php @@ -66,14 +66,14 @@ class ThemeCommonElements { ], ], 'image' => [ - // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft - // allows the alt attribute to be omitted in some cases. Therefore, - // default the alt attribute to an empty string, but allow code providing - // variables to image.html.twig templates to pass explicit NULL for it to - // be omitted. Usually, neither omission nor an empty string satisfies - // accessibility requirements, so it is strongly encouraged for code - // building variables for image.html.twig templates to pass a meaningful - // value for the alt variable. + // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 + // draft allows the alt attribute to be omitted in some cases. + // Therefore, default the alt attribute to an empty string, but allow + // code providing variables to image.html.twig templates to pass + // explicit NULL for it to be omitted. Usually, neither omission nor an + // empty string satisfies accessibility requirements, so it is strongly + // encouraged for code building variables for image.html.twig templates + // to pass a meaningful value for the alt variable. // - https://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 // - https://www.w3.org/TR/xhtml1/dtds.html // - http://dev.w3.org/html5/spec/Overview.html#alt diff --git a/core/lib/Drupal/Core/Theme/ThemeManager.php b/core/lib/Drupal/Core/Theme/ThemeManager.php index f6f4483784e..dd1361725b6 100644 --- a/core/lib/Drupal/Core/Theme/ThemeManager.php +++ b/core/lib/Drupal/Core/Theme/ThemeManager.php @@ -407,8 +407,9 @@ class ThemeManager implements ThemeManagerInterface { * The current route match. */ protected function initTheme(?RouteMatchInterface $route_match = NULL) { - // Determine the active theme for the theme negotiator service. This includes - // the default theme as well as really specific ones like the ajax base theme. + // Determine the active theme for the theme negotiator service. This + // includes the default theme as well as really specific ones like the ajax + // base theme. if (!$route_match) { $route_match = \Drupal::routeMatch(); } @@ -433,8 +434,8 @@ class ThemeManager implements ThemeManagerInterface { $extra_types = $type; $type = array_shift($extra_types); // Allow if statements in this function to use the faster isset() rather - // than !empty() both when $type is passed as a string, or as an array with - // one item. + // than !empty() both when $type is passed as a string, or as an array + // with one item. if (empty($extra_types)) { unset($extra_types); } diff --git a/core/lib/Drupal/Core/Utility/LinkGenerator.php b/core/lib/Drupal/Core/Utility/LinkGenerator.php index f2302bca54f..b1fb20dea16 100644 --- a/core/lib/Drupal/Core/Utility/LinkGenerator.php +++ b/core/lib/Drupal/Core/Utility/LinkGenerator.php @@ -82,7 +82,8 @@ class LinkGenerator implements LinkGeneratorInterface { $text = $this->renderer->render($text); } - // Start building a structured representation of our link to be altered later. + // Start building a structured representation of our link to be altered + // later. $variables = [ 'text' => $text, 'url' => $url, @@ -139,8 +140,8 @@ class LinkGenerator implements LinkGeneratorInterface { } } - // Remove all HTML and PHP tags from a tooltip, calling expensive strip_tags() - // only when a quick strpos() gives suspicion tags are present. + // Remove all HTML and PHP tags from a tooltip, calling expensive + // strip_tags() only when a quick strpos() gives suspicion tags are present. if (isset($variables['options']['attributes']['title']) && str_contains($variables['options']['attributes']['title'], '<')) { $variables['options']['attributes']['title'] = strip_tags($variables['options']['attributes']['title']); } diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ValidKeysConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ValidKeysConstraintValidator.php index db7196c3689..19bae10eea4 100644 --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ValidKeysConstraintValidator.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ValidKeysConstraintValidator.php @@ -67,8 +67,8 @@ class ValidKeysConstraintValidator extends ConstraintValidator { // the statically valid keys). // @see \Drupal\Core\Config\Schema\Mapping::getDynamicallyValidKeys() if (!empty($all_dynamically_valid_keys)) { - // For example, `block.block.*:settings` has the following dynamically valid - // keys when the block plugin is `system_branding_block`: + // For example, `block.block.*:settings` has the following dynamically + // valid keys when the block plugin is `system_branding_block`: // - use_site_logo // - use_site_name // - use_site_slogan @@ -233,7 +233,8 @@ class ValidKeysConstraintValidator extends ConstraintValidator { assert($result === 1); // @see \Drupal\Core\Config\TypedConfigManager::replaceExpression() $expression = $matches[1]; - // From the expression, extract the instructions for where to retrieve a value. + // From the expression, extract the instructions for where to retrieve a + // value. $instructions = explode('.', $expression); // Determine the property path to the configuration key that has determined diff --git a/core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php b/core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php index 9c0db9e8bd2..5ad29d02a1b 100644 --- a/core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php +++ b/core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php @@ -69,10 +69,10 @@ class AnnouncementsFeedHooks { '#weight' => 3399, ]; // \Drupal\toolbar\Element\ToolbarItem::preRenderToolbarItem adds an - // #attributes property to each toolbar item's tab child automatically. - // Lazy builders don't support an #attributes property so we need to - // add another render callback to remove the #attributes property. We start by - // adding the defaults, and then we append our own pre render callback. + // #attributes property to each toolbar item's tab child automatically. Lazy + // builders don't support an #attributes property so we need to add another + // render callback to remove the #attributes property. We start by adding + // the defaults, and then we append our own pre render callback. $items['announcement'] += \Drupal::service('plugin.manager.element_info')->getInfo('toolbar_item'); $items['announcement']['#pre_render'][] = [RenderCallbacks::class, 'removeTabAttributes']; return $items; diff --git a/core/modules/announcements_feed/tests/modules/announce_feed_test/src/AnnounceTestHttpClientMiddleware.php b/core/modules/announcements_feed/tests/modules/announce_feed_test/src/AnnounceTestHttpClientMiddleware.php index c1e84e6131d..702d028aedc 100644 --- a/core/modules/announcements_feed/tests/modules/announce_feed_test/src/AnnounceTestHttpClientMiddleware.php +++ b/core/modules/announcements_feed/tests/modules/announce_feed_test/src/AnnounceTestHttpClientMiddleware.php @@ -24,8 +24,8 @@ class AnnounceTestHttpClientMiddleware { $test_end_point = \Drupal::state()->get('announce_test_endpoint'); if ($test_end_point && str_contains((string) $request->getUri(), '://www.drupal.org/announcements.json')) { // Only override $uri if it matches the advisories JSON feed to avoid - // changing any other uses of the 'http_client' service during tests with - // this module installed. + // changing any other uses of the 'http_client' service during tests + // with this module installed. $request = $request->withUri(new Uri($test_end_point)); } return $handler($request, $options); diff --git a/core/modules/big_pipe/src/Hook/BigPipeHooks.php b/core/modules/big_pipe/src/Hook/BigPipeHooks.php index 72451b09c87..93b1f1f0f48 100644 --- a/core/modules/big_pipe/src/Hook/BigPipeHooks.php +++ b/core/modules/big_pipe/src/Hook/BigPipeHooks.php @@ -44,9 +44,9 @@ class BigPipeHooks { return; } $request = \Drupal::request(); - // BigPipe is only used when there is an actual session, so only add the no-JS - // detection when there actually is a session. - // @see \Drupal\big_pipe\Render\Placeholder\BigPipeStrategy. + // BigPipe is only used when there is an actual session, so only add the + // no-JS detection when there actually is a session. @see + // \Drupal\big_pipe\Render\Placeholder\BigPipeStrategy. $session_exists = \Drupal::service('session_configuration')->hasSession($request); $page['#cache']['contexts'][] = 'session.exists'; // Only do the no-JS detection while we don't know if there's no JS support: diff --git a/core/modules/big_pipe/src/Render/BigPipe.php b/core/modules/big_pipe/src/Render/BigPipe.php index d149547dbbf..cefa77542f3 100644 --- a/core/modules/big_pipe/src/Render/BigPipe.php +++ b/core/modules/big_pipe/src/Render/BigPipe.php @@ -530,8 +530,8 @@ class BigPipe { $ajax_response->addCommand(new ReplaceCommand(sprintf('[data-big-pipe-placeholder-id="%s"]', $big_pipe_js_placeholder_id), $elements['#markup'])); $ajax_response->setAttachments($elements['#attached']); - // Delete all messages that were generated during the rendering of this - // placeholder, to render them in a BigPipe-optimized way. + // Delete all messages that were generated during the rendering of + // this placeholder, to render them in a BigPipe-optimized way. $messages = $this->messenger->deleteAll(); foreach ($messages as $type => $type_messages) { foreach ($type_messages as $message) { @@ -584,8 +584,8 @@ EOF; else { try { // SecuredRedirectResponse is an abstract class that requires a - // concrete implementation. Default to LocalRedirectResponse, which - // considers only redirects to within the same site as safe. + // concrete implementation. Default to LocalRedirectResponse, + // which considers only redirects to within the same site as safe. $safe_response = LocalRedirectResponse::createFromRedirectResponse($response); $safe_response->setRequestContext($this->requestContext); $ajax_response->addCommand(new RedirectCommand($safe_response->getTargetUrl())); diff --git a/core/modules/block/src/Hook/BlockHooks.php b/core/modules/block/src/Hook/BlockHooks.php index 972f9b96b38..579a87fab65 100644 --- a/core/modules/block/src/Hook/BlockHooks.php +++ b/core/modules/block/src/Hook/BlockHooks.php @@ -96,10 +96,10 @@ class BlockHooks { */ #[Hook('modules_installed')] public function modulesInstalled($modules): void { - // block_themes_installed() does not call block_theme_initialize() during site - // installation because block configuration can be optional or provided by the - // profile. Now, when the profile is installed, this configuration exists, - // call block_theme_initialize() for all installed themes. + // block_themes_installed() does not call block_theme_initialize() during + // site installation because block configuration can be optional or provided + // by the profile. Now, when the profile is installed, this configuration + // exists, call block_theme_initialize() for all installed themes. $profile = \Drupal::installProfile(); if (in_array($profile, $modules, TRUE)) { foreach (\Drupal::service('theme_handler')->listInfo() as $theme => $data) { diff --git a/core/modules/block/src/Plugin/ConfigAction/PlaceBlock.php b/core/modules/block/src/Plugin/ConfigAction/PlaceBlock.php index b43b455639b..6ba7597f2f5 100644 --- a/core/modules/block/src/Plugin/ConfigAction/PlaceBlock.php +++ b/core/modules/block/src/Plugin/ConfigAction/PlaceBlock.php @@ -74,9 +74,10 @@ final class PlaceBlock implements ConfigActionPluginInterface, ContainerFactoryP 'region' => $value['region'], ]); if ($blocks) { - // Sort the blocks by weight. Don't use \Drupal\block\Entity\Block::sort() - // here because it seems to be intended to sort blocks in the UI, where - // we really just want to get the weights right in this situation. + // Sort the blocks by weight. Don't use + // \Drupal\block\Entity\Block::sort() here because it seems to be + // intended to sort blocks in the UI, where we really just want to get + // the weights right in this situation. uasort($blocks, fn (BlockInterface $a, BlockInterface $b) => $a->getWeight() <=> $b->getWeight()); $value['weight'] = match ($value['position']) { diff --git a/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php b/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php index aa80b628026..0c503cc4086 100644 --- a/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php +++ b/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php @@ -188,8 +188,8 @@ class BlockPageVariant extends VariantBase implements PageVariantInterface, Cont unset($build['content']['#sorted']); } - // The access results' cacheability is currently added to the top level of the - // render array. This is done to prevent issues with empty regions being + // The access results' cacheability is currently added to the top level of + // the render array. This is done to prevent issues with empty regions being // displayed. // This would need to be changed to allow caching of block regions, as each // region must then have the relevant cacheable metadata. diff --git a/core/modules/block/tests/src/Functional/BlockInvalidRegionTest.php b/core/modules/block/tests/src/Functional/BlockInvalidRegionTest.php index 787c0759081..73e0ffcc51a 100644 --- a/core/modules/block/tests/src/Functional/BlockInvalidRegionTest.php +++ b/core/modules/block/tests/src/Functional/BlockInvalidRegionTest.php @@ -59,7 +59,8 @@ class BlockInvalidRegionTest extends BrowserTestBase { $warning_message = 'The block ' . $block->id() . ' was assigned to the invalid region invalid_region and has been disabled.'; - // Clearing the cache should disable the test block placed in the invalid region. + // Clearing the cache should disable the test block placed in the invalid + // region. $this->drupalGet('admin/config/development/performance'); $this->submitForm([], 'Clear all caches'); $this->assertSession()->statusMessageContains($warning_message, 'warning'); diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php index 0c13791b92e..6d894612d4c 100644 --- a/core/modules/block/tests/src/Functional/BlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockTest.php @@ -224,7 +224,8 @@ class BlockTest extends BlockTestBase { $block['theme'] = $this->config('system.theme')->get('default'); $block['region'] = 'header'; - // Set block title to confirm that interface works and override any custom titles. + // Set block title to confirm that interface works and override any custom + // titles. $this->drupalGet('admin/structure/block/add/' . $block['id'] . '/' . $block['theme']); $this->submitForm([ 'settings[label]' => $block['settings[label]'], diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php index 12e06b7cc2b..920bec6c874 100644 --- a/core/modules/block/tests/src/Functional/BlockUiTest.php +++ b/core/modules/block/tests/src/Functional/BlockUiTest.php @@ -246,9 +246,9 @@ class BlockUiTest extends BrowserTestBase { $this->assertSession()->responseContains($expected_text); // Test context mapping form element is not visible if there are no valid - // context options for the block (the test_context_aware_no_valid_context_options - // block has one context defined which is not available for it on the - // Block Layout interface). + // context options for the block (the + // test_context_aware_no_valid_context_options block has one context defined + // which is not available for it on the Block Layout interface). $this->drupalGet('admin/structure/block/add/test_context_aware_no_valid_context_options/stark'); $this->assertSession()->fieldNotExists('edit-settings-context-mapping-email'); diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php index d59ce53842c..aede08a4cf2 100644 --- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php +++ b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php @@ -219,8 +219,8 @@ class DisplayBlockTest extends ViewTestBase { $this->drupalGet('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme); $this->submitForm($edit, 'Save block'); $block = $storage->load($default_theme . '_views_block__test_view_block_block_1_' . $i); - // This will only return a result if our new block has been created with the - // expected machine name. + // This will only return a result if our new block has been created with + // the expected machine name. $this->assertNotEmpty($block, 'The expected block was loaded.'); } diff --git a/core/modules/block/tests/src/FunctionalJavascript/BlockDragTest.php b/core/modules/block/tests/src/FunctionalJavascript/BlockDragTest.php index 7c098a4082f..4de5edebdd2 100644 --- a/core/modules/block/tests/src/FunctionalJavascript/BlockDragTest.php +++ b/core/modules/block/tests/src/FunctionalJavascript/BlockDragTest.php @@ -70,7 +70,8 @@ class BlockDragTest extends WebDriverTestBase { // Check if the message unsaved changed appears. $assertSession->pageTextContains('You have unsaved changes.'); - // Test if the message for empty regions appear after drag the unique block on the region. + // Test if the message for empty regions appear after drag the unique block + // on the region. $noBlockMessage = $page->find('css', 'tr[data-drupal-selector="edit-blocks-region-primary-menu-message"] td')->getText(); $this->assertSession()->assert($noBlockMessage === 'No blocks in this region', 'Region primary menu should be empty.'); diff --git a/core/modules/block/tests/src/Kernel/NewDefaultThemeBlocksTest.php b/core/modules/block/tests/src/Kernel/NewDefaultThemeBlocksTest.php index 69f5c1d505f..2546dbed5c8 100644 --- a/core/modules/block/tests/src/Kernel/NewDefaultThemeBlocksTest.php +++ b/core/modules/block/tests/src/Kernel/NewDefaultThemeBlocksTest.php @@ -165,9 +165,9 @@ class NewDefaultThemeBlocksTest extends KernelTestBase { // unset block.block.olivero_admin. unset($new_blocks[str_replace($default_theme . '_', $new_theme . '_', $default_block_name)]); } - // The test_theme_user_login_block machine name is already in use, so therefore - // \Drupal\block\BlockRepository::getUniqueMachineName - // appends a counter. + // The test_theme_user_login_block machine name is already in use, so + // therefore \Drupal\block\BlockRepository::getUniqueMachineName appends a + // counter. unset($new_blocks[$new_theme . '_user_login_block_2']); $this->assertEmpty($new_blocks); diff --git a/core/modules/block_content/src/Controller/BlockContentController.php b/core/modules/block_content/src/Controller/BlockContentController.php index 8177e44e873..20bd0f0d1ca 100644 --- a/core/modules/block_content/src/Controller/BlockContentController.php +++ b/core/modules/block_content/src/Controller/BlockContentController.php @@ -115,9 +115,9 @@ class BlockContentController extends ControllerBase { 'type' => $block_content_type->id(), ]); if (($theme = $request->query->get('theme')) && in_array($theme, array_keys($this->themeHandler->listInfo()))) { - // We have navigated to this page from the block library and will keep track - // of the theme for redirecting the user to the configuration page for the - // newly created block in the given theme. + // We have navigated to this page from the block library and will keep + // track of the theme for redirecting the user to the configuration page + // for the newly created block in the given theme. $block->setTheme($theme); } return $this->entityFormBuilder()->getForm($block); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php b/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php index 03c77066e7c..862b7c6edea 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php @@ -103,8 +103,8 @@ class BlockContentSaveTest extends BlockContentTestBase { * @see block_test_block_insert() */ public function testBlockContentSaveOnInsert(): void { - // block_content_test_block_content_insert() triggers a save on insert if the - // title equals 'new'. + // block_content_test_block_content_insert() triggers a save on insert if + // the title equals 'new'. $block = $this->createBlockContent('new'); $this->assertEquals('BlockContent ' . $block->id(), $block->label(), 'Content block saved on block insert.'); } diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php index b36cc10e0e3..fba8362cd2c 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -224,8 +224,8 @@ class BlockContentTypeTest extends BlockContentTestBase { // For each installed theme, go to its block page and test the redirects. foreach ($themes as $theme) { - // Test that adding a block from the 'place blocks' form sends you to the - // block configure form. + // Test that adding a block from the 'place blocks' form sends you to + // the block configure form. $path = $theme == $default_theme ? 'admin/structure/block' : "admin/structure/block/list/$theme"; $this->drupalGet($path); $this->clickLink('Place block'); diff --git a/core/modules/ckeditor5/ckeditor5.module b/core/modules/ckeditor5/ckeditor5.module index 62f6cfba703..9da40001b8d 100644 --- a/core/modules/ckeditor5/ckeditor5.module +++ b/core/modules/ckeditor5/ckeditor5.module @@ -101,7 +101,8 @@ function _update_ckeditor5_html_filter(array $form, FormStateInterface $form_sta } if ($form_state->get('ckeditor5_is_active')) { - // Delete all existing validation messages, replace them with the current set. + // Delete all existing validation messages, replace them with the current + // set. $response->addCommand(new RemoveCommand('#ckeditor5-realtime-validation-messages-container > *')); $messages = \Drupal::messenger()->deleteAll(); foreach ($messages as $type => $messages_by_type) { diff --git a/core/modules/ckeditor5/src/Hook/Ckeditor5Hooks.php b/core/modules/ckeditor5/src/Hook/Ckeditor5Hooks.php index 1bd36fe52ff..2775c9654d6 100644 --- a/core/modules/ckeditor5/src/Hook/Ckeditor5Hooks.php +++ b/core/modules/ckeditor5/src/Hook/Ckeditor5Hooks.php @@ -109,9 +109,9 @@ class Ckeditor5Hooks { if (isset($form['filters']['settings']['filter_html']['allowed_html'])) { $filter_allowed_html =& $form['filters']['settings']['filter_html']['allowed_html']; $filter_allowed_html['#value_callback'] = [CKEditor5::class, 'getGeneratedAllowedHtmlValue']; - // Set readonly and add the form-disabled wrapper class as using #disabled - // or the disabled attribute will prevent the new values from being - // validated. + // Set readonly and add the form-disabled wrapper class as using + // #disabled or the disabled attribute will prevent the new values from + // being validated. $filter_allowed_html['#attributes']['readonly'] = TRUE; $filter_allowed_html['#wrapper_attributes']['class'][] = 'form-disabled'; $filter_allowed_html['#description'] = t('With CKEditor 5 this is a @@ -130,8 +130,8 @@ class Ckeditor5Hooks { } } } - // Override the AJAX callbacks for changing editors, so multiple areas of the - // form can be updated on change. + // Override the AJAX callbacks for changing editors, so multiple areas of + // the form can be updated on change. $form['editor']['editor']['#ajax'] = [ 'callback' => '_update_ckeditor5_html_filter', 'trigger_as' => [ @@ -215,7 +215,8 @@ class Ckeditor5Hooks { $libraries['internal.drupal.ckeditor5.stylesheets'] = ['css' => ['theme' => array_fill_keys(array_values($css), [])]]; } if ($extension === 'core') { - // CSS rule to resolve the conflict with z-index between CKEditor 5 and jQuery UI. + // CSS rule to resolve the conflict with z-index between CKEditor 5 and + // jQuery UI. $libraries['drupal.dialog']['css']['component']['modules/ckeditor5/css/ckeditor5.dialog.fix.css'] = []; // Fix the CKEditor 5 focus management in dialogs. Modify the library // declaration to ensure this file is always loaded after @@ -245,7 +246,8 @@ class Ckeditor5Hooks { ]; } } - // Copied from \Drupal\Core\Asset\LibraryDiscoveryParser::buildByExtension(). + // Copied from + // \Drupal\Core\Asset\LibraryDiscoveryParser::buildByExtension(). if ($extension === 'core') { $path = 'core'; } @@ -309,8 +311,8 @@ class Ckeditor5Hooks { // all translation files in a single aggregate. $ckeditor_dll_file = 'core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js'; if (isset($javascript[$placeholder_file])) { - // Use the placeholder file weight to set all the translations files weights - // so they can be aggregated together as expected. + // Use the placeholder file weight to set all the translations files + // weights so they can be aggregated together as expected. $default_weight = $javascript[$placeholder_file]['weight']; if (isset($javascript[$ckeditor_dll_file])) { $default_weight = $javascript[$ckeditor_dll_file]['weight']; diff --git a/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Alignment.php b/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Alignment.php index 287c6fad922..b74b08fb347 100644 --- a/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Alignment.php +++ b/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Alignment.php @@ -73,7 +73,8 @@ class Alignment extends CKEditor5PluginDefault implements CKEditor5PluginConfigu * {@inheritdoc} */ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { - // Match the config schema structure at ckeditor5.plugin.ckeditor5_alignment. + // Match the config schema structure at + // ckeditor5.plugin.ckeditor5_alignment. $form_value = $form_state->getValue('enabled_alignments'); $config_value = array_values(array_filter($form_value)); $form_state->setValue('enabled_alignments', $config_value); diff --git a/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/ImageResize.php b/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/ImageResize.php index 353cb2cbacc..8811a65b7fb 100644 --- a/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/ImageResize.php +++ b/core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/ImageResize.php @@ -43,7 +43,8 @@ class ImageResize extends CKEditor5PluginDefault implements CKEditor5PluginConfi * {@inheritdoc} */ public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { - // Match the config schema structure at ckeditor5.plugin.ckeditor5_imageResize. + // Match the config schema structure at + // ckeditor5.plugin.ckeditor5_imageResize. $form_value = $form_state->getValue('allow_resize'); $form_state->setValue('allow_resize', (bool) $form_value); } diff --git a/core/modules/ckeditor5/src/SmartDefaultSettings.php b/core/modules/ckeditor5/src/SmartDefaultSettings.php index f270dc9a316..ec3f90fa250 100644 --- a/core/modules/ckeditor5/src/SmartDefaultSettings.php +++ b/core/modules/ckeditor5/src/SmartDefaultSettings.php @@ -145,7 +145,8 @@ final class SmartDefaultSettings { } // Add toolbar items based on HTML tags and attributes. - // NOTE: Helper updates $editor->settings by reference and returns info for the message. + // NOTE: Helper updates $editor->settings by reference and returns info for + // the message. $result = $this->addToolbarItemsToMatchHtmlElementsInFormat($text_format, $editor); if ($result !== NULL) { [$enabling_message_content, $enabled_for_attributes_message_content, $missing, $plugins_enabled] = $result; @@ -217,8 +218,8 @@ final class SmartDefaultSettings { $this->addDefaultSettingsForEnabledConfigurablePlugins($editor); if ($has_html_restrictions) { - // Determine what tags/attributes are allowed in this text format that were - // not allowed previous to the switch. + // Determine what tags/attributes are allowed in this text format that + // were not allowed previous to the switch. $allowed_by_new_plugin_config = new HTMLRestrictions($this->pluginManager->getProvidedElements(array_keys($this->pluginManager->getEnabledDefinitions($editor)), $editor)); $surplus_tags_attributes = $allowed_by_new_plugin_config->diff($old_editor_restrictions)->diff($missing_fundamental_tags); $attributes_to_tag = []; diff --git a/core/modules/ckeditor5/tests/modules/ckeditor_test/src/Hook/CkeditorTestHooks.php b/core/modules/ckeditor5/tests/modules/ckeditor_test/src/Hook/CkeditorTestHooks.php index c775badc9f2..8e507e7d185 100644 --- a/core/modules/ckeditor5/tests/modules/ckeditor_test/src/Hook/CkeditorTestHooks.php +++ b/core/modules/ckeditor5/tests/modules/ckeditor_test/src/Hook/CkeditorTestHooks.php @@ -16,8 +16,8 @@ class CkeditorTestHooks { */ #[Hook('editor_info_alter')] public function editorInfoAlter(array &$editors): void { - // Drupal 9 used to have an editor called ckeditor. Copy the Unicorn editor to - // it to be able to test upgrading to CKEditor 5. + // Drupal 9 used to have an editor called ckeditor. Copy the Unicorn editor + // to it to be able to test upgrading to CKEditor 5. $editors['ckeditor'] = $editors['unicorn']; } diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBaselineTrait.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBaselineTrait.php index 9f6be924c24..2e0d3e6e3ce 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBaselineTrait.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBaselineTrait.php @@ -191,14 +191,15 @@ trait ImageTestBaselineTrait { $url_input->setValue('http://www.drupal.org/association'); $balloon->pressButton('Save'); - // Assert the "editingDowncast" HTML after making changes. First assert the - // link exists, then assert the expected DOM structure in detail. + // Assert the "editingDowncast" HTML after making changes. First assert + // the link exists, then assert the expected DOM structure in detail. $assert_session->elementExists('css', '.ck-content a[href*="//www.drupal.org/association"]'); - // For inline images, the link is wrapping the widget; for block images the - // link lives inside the widget. (This is how it is implemented upstream, it - // could be implemented differently, we just want to ensure we do not break - // it. Drupal only cares about having its own "dataDowncast", the - // "editingDowncast" is considered an implementation detail.) + // For inline images, the link is wrapping the widget; for block images + // the link lives inside the widget. (This is how it is implemented + // upstream, it could be implemented differently, we just want to ensure + // we do not break it. Drupal only cares about having its own + // "dataDowncast", the "editingDowncast" is considered an implementation + // detail.) $assert_session->elementExists('css', $image_type === 'inline' ? '.ck-content a[href*="//www.drupal.org/association"] .ck-widget.' . $expected_widget_class . ' > img[src*="' . $src . '"][alt="drupalimage test image"]' : '.ck-content .ck-widget.' . $expected_widget_class . ' a[href*="//www.drupal.org/association"] > img[src*="' . $src . '"][alt="drupalimage test image"]' @@ -233,8 +234,8 @@ trait ImageTestBaselineTrait { : 'a[href="http://www.drupal.org/association"] img[src*="' . $src . '"]'); // Go back to edit the now *linked* <drupal-media>. Everything from this - // point onwards is effectively testing "upcasting" and proving there is no - // data loss. + // point onwards is effectively testing "upcasting" and proving there is + // no data loss. $this->drupalGet($this->host->toUrl('edit-form')); $this->waitForEditor(); diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestProviderTrait.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestProviderTrait.php index 85f9b4e9e7a..91ff49e9186 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestProviderTrait.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestProviderTrait.php @@ -160,7 +160,8 @@ trait ImageTestProviderTrait { $this->assertEquals('center', $drupal_media_element->getAttribute('data-align')); $page->pressButton('Save'); - // Check that the 'content has been updated' message status appears to confirm we left the editor. + // Check that the 'content has been updated' message status appears to + // confirm we left the editor. $this->assertNotEmpty($assert_session->waitForElementVisible('css', '[data-drupal-messages]')); // Check that the class is correct in the front end. $assert_session->elementExists('css', 'img.align-center'); diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php index 4b3f570cd48..c46c5588ac3 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php @@ -51,8 +51,8 @@ class LanguageTest extends CKEditor5TestBase { $this->triggerKeyUp('.ckeditor5-toolbar-item-sourceEditing', 'ArrowDown'); $assert_session->assertWaitOnAjaxRequest(); - // The Source Editing plugin settings form should now be present and should - // have no allowed tags configured. + // The Source Editing plugin settings form should now be present and + // should have no allowed tags configured. $page->clickLink('Source editing'); $this->assertNotNull($assert_session->waitForElementVisible('css', '[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-sourceediting-allowed-tags"]')); diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaLinkabilityTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaLinkabilityTest.php index d5b780dcfc4..f7580f8847a 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaLinkabilityTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaLinkabilityTest.php @@ -32,9 +32,9 @@ class MediaLinkabilityTest extends MediaTestBase { ->setFilterConfig('filter_html', ['status' => FALSE]); } else { - // Allow the data-foo attribute in <a> via GHS. Also, add support for div's - // with data-foo attribute to ensure that linked drupal-media elements can - // be wrapped with <div>. + // Allow the data-foo attribute in <a> via GHS. Also, add support for + // div's with data-foo attribute to ensure that linked drupal-media + // elements can be wrapped with <div>. $settings['plugins']['ckeditor5_sourceEditing']['allowed_tags'] = ['<a data-foo>', '<div data-bar>']; $editor->setSettings($settings); $filter_format->setFilterConfig('filter_html', [ diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php index 456e01bc866..7fe9c9f00bc 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php @@ -611,7 +611,8 @@ class MediaTest extends MediaTestBase { $this->assertEquals('center', $drupal_media_element->getAttribute('data-align')); $page->pressButton('Save'); - // Check that the 'content has been updated' message status appears to confirm we left the editor. + // Check that the 'content has been updated' message status appears to + // confirm we left the editor. $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.messages.messages--status')); // Check that the class is correct in the front end. $assert_session->elementExists('css', 'figure.align-center'); @@ -743,7 +744,8 @@ class MediaTest extends MediaTestBase { $assert_session->elementNotExists('css', '.ck-widget.drupal-media.arbitrary-class'); $page->pressButton('Save'); - // Check that the 'content has been updated' message status appears to confirm we left the editor. + // Check that the 'content has been updated' message status appears to + // confirm we left the editor. $assert_session->waitForElementVisible('css', 'messages messages--status'); // Ensure that the class is correct in the front end. diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/StyleTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/StyleTest.php index e53a5057177..e295090d7c1 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/StyleTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/StyleTest.php @@ -109,8 +109,8 @@ JS; // The CKEditor 5 module should refuse to allow styles on non-HTML5 tags. $assert_session->waitForElement('css', '[role=alert][data-drupal-message-type="error"]:contains("A style can only be specified for an HTML 5 tag. <drupal-media> is not an HTML5 tag.")'); - // The vertical tab for "Style" settings should not be marked up as the cause - // of the error, but only the "Styles" text area in the vertical tab. + // The vertical tab for "Style" settings should not be marked up as the + // cause of the error, but only the "Styles" text area in the vertical tab. $assert_session->elementNotExists('css', '.vertical-tabs__pane[data-ckeditor5-plugin-id="ckeditor5_style"][aria-invalid="true"]'); $assert_session->elementExists('css', '.vertical-tabs__pane[data-ckeditor5-plugin-id="ckeditor5_style"] textarea[data-drupal-selector="edit-editor-settings-plugins-ckeditor5-style-styles"][aria-invalid="true"]'); diff --git a/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php b/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php index 4f7adb49e87..c18a8724f65 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php @@ -173,10 +173,10 @@ YAML, // static file cache in \Drupal\Core\Extension\ExtensionDiscovery. There is // no work-around that allows using both the files on disk and some in vfs. // To make matters worse, decorating a service within the test only is not - // an option either, because \Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition - // is a pure value object, so it uses the global container. Therefore the - // only work-around possible is to manipulate the config schema definition - // cache. + // an option either, because + // \Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition is a pure value + // object, so it uses the global container. Therefore the only work-around + // possible is to manipulate the config schema definition cache. // @todo Remove this in https://www.drupal.org/project/drupal/issues/2961541. if (isset($additional_files['config']['schema']["$module_name.schema.yml"])) { $cache = \Drupal::service('cache.discovery') diff --git a/core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php b/core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php index f899cb0200e..2b9d4d1fde8 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.php @@ -517,7 +517,8 @@ class SmartDefaultSettingsTest extends KernelTestBase { $updated_validation_errors = $this->validatePairToViolationsArray($updated_text_editor, $updated_text_format, TRUE); if (is_null($expected_post_update_text_editor_violations)) { - // If a violation is not expected, it should be compared against an empty array. + // If a violation is not expected, it should be compared against an empty + // array. $this->assertSame([], $updated_validation_errors); } else { diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 47f024f3ce1..fa4c683c821 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -168,7 +168,8 @@ function template_preprocess_comment(&$variables): void { $variables['author_id'] = $comment->getOwnerId(); $variables['new_indicator_timestamp'] = $comment->getChangedTime(); $variables['created'] = $date_formatter->format($comment->getCreatedTime()); - // Avoid calling DateFormatterInterface::format() twice on the same timestamp. + // Avoid calling DateFormatterInterface::format() twice on the same + // timestamp. if ($comment->getChangedTime() == $comment->getCreatedTime()) { $variables['changed'] = $variables['created']; } diff --git a/core/modules/comment/src/CommentManager.php b/core/modules/comment/src/CommentManager.php index 64c1a59946f..dbd25f749d0 100644 --- a/core/modules/comment/src/CommentManager.php +++ b/core/modules/comment/src/CommentManager.php @@ -199,7 +199,8 @@ class CommentManager implements CommentManagerInterface { // @todo Replace module handler with optional history service injection // after https://www.drupal.org/node/2081585. if ($this->currentUser->isAuthenticated() && $this->moduleHandler->moduleExists('history')) { - // Retrieve the timestamp at which the current user last viewed this entity. + // Retrieve the timestamp at which the current user last viewed this + // entity. if (!$timestamp) { if ($entity->getEntityTypeId() == 'node') { $timestamp = history_read($entity->id()); diff --git a/core/modules/comment/src/CommentViewsData.php b/core/modules/comment/src/CommentViewsData.php index d98ef636fdf..f2aa88a17a0 100644 --- a/core/modules/comment/src/CommentViewsData.php +++ b/core/modules/comment/src/CommentViewsData.php @@ -235,8 +235,8 @@ class CommentViewsData extends EntityViewsData { $data['comment_field_data']['pid']['relationship']['help'] = $this->t('The parent comment'); $data['comment_field_data']['pid']['relationship']['label'] = $this->t('parent'); - // Define the base group of this table. Fields that don't have a group defined - // will go into this field by default. + // Define the base group of this table. Fields that don't have a group + // defined will go into this field by default. $data['comment_entity_statistics']['table']['group'] = $this->t('Comment Statistics'); // Provide a relationship for each entity type except comment. @@ -246,10 +246,10 @@ class CommentViewsData extends EntityViewsData { } // This relationship does not use the 'field id' column, if the entity has // multiple comment-fields, then this might introduce duplicates, in which - // case the site-builder should enable aggregation and SUM the comment_count - // field. We cannot create a relationship from the base table to - // {comment_entity_statistics} for each field as multiple joins between - // the same two tables is not supported. + // case the site-builder should enable aggregation and SUM the + // comment_count field. We cannot create a relationship from the base + // table to {comment_entity_statistics} for each field as multiple joins + // between the same two tables is not supported. if (\Drupal::service('comment.manager')->getFields($type)) { $data['comment_entity_statistics']['table']['join'][$entity_type->getDataTable() ?: $entity_type->getBaseTable()] = [ 'type' => 'LEFT', diff --git a/core/modules/comment/src/Hook/CommentHooks.php b/core/modules/comment/src/Hook/CommentHooks.php index 34682d10def..e33586e8206 100644 --- a/core/modules/comment/src/Hook/CommentHooks.php +++ b/core/modules/comment/src/Hook/CommentHooks.php @@ -135,8 +135,8 @@ class CommentHooks { #[Hook('field_config_update')] public function fieldConfigUpdate(FieldConfigInterface $field): void { if ($field->getType() == 'comment') { - // Comment field settings also affects the rendering of *comment* entities, - // not only the *commented* entities. + // Comment field settings also affects the rendering of *comment* + // entities, not only the *commented* entities. \Drupal::entityTypeManager()->getViewBuilder('comment')->resetCache(); } } @@ -278,7 +278,8 @@ class CommentHooks { return; } // Load comment information from the database and update the entity's - // comment statistics properties, which are defined on each CommentItem field. + // comment statistics properties, which are defined on each CommentItem + // field. $result = \Drupal::service('comment.statistics')->read($entities, $entity_type); foreach ($result as $record) { // Skip fields that entity does not have. @@ -312,10 +313,10 @@ class CommentHooks { #[Hook('entity_predelete')] public function entityPredelete(EntityInterface $entity): void { // Entities can have non-numeric IDs, but {comment} and - // {comment_entity_statistics} tables have integer columns for entity ID, and - // PostgreSQL throws exceptions if you attempt query conditions with - // mismatched types. So, we need to verify that the ID is numeric (even for an - // entity type that has an integer ID, $entity->id() might be a string + // {comment_entity_statistics} tables have integer columns for entity ID, + // and PostgreSQL throws exceptions if you attempt query conditions with + // mismatched types. So, we need to verify that the ID is numeric (even for + // an entity type that has an integer ID, $entity->id() might be a string // containing a number), and then cast it to an integer when querying. if ($entity instanceof FieldableEntityInterface && is_numeric($entity->id())) { $entity_query = \Drupal::entityQuery('comment')->accessCheck(FALSE); @@ -491,7 +492,8 @@ class CommentHooks { if (!$storage->loadUnchanged($display->getOriginalId())->status()) { return; } - // Disable the comment field formatter when the used view display is disabled. + // Disable the comment field formatter when the used view display is + // disabled. foreach ($storage->loadMultiple() as $view_display) { $changed = FALSE; /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */ diff --git a/core/modules/comment/src/Hook/CommentTokensHooks.php b/core/modules/comment/src/Hook/CommentTokensHooks.php index fc227fae3b4..68696eee760 100644 --- a/core/modules/comment/src/Hook/CommentTokensHooks.php +++ b/core/modules/comment/src/Hook/CommentTokensHooks.php @@ -138,8 +138,8 @@ class CommentTokensHooks { case 'mail': $mail = $comment->getAuthorEmail(); - // Add the user cacheability metadata in case the author of the comment - // is not the anonymous user. + // Add the user cacheability metadata in case the author of the + // comment is not the anonymous user. if ($comment->getOwnerId()) { $bubbleable_metadata->addCacheableDependency($comment->getOwner()); } @@ -155,8 +155,8 @@ class CommentTokensHooks { break; case 'body': - // "processed" returns a \Drupal\Component\Render\MarkupInterface via - // check_markup(). + // "processed" returns a \Drupal\Component\Render\MarkupInterface + // via check_markup(). $replacements[$original] = $comment->comment_body->processed; break; @@ -177,8 +177,8 @@ class CommentTokensHooks { case 'author': $name = $comment->getAuthorName(); - // Add the user cacheability metadata in case the author of the comment - // is not the anonymous user. + // Add the user cacheability metadata in case the author of the + // comment is not the anonymous user. if ($comment->getOwnerId()) { $bubbleable_metadata->addCacheableDependency($comment->getOwner()); } diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php index d46189b8104..e081bdabbbd 100644 --- a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php +++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php @@ -172,9 +172,9 @@ class CommentDefaultFormatter extends FormatterBase { $build = $this->viewBuilder->viewMultiple($comments, $this->getSetting('view_mode')); $build['pager']['#type'] = 'pager'; // CommentController::commentPermalink() calculates the page number - // where a specific comment appears and does a subrequest pointing to - // that page, we need to pass that subrequest route to our pager to - // keep the pager working. + // where a specific comment appears and does a subrequest pointing + // to that page, we need to pass that subrequest route to our pager + // to keep the pager working. $build['pager']['#route_name'] = $this->routeMatch->getRouteName(); $build['pager']['#route_parameters'] = $this->routeMatch->getRawParameters()->all(); if ($this->getSetting('pager_id')) { diff --git a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php index dd21d393d2f..a6a00eb7589 100644 --- a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php +++ b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php @@ -139,7 +139,8 @@ class CommentAnonymousTest extends CommentTestBase { $this->drupalLogin($this->adminUser); $this->drupalGet('comment/' . $anonymous_comment3->id() . '/edit'); $this->assertSession()->responseContains($author_name); - // Check the author field is empty (i.e. anonymous) when editing the comment. + // Check the author field is empty (i.e. anonymous) when editing the + // comment. $this->assertSession()->fieldValueEquals('uid', ''); $this->assertSession()->responseContains($author_mail); diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php index d6b01d72173..819403386b1 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -40,8 +40,8 @@ class CommentPagerTest extends CommentTestBase { $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_FLAT, 'Comment paging changed.'); - // Set "Comments per page" as zero and verify that all comments are appearing - // on the page. + // Set "Comments per page" as zero and verify that all comments are + // appearing on the page. $this->setCommentsPerPage(0); $this->drupalGet('node/' . $node->id()); $this->assertTrue($this->commentExists($comments[0]), 'Comment 1 appears on page.'); diff --git a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php index f279c1ac8ee..e116ea29db7 100644 --- a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php @@ -75,14 +75,16 @@ class CommentPreviewTest extends CommentTestBase { $this->assertSession()->pageTextContains($edit['subject[0][value]']); $this->assertSession()->pageTextContains($edit['comment_body[0][value]']); - // Check that the title and body fields are displayed with the correct values. + // Check that the title and body fields are displayed with the correct + // values. $this->assertSession()->fieldValueEquals('subject[0][value]', $edit['subject[0][value]']); $this->assertSession()->fieldValueEquals('comment_body[0][value]', $edit['comment_body[0][value]']); // Check that the user picture is displayed. $this->assertSession()->elementExists('xpath', "//article[contains(@class, 'preview')]//div[contains(@class, 'user-picture')]//img"); - // Ensure that preview node is displayed after the submit buttons of the form. + // Ensure that preview node is displayed after the submit buttons of the + // form. $xpath = $this->assertSession()->buildXPathQuery('//div[@id=:id]/following-sibling::article', [':id' => 'edit-actions']); $this->assertSession()->elementExists('xpath', $xpath); } @@ -111,7 +113,8 @@ class CommentPreviewTest extends CommentTestBase { $this->assertSession()->pageTextContains($edit['subject[0][value]']); $this->assertSession()->pageTextContains($edit['comment_body[0][value]']); - // Check that the title and body fields are displayed with the correct values. + // Check that the title and body fields are displayed with the correct + // values. $this->assertSession()->fieldValueEquals('subject[0][value]', $edit['subject[0][value]']); $this->assertSession()->fieldValueEquals('comment_body[0][value]', $edit['comment_body[0][value]']); @@ -159,14 +162,16 @@ class CommentPreviewTest extends CommentTestBase { $this->drupalGet('comment/' . $comment->id() . '/edit'); $this->submitForm($edit, 'Preview'); - // Check that the preview is displaying the subject, comment, author and date correctly. + // Check that the preview is displaying the subject, comment, author and + // date correctly. $this->assertSession()->titleEquals('Preview comment | Drupal'); $this->assertSession()->pageTextContains($edit['subject[0][value]']); $this->assertSession()->pageTextContains($edit['comment_body[0][value]']); $this->assertSession()->pageTextContains($web_user->getAccountName()); $this->assertSession()->pageTextContains($expected_text_date); - // Check that the subject, comment, author and date fields are displayed with the correct values. + // Check that the subject, comment, author and date fields are displayed + // with the correct values. $this->assertSession()->fieldValueEquals('subject[0][value]', $edit['subject[0][value]']); $this->assertSession()->fieldValueEquals('comment_body[0][value]', $edit['comment_body[0][value]']); $this->assertSession()->fieldValueEquals('uid', $edit['uid']); @@ -178,7 +183,8 @@ class CommentPreviewTest extends CommentTestBase { $this->submitForm($edit, 'Save'); $this->assertSession()->pageTextContains('Your comment has been updated.'); - // Check that the comment fields are correct after loading the saved comment. + // Check that the comment fields are correct after loading the saved + // comment. $this->drupalGet('comment/' . $comment->id() . '/edit'); $this->assertSession()->fieldValueEquals('subject[0][value]', $edit['subject[0][value]']); $this->assertSession()->fieldValueEquals('comment_body[0][value]', $edit['comment_body[0][value]']); diff --git a/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php b/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php index b0741d3bdaa..6c0b4dc35f3 100644 --- a/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php +++ b/core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php @@ -382,7 +382,8 @@ abstract class CommentResourceTestBase extends EntityResourceTestBase { // Grant anonymous permission to skip comment approval. $this->grantPermissionsToTestedRole(['skip comment approval']); - // Status should be TRUE when posting as anonymous and skip comment approval. + // Status should be TRUE when posting as anonymous and skip comment + // approval. $response = $this->request('POST', $url, $request_options); $unserialized = $this->serializer->deserialize((string) $response->getBody(), get_class($this->entity), static::$format); $this->assertResourceResponse(201, FALSE, $response); diff --git a/core/modules/config/tests/config_test/src/Hook/ConfigTestHooks.php b/core/modules/config/tests/config_test/src/Hook/ConfigTestHooks.php index 4274935a953..9e92f3b0cf6 100644 --- a/core/modules/config/tests/config_test/src/Hook/ConfigTestHooks.php +++ b/core/modules/config/tests/config_test/src/Hook/ConfigTestHooks.php @@ -27,9 +27,9 @@ class ConfigTestHooks { #[Hook('entity_type_alter')] public function entityTypeAlter(array &$entity_types) : void { /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */ - // The 'translatable' entity key is not supposed to change over time. In this - // case we can safely do it because we set it once and we do not change it for - // all the duration of the test session. + // The 'translatable' entity key is not supposed to change over time. In + // this case we can safely do it because we set it once and we do not change + // it for all the duration of the test session. $entity_types['config_test']->set('translatable', \Drupal::service('state')->get('config_test.translatable')); // Create a clone of config_test that does not have a status. $entity_types['config_test_no_status'] = clone $entity_types['config_test']; diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php index 0c691c76ec5..654695442ce 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php @@ -60,7 +60,8 @@ class ConfigEntityListMultilingualTest extends BrowserTestBase { 'langcode' => 'hu', ]; $this->submitForm($edit, 'Save'); - // Ensure that operations for editing the Hungarian entity appear in English. + // Ensure that operations for editing the Hungarian entity appear in + // English. $this->assertSession()->linkByHrefExists('admin/structure/config_test/manage/antilop'); // Get the list page in Hungarian and assert Hungarian admin links diff --git a/core/modules/config/tests/src/Functional/ConfigImportAllTest.php b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php index 53b23d37cdc..50195354701 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportAllTest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php @@ -110,7 +110,8 @@ class ConfigImportAllTest extends ModuleTestBase { $database_module = \Drupal::service('database')->getProvider(); $expected_modules = ['path_alias', 'system', 'user', $database_module]; - // Ensure that only core required modules and the install profile can not be uninstalled. + // Ensure that only core required modules and the install profile can not be + // uninstalled. $validation_reasons = \Drupal::service('module_installer')->validateUninstall(array_keys($all_modules)); $validation_modules = array_keys($validation_reasons); $this->assertEqualsCanonicalizing($expected_modules, $validation_modules); diff --git a/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php index 1bf53507e12..8ee31a50f90 100644 --- a/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php @@ -144,7 +144,8 @@ class ConfigInstallProfileOverrideTest extends BrowserTestBase { $config_test_storage = \Drupal::entityTypeManager()->getStorage('config_test'); $this->assertNull($config_test_storage->load('completely_new')); - // Ensure the authenticated role has the access entity_test_bundle permission. + // Ensure the authenticated role has the access entity_test_bundle + // permission. $role = Role::load(Role::AUTHENTICATED_ID); $this->assertTrue($role->hasPermission('administer entity_test_bundle content'), 'The Authenticated role has the "administer entity_test_bundle content" permission.'); $this->assertEquals(['module' => ['entity_test']], $role->getDependencies()); diff --git a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php index d903d14d95c..3902d79c461 100644 --- a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php +++ b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php @@ -57,7 +57,8 @@ class ConfigSingleImportExportTest extends BrowserTestBase { $this->drupalGet('admin/config/development/configuration/single/import'); $this->submitForm($edit, 'Import'); - // Assert the static portion of the error since different parsers could give different text in their error. + // Assert the static portion of the error since different parsers could give + // different text in their error. $this->assertSession()->pageTextContains('The import failed with the following message: '); $import = <<<EOD diff --git a/core/modules/config/tests/src/FunctionalJavascript/ConfigExportTest.php b/core/modules/config/tests/src/FunctionalJavascript/ConfigExportTest.php index 121edd515f2..4323a4b2ae3 100644 --- a/core/modules/config/tests/src/FunctionalJavascript/ConfigExportTest.php +++ b/core/modules/config/tests/src/FunctionalJavascript/ConfigExportTest.php @@ -43,7 +43,8 @@ class ConfigExportTest extends WebDriverTestBase { 'administer block content', ])); - // Create test blocks, so we know what the titles will be to check their order. + // Create test blocks, so we know what the titles will be to check their + // order. foreach ([1, 2, 3, 4] as $num) { $block_name = $this->blockNamePrefix . $num; $new_block = $this->createBlockContent($block_name); @@ -108,7 +109,8 @@ class ConfigExportTest extends WebDriverTestBase { $this->assertSession()->fieldValueEquals('export', ''); // Check that the 'Configuration name' list is sorted alphabetically by ID, - // which always begins with our prefix, and not the label, which is randomized. + // which always begins with our prefix, and not the label, which is + // randomized. $page->selectFieldOption('config_type', 'Block'); $this->assertSession()->assertWaitOnAjaxRequest(); $options = $page->findField('config_name')->findAll('css', 'option'); diff --git a/core/modules/config_translation/src/Controller/ConfigTranslationController.php b/core/modules/config_translation/src/Controller/ConfigTranslationController.php index 9529ac65a68..f6ec1a474aa 100644 --- a/core/modules/config_translation/src/Controller/ConfigTranslationController.php +++ b/core/modules/config_translation/src/Controller/ConfigTranslationController.php @@ -177,7 +177,8 @@ class ConfigTranslationController extends ControllerBase { } // We create a fake request object to pass into - // ConfigMapperInterface::populateFromRouteMatch() for the different languages. + // ConfigMapperInterface::populateFromRouteMatch() for the different + // languages. // Creating a separate request for each language and route is neither easily // possible nor performant. $fake_request = $request->duplicate(); diff --git a/core/modules/config_translation/src/Hook/ConfigTranslationHooks.php b/core/modules/config_translation/src/Hook/ConfigTranslationHooks.php index 465bda6f5a0..f79a60cef49 100644 --- a/core/modules/config_translation/src/Hook/ConfigTranslationHooks.php +++ b/core/modules/config_translation/src/Hook/ConfigTranslationHooks.php @@ -111,7 +111,8 @@ class ConfigTranslationHooks { } elseif ($entity_type_id == 'field_config') { $class = 'Drupal\config_translation\Controller\ConfigTranslationFieldListBuilder'; - // Will be filled in dynamically, see \Drupal\field\Entity\FieldConfig::linkTemplates(). + // Will be filled in dynamically, see + // \Drupal\field\Entity\FieldConfig::linkTemplates(). $entity_type->setLinkTemplate('config-translation-overview', $entity_type->getLinkTemplate('edit-form') . '/translate'); } else { @@ -207,9 +208,9 @@ class ConfigTranslationHooks { 'sequence' => '\Drupal\config_translation\FormElement\ListElement', 'plural_label' => '\Drupal\config_translation\FormElement\PluralVariants', ]; - // Enhance the text and date type definitions with classes to generate proper - // form elements in ConfigTranslationFormBase. Other translatable types will - // appear as a one line textfield. + // Enhance the text and date type definitions with classes to generate + // proper form elements in ConfigTranslationFormBase. Other translatable + // types will appear as a one line textfield. foreach ($definitions as $type => &$definition) { if (isset($map[$type]) && !isset($definition['form_element_class'])) { $definition['form_element_class'] = $map[$type]; diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php index 563cb554919..230081cf9b3 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php @@ -510,7 +510,8 @@ class ConfigTranslationListUiTest extends BrowserTestBase { $this->doDateFormatListTest(); $this->doFieldListTest(); - // Views is tested in Drupal\config_translation\Tests\ConfigTranslationViewListUiTest + // Views is tested in + // Drupal\config_translation\Tests\ConfigTranslationViewListUiTest // Test the maintenance settings page. $this->doSettingsPageTest('admin/config/development/maintenance'); diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php index fe4b0e7d08f..a7fdd9aa872 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php @@ -115,7 +115,8 @@ class ConfigTranslationUiTest extends ConfigTranslationUiTestBase { ]; foreach ($languages as $langcode => $data) { - // Import a .po file to add a new language with a given number of plural forms + // Import a .po file to add a new language with a given number of plural + // forms. $name = \Drupal::service('file_system')->tempnam('temporary://', $langcode . '_') . '.po'; file_put_contents($name, $this->getPoFile($data['plurals'])); $this->drupalGet('admin/config/regional/translate/import'); diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php index be1fb136eda..bac903bdd29 100644 --- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php +++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php @@ -393,7 +393,8 @@ class ContactPersonalTest extends BrowserTestBase { // Tests that the opt-out message is not included in admin user copy emails. $this->assertStringNotContainsString($opt_out_message, $user_copy_emails[0]['body'], 'Opt-out message not included in admin user copy email.'); - // Tests that the opt-out message is not included in non-admin user copy emails. + // Tests that the opt-out message is not included in non-admin user copy + // emails. $this->assertStringNotContainsString($opt_out_message, $user_copy_emails[1]['body'], 'Opt-out message not included in non-admin user copy email.'); } diff --git a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php index b90d0dbade1..b3cba2bd1ba 100644 --- a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php +++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php @@ -226,7 +226,8 @@ class ContactSitewideTest extends BrowserTestBase { $this->drupalLogout(); - // Check to see that anonymous user cannot see contact page without permission. + // Check to see that anonymous user cannot see contact page without + // permission. user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']); $this->drupalGet('contact'); $this->assertSession()->statusCodeEquals(403); @@ -465,7 +466,8 @@ class ContactSitewideTest extends BrowserTestBase { $subject = $this->randomMachineName(64); $this->submitContact($this->randomMachineName(16), $email, $subject, 'foo', $this->randomString(128)); - // We are testing the auto-reply, so there should be one email going to the sender. + // We are testing the auto-reply, so there should be one email going to the + // sender. $captured_emails = $this->getMails(['id' => 'contact_page_autoreply', 'to' => $email]); $this->assertCount(1, $captured_emails); $this->assertEquals(trim(MailFormatHelper::htmlToText($foo_autoreply)), trim($captured_emails[0]['body'])); @@ -474,12 +476,14 @@ class ContactSitewideTest extends BrowserTestBase { $email = $this->randomMachineName(32) . '@example.com'; $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'bar', $this->randomString(128)); - // Auto-reply for form 'bar' should result in one auto-reply email to the sender. + // Auto-reply for form 'bar' should result in one auto-reply email to the + // sender. $captured_emails = $this->getMails(['id' => 'contact_page_autoreply', 'to' => $email]); $this->assertCount(1, $captured_emails); $this->assertEquals(trim(MailFormatHelper::htmlToText($bar_autoreply)), trim($captured_emails[0]['body'])); - // Verify that no auto-reply is sent when the auto-reply field is left blank. + // Verify that no auto-reply is sent when the auto-reply field is left + // blank. $email = $this->randomMachineName(32) . '@example.com'; $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'no_autoreply', $this->randomString(128)); $captured_emails = $this->getMails(['id' => 'contact_page_autoreply', 'to' => $email]); diff --git a/core/modules/content_moderation/src/Hook/ContentModerationHooks.php b/core/modules/content_moderation/src/Hook/ContentModerationHooks.php index 03e6f343eaf..6692a8b675b 100644 --- a/core/modules/content_moderation/src/Hook/ContentModerationHooks.php +++ b/core/modules/content_moderation/src/Hook/ContentModerationHooks.php @@ -93,8 +93,8 @@ class ContentModerationHooks { if (isset($base_field_definitions['moderation_state'])) { // Add the target bundle to the moderation state field. Since each bundle // can be attached to a different moderation workflow, adding this - // information to the field definition allows the associated workflow to be - // derived where a field definition is present. + // information to the field definition allows the associated workflow to + // be derived where a field definition is present. $base_field_definitions['moderation_state']->setTargetBundle($bundle); return ['moderation_state' => $base_field_definitions['moderation_state']]; } @@ -248,7 +248,8 @@ class ContentModerationHooks { $moderation_info = \Drupal::service('content_moderation.moderation_information'); $entity_type = \Drupal::entityTypeManager()->getDefinition($field_definition->getTargetEntityTypeId()); $entity = $items->getEntity(); - // Deny edit access to the published field if the entity is being moderated. + // Deny edit access to the published field if the entity is being + // moderated. if ($entity_type->hasKey('published') && $moderation_info->isModeratedEntity($entity) && $entity->moderation_state && $field_definition->getName() == $entity_type->getKey('published')) { return AccessResult::forbidden('Cannot edit the published field of moderated entities.'); } @@ -269,10 +270,10 @@ class ContentModerationHooks { */ #[Hook('action_info_alter')] public function actionInfoAlter(&$definitions): void { - // The publish/unpublish actions are not valid on moderated entities. So swap - // their implementations out for alternates that will become a no-op on a - // moderated entity. If another module has already swapped out those classes, - // though, we'll be polite and do nothing. + // The publish/unpublish actions are not valid on moderated entities. So + // swap their implementations out for alternates that will become a no-op on + // a moderated entity. If another module has already swapped out those + // classes, though, we'll be polite and do nothing. foreach ($definitions as &$definition) { if ($definition['id'] === 'entity:publish_action' && $definition['class'] == PublishAction::class) { $definition['class'] = ModerationOptOutPublish::class; @@ -297,10 +298,10 @@ class ContentModerationHooks { foreach ($plugin->getBundlesForEntityType($entity_type_id) as $bundle_id) { if (isset($bundles[$entity_type_id][$bundle_id])) { $bundles[$entity_type_id][$bundle_id]['workflow'] = $workflow->id(); - // If we have even one moderation-enabled translatable bundle, we need - // to make the moderation state bundle translatable as well, to enable - // the revision translation merge logic also for content moderation - // state revisions. + // If we have even one moderation-enabled translatable bundle, we + // need to make the moderation state bundle translatable as well, to + // enable the revision translation merge logic also for content + // moderation state revisions. if (!empty($bundles[$entity_type_id][$bundle_id]['translatable'])) { $translatable = TRUE; } diff --git a/core/modules/content_moderation/tests/modules/content_moderation_test_resave/src/Hook/ContentModerationTestResaveHooks.php b/core/modules/content_moderation/tests/modules/content_moderation_test_resave/src/Hook/ContentModerationTestResaveHooks.php index 563b4b5708f..49080182487 100644 --- a/core/modules/content_moderation/tests/modules/content_moderation_test_resave/src/Hook/ContentModerationTestResaveHooks.php +++ b/core/modules/content_moderation/tests/modules/content_moderation_test_resave/src/Hook/ContentModerationTestResaveHooks.php @@ -24,10 +24,11 @@ class ContentModerationTestResaveHooks { // Saving the passed entity object would populate its loaded revision ID, // which we want to avoid. Thus, save a clone of the original object. $cloned_entity = clone $entity; - // Set the entity's syncing status, as we do not want Content Moderation to - // create new revisions for the re-saving. Without this call Content + // Set the entity's syncing status, as we do not want Content Moderation + // to create new revisions for the re-saving. Without this call Content // Moderation would end up creating two separate content moderation state - // entities: one for the re-save revision and one for the initial revision. + // entities: one for the re-save revision and one for the initial + // revision. $cloned_entity->setSyncing(TRUE)->save(); // Record the fact that a re-save happened. \Drupal::state()->set('content_moderation_test_resave', TRUE); diff --git a/core/modules/content_translation/src/ContentTranslationPermissions.php b/core/modules/content_translation/src/ContentTranslationPermissions.php index 031314bbb76..4243ea4dc74 100644 --- a/core/modules/content_translation/src/ContentTranslationPermissions.php +++ b/core/modules/content_translation/src/ContentTranslationPermissions.php @@ -72,8 +72,8 @@ class ContentTranslationPermissions implements ContainerInjectionInterface { */ public function contentPermissions() { $permissions = []; - // Create a translate permission for each enabled entity type and (optionally) - // bundle. + // Create a translate permission for each enabled entity type and + // (optionally) bundle. foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { if ($permission_granularity = $entity_type->getPermissionGranularity()) { switch ($permission_granularity) { diff --git a/core/modules/content_translation/src/FieldTranslationSynchronizer.php b/core/modules/content_translation/src/FieldTranslationSynchronizer.php index 1af116297ee..3913ae6dd75 100644 --- a/core/modules/content_translation/src/FieldTranslationSynchronizer.php +++ b/core/modules/content_translation/src/FieldTranslationSynchronizer.php @@ -101,8 +101,8 @@ class FieldTranslationSynchronizer implements FieldTranslationSynchronizerInterf return; } // When this mode is enabled, changes to synchronized properties are - // allowed only in the default translation, thus we need to make sure this - // is always used as source for the synchronization process. + // allowed only in the default translation, thus we need to make sure + // this is always used as source for the synchronization process. else { $sync_langcode = $entity->getUntranslated()->language()->getId(); } diff --git a/core/modules/content_translation/src/Hook/ContentTranslationHooks.php b/core/modules/content_translation/src/Hook/ContentTranslationHooks.php index 27a8db8c401..e25afd41636 100644 --- a/core/modules/content_translation/src/Hook/ContentTranslationHooks.php +++ b/core/modules/content_translation/src/Hook/ContentTranslationHooks.php @@ -228,7 +228,8 @@ class ContentTranslationHooks { $settings = $content_translation_manager->getBundleTranslationSettings($entity_type_id, $bundle); // If pending revision support is enabled for this bundle, we need to // hide untranslatable field widgets, otherwise changes in pending - // revisions might be overridden by changes in later default revisions. + // revisions might be overridden by changes in later default + // revisions. $bundle_info['untranslatable_fields.default_translation_affected'] = !empty($settings['untranslatable_fields_hide']) || ContentTranslationManager::isPendingRevisionSupportEnabled($entity_type_id, $bundle); } } @@ -247,9 +248,9 @@ class ContentTranslationHooks { if ($manager->isSupported($entity_type_id)) { $definitions = $manager->getTranslationHandler($entity_type_id)->getFieldDefinitions(); $installed_storage_definitions = \Drupal::service('entity.last_installed_schema.repository')->getLastInstalledFieldStorageDefinitions($entity_type_id); - // We return metadata storage fields whenever content translation is enabled - // or it was enabled before, so that we keep translation metadata around - // when translation is disabled. + // We return metadata storage fields whenever content translation is + // enabled or it was enabled before, so that we keep translation metadata + // around when translation is disabled. // @todo Re-evaluate this approach and consider removing field storage // definitions and the related field data if the entity type has no // bundle enabled for translation. See https://www.drupal.org/i/2907777 @@ -311,8 +312,8 @@ class ContentTranslationHooks { */ #[Hook('views_data_alter')] public function viewsDataAlter(array &$data): void { - // Add the content translation entity link definition to Views data for entity - // types having translation enabled. + // Add the content translation entity link definition to Views data for + // entity types having translation enabled. $entity_types = \Drupal::entityTypeManager()->getDefinitions(); /** @var \Drupal\content_translation\ContentTranslationManagerInterface $manager */ $manager = \Drupal::service('content_translation.manager'); @@ -352,9 +353,9 @@ class ContentTranslationHooks { } $entity = $form_object->getEntity(); $op = $form_object->getOperation(); - // Let the content translation handler alter the content entity form. This can - // be the 'add' or 'edit' form. It also tries a 'default' form in case neither - // of the aforementioned forms are defined. + // Let the content translation handler alter the content entity form. This + // can be the 'add' or 'edit' form. It also tries a 'default' form in case + // neither of the aforementioned forms are defined. if ($entity instanceof ContentEntityInterface && $entity->isTranslatable() && count($entity->getTranslationLanguages()) > 1 && in_array($op, ['edit', 'add', 'default'], TRUE)) { $controller = \Drupal::entityTypeManager()->getHandler($entity->getEntityTypeId(), 'translation'); $controller->entityFormAlter($form, $form_state, $entity); @@ -403,8 +404,8 @@ class ContentTranslationHooks { $entity->addCacheableDependency($access); if (!$access->isAllowed()) { // If the user has no translation update access, also check view - // access for that translation, to allow other modules to allow access - // to unpublished translations. + // access for that translation, to allow other modules to allow + // access to unpublished translations. $access = $entity->getTranslation($langcode)->access('view', NULL, TRUE); $entity->addCacheableDependency($access); if (!$access->isAllowed()) { diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module index 4b2a3ff1696..a875584d1fa 100644 --- a/core/modules/contextual/contextual.module +++ b/core/modules/contextual/contextual.module @@ -30,14 +30,15 @@ function contextual_preprocess(&$variables, $hook, $info) { if (isset($element) && is_array($element) && !empty($element['#contextual_links'])) { $variables['#cache']['contexts'][] = 'user.permissions'; if (\Drupal::currentUser()->hasPermission('access contextual links')) { - // Mark this element as potentially having contextual links attached to it. + // Mark this element as potentially having contextual links attached to + // it. $variables['attributes']['class'][] = 'contextual-region'; - // Renders a contextual links placeholder unconditionally, thus not breaking - // the render cache. Although the empty placeholder is rendered for all - // users, contextual_page_attachments() only adds the asset library for - // users with the 'access contextual links' permission, thus preventing - // unnecessary HTTP requests for users without that permission. + // Renders a contextual links placeholder unconditionally, thus not + // breaking the render cache. Although the empty placeholder is rendered + // for all users, contextual_page_attachments() only adds the asset + // library for users with the 'access contextual links' permission, thus + // preventing unnecessary HTTP requests for users without that permission. $variables['title_suffix']['contextual_links'] = [ '#type' => 'contextual_links_placeholder', '#id' => _contextual_links_to_id($element['#contextual_links']), diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php index 8c2bc82a299..ab627cd0286 100644 --- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php +++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php @@ -106,8 +106,8 @@ class DateTimeFieldItemList extends FieldItemList { } $value = $date->format($format); // We only provide a default value for the first item, as do all fields. - // Otherwise, there is no way to clear out unwanted values on multiple value - // fields. + // Otherwise, there is no way to clear out unwanted values on multiple + // value fields. $default_value = [ [ 'value' => $value, diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php index 782b73a0d75..f2c2578f320 100644 --- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php +++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php @@ -169,11 +169,11 @@ class DateTimeFieldTest extends DateTestBase { $output = $this->renderTestEntity($id); $this->assertStringContainsString($expected, $output, "Formatted date field using daterange_custom format displayed as $expected in $timezone."); - // Verify that the 'datetime_time_ago' formatter works for intervals in the - // past. First update the test entity so that the date difference always - // has the same interval. Since the database always stores UTC, and the - // interval will use this, force the test date to use UTC and not the local - // or user timezone. + // Verify that the 'datetime_time_ago' formatter works for intervals in + // the past. First update the test entity so that the date difference + // always has the same interval. Since the database always stores UTC, + // and the interval will use this, force the test date to use UTC and not + // the local or user timezone. $timestamp = \Drupal::time()->getRequestTime() - 87654321; $entity = EntityTest::load($id); $field_name = $this->fieldStorage->getName(); @@ -196,11 +196,11 @@ class DateTimeFieldTest extends DateTestBase { $output = $this->renderTestEntity($id); $this->assertStringContainsString((string) $expected, $output, "Formatted date field using datetime_time_ago format displayed as $expected in $timezone."); - // Verify that the 'datetime_time_ago' formatter works for intervals in the - // future. First update the test entity so that the date difference always - // has the same interval. Since the database always stores UTC, and the - // interval will use this, force the test date to use UTC and not the local - // or user timezone. + // Verify that the 'datetime_time_ago' formatter works for intervals in + // the future. First update the test entity so that the date difference + // always has the same interval. Since the database always stores UTC, + // and the interval will use this, force the test date to use UTC and not + // the local or user timezone. $timestamp = \Drupal::time()->getRequestTime() + 87654321; $entity = EntityTest::load($id); $field_name = $this->fieldStorage->getName(); @@ -415,7 +415,8 @@ class DateTimeFieldTest extends DateTestBase { $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-hour\"]"); $this->assertSession()->elementNotExists('xpath', "//*[@id=\"edit-$field_name-0-value-minute\"]"); - // Go to the form display page to assert that increment option does not appear on Date Only + // Go to the form display page to assert that increment option does not + // appear on Date Only. $fieldEditUrl = 'entity_test/structure/entity_test/form-display'; $this->drupalGet($fieldEditUrl); @@ -441,7 +442,8 @@ class DateTimeFieldTest extends DateTestBase { ->save(); \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); - // Go to the form display page to assert that increment option does appear on Date Time + // Go to the form display page to assert that increment option does appear + // on Date Time. $fieldEditUrl = 'entity_test/structure/entity_test/form-display'; $this->drupalGet($fieldEditUrl); diff --git a/core/modules/datetime_range/src/DateTimeRangeTrait.php b/core/modules/datetime_range/src/DateTimeRangeTrait.php index 0563f7ff722..16411865c15 100644 --- a/core/modules/datetime_range/src/DateTimeRangeTrait.php +++ b/core/modules/datetime_range/src/DateTimeRangeTrait.php @@ -46,7 +46,8 @@ trait DateTimeRangeTrait { if (!empty($item->_attributes)) { $elements[$delta]['#attributes'] += $item->_attributes; // Unset field item attributes since they have been included in the - // formatter output and should not be rendered in the field template. + // formatter output and should not be rendered in the field + // template. unset($item->_attributes); } } diff --git a/core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangePlainFormatter.php b/core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangePlainFormatter.php index 960bd5e8ca7..7556ba5a0ea 100644 --- a/core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangePlainFormatter.php +++ b/core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangePlainFormatter.php @@ -56,7 +56,8 @@ class DateRangePlainFormatter extends DateTimePlainFormatter { if (!empty($item->_attributes)) { $elements[$delta]['#attributes'] += $item->_attributes; // Unset field item attributes since they have been included in the - // formatter output and should not be rendered in the field template. + // formatter output and should not be rendered in the field + // template. unset($item->_attributes); } } diff --git a/core/modules/dblog/src/Logger/DbLog.php b/core/modules/dblog/src/Logger/DbLog.php index c2219fd0291..f908ce70d31 100644 --- a/core/modules/dblog/src/Logger/DbLog.php +++ b/core/modules/dblog/src/Logger/DbLog.php @@ -53,7 +53,8 @@ class DbLog implements LoggerInterface { * {@inheritdoc} */ public function log($level, string|\Stringable $message, array $context = []): void { - // Remove backtrace and exception since they may contain an unserializable variable. + // Remove backtrace and exception since they may contain an unserializable + // variable. unset($context['backtrace'], $context['exception']); // Convert PSR3-style messages to \Drupal\Component\Render\FormattableMarkup diff --git a/core/modules/editor/src/Element.php b/core/modules/editor/src/Element.php index 91739d74a6d..fac8ce6f58a 100644 --- a/core/modules/editor/src/Element.php +++ b/core/modules/editor/src/Element.php @@ -55,7 +55,8 @@ class Element implements TrustedCallbackInterface { } $format_ids = array_keys($element['format']['format']['#options']); - // Early-return if no text editor is associated with any of the text formats. + // Early-return if no text editor is associated with any of the text + // formats. $editors = Editor::loadMultiple($format_ids); foreach ($editors as $key => $editor) { $definition = $this->pluginManager->getDefinition($editor->getEditor()); @@ -87,8 +88,9 @@ class Element implements TrustedCallbackInterface { $element['format']['format']['#attributes']['data-editor-for'] = $field_id; } - // Hide the text format's filters' guidelines of those text formats that have - // a text editor associated: they're rather useless when using a text editor. + // Hide the text format's filters' guidelines of those text formats that + // have a text editor associated: they're rather useless when using a text + // editor. foreach ($editors as $format_id => $editor) { $element['format']['guidelines'][$format_id]['#access'] = FALSE; } @@ -111,9 +113,10 @@ class Element implements TrustedCallbackInterface { $element['value']['#value'] = $filtered; } - // Only when the user has access to multiple text formats, we must add data- - // attributes for the original value and change tracking, because they are - // only necessary when the end user can switch between text formats/editors. + // Only when the user has access to multiple text formats, we must add + // data- attributes for the original value and change tracking, because + // they are only necessary when the end user can switch between text + // formats/editors. if ($element['format']['format']['#access']) { $element['value']['#attributes']['data-editor-value-is-changed'] = 'false'; $element['value']['#attributes']['data-editor-value-original'] = $original; diff --git a/core/modules/editor/src/Hook/EditorHooks.php b/core/modules/editor/src/Hook/EditorHooks.php index 32c6e75161d..cf1127aa187 100644 --- a/core/modules/editor/src/Hook/EditorHooks.php +++ b/core/modules/editor/src/Hook/EditorHooks.php @@ -276,26 +276,27 @@ class EditorHooks { if (!$file) { return NULL; } - // Temporary files are handled by file_file_download(), so nothing to do here - // about them. + // Temporary files are handled by file_file_download(), so nothing to do + // here about them. // @see file_file_download() // Find out if any editor-backed field contains the file. $usage_list = \Drupal::service('file.usage')->listUsage($file); // Stop processing if there are no references in order to avoid returning // headers for files controlled by other modules. Make an exception for - // temporary files where the host entity has not yet been saved (for example, - // an image preview on a node creation form) in which case, allow download by - // the file's owner. + // temporary files where the host entity has not yet been saved (for + // example, an image preview on a node creation form) in which case, allow + // download by the file's owner. if (empty($usage_list['editor']) && ($file->isPermanent() || $file->getOwnerId() != \Drupal::currentUser()->id())) { return NULL; } - // Editor.module MUST NOT call $file->access() here (like file_file_download() - // does) as checking the 'download' access to a file entity would end up in - // FileAccessControlHandler->checkAccess() and ->getFileReferences(), which - // calls file_get_file_references(). This latter one would allow downloading - // files only handled by the file.module, which is exactly not the case right - // here. So instead we must check if the current user is allowed to view any - // of the entities that reference the image using the 'editor' module. + // Editor.module MUST NOT call $file->access() here (like + // file_file_download() does) as checking the 'download' access to a file + // entity would end up in FileAccessControlHandler->checkAccess() and + // ->getFileReferences(), which calls file_get_file_references(). This + // latter one would allow downloading files only handled by the file.module, + // which is exactly not the case right here. So instead we must check if the + // current user is allowed to view any of the entities that reference the + // image using the 'editor' module. if ($file->isPermanent()) { $referencing_entity_is_accessible = FALSE; $references = empty($usage_list['editor']) ? [] : $usage_list['editor']; diff --git a/core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php b/core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php index 312b89f1e11..5dff58ea9be 100644 --- a/core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php +++ b/core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php @@ -65,7 +65,8 @@ class StandardTest extends UnitTestCase { $data[] = ['<p>Hello, world!</p><unknown>Pink Fairy Armadillo</unknown><script>alert("evil");</script>', '<p>Hello, world!</p><unknown>Pink Fairy Armadillo</unknown>alert("evil");']; $data[] = ['<p>Hello, world!</p><unknown>Pink Fairy Armadillo</unknown><a href="javascript:alert(1)">test</a>', '<p>Hello, world!</p><unknown>Pink Fairy Armadillo</unknown><a href="alert(1)">test</a>']; - // All cases listed on https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet + // All cases listed on + // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet // No Filter Evasion. // @see https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#No_Filter_Evasion @@ -473,7 +474,8 @@ xss:ex/*XSS*//*/*/pression(alert("XSS"))\'>', // @see https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#XML_data_island_with_CDATA_obfuscation $data[] = ['<XML ID="xss"><I><B><IMG SRC="javas<!-- -->cript:alert(\'XSS\')"></B></I></XML><SPAN DATASRC="#xss" DATAFLD="B" DATAFORMATAS="HTML"></SPAN>', '<XML id="xss"><I><B><IMG>cript:alert(\'XSS\')"></B></I></XML><SPAN datasrc="#xss" datafld="B" dataformatas="HTML"></SPAN>']; - // Locally hosted XML with embedded JavaScript that is generated using an XML data island. + // Locally hosted XML with embedded JavaScript that is generated using an + // XML data island. // @see https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Locally_hosted_XML_with_embedded_JavaScript_that_is_generated_using_an_XML_data_island // This one is irrelevant for Drupal; Drupal disallows XML uploads by // default. @@ -482,7 +484,8 @@ xss:ex/*XSS*//*/*/pression(alert("XSS"))\'>', // @see https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#HTML.2BTIME_in_XML $data[] = ['<?xml:namespace prefix="t" ns="urn:schemas-microsoft-com:time"><?import namespace="t" implementation="#default#time2"><t:set attributeName="innerHTML" to="XSS<SCRIPT DEFER>alert("XSS")</SCRIPT>">', '<?xml:namespace prefix="t" ns="urn:schemas-microsoft-com:time"><?import namespace="t" implementation="#default#time2"><t set attributename="innerHTML">alert("XSS")">']; - // Assuming you can only fit in a few characters and it filters against ".js". + // Assuming you can only fit in a few characters and it filters against + // ".js". // @see https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Assuming_you_can_only_fit_in_a_few_characters_and_it_filters_against_.22.js.22 $data[] = ['<SCRIPT SRC="http://ha.ckers.org/xss.jpg"></SCRIPT>', '']; diff --git a/core/modules/field/src/Hook/FieldHooks.php b/core/modules/field/src/Hook/FieldHooks.php index a3399124ffd..b1c32d55528 100644 --- a/core/modules/field/src/Hook/FieldHooks.php +++ b/core/modules/field/src/Hook/FieldHooks.php @@ -219,8 +219,8 @@ class FieldHooks { // function actually just marks the data and fields as deleted, leaving the // garbage collection for a separate process, because it is not always // possible to delete this much data in a single page request (particularly - // since for some field types, the deletion is more than just a simple DELETE - // query). + // since for some field types, the deletion is more than just a simple + // DELETE query). foreach ($fields as $field) { $field->delete(); } @@ -258,9 +258,9 @@ class FieldHooks { public function configImportStepsAlter(&$sync_steps, ConfigImporter $config_importer): void { $field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge($config_importer->getStorageComparer()->getSourceStorage()->read('core.extension'), $config_importer->getStorageComparer()->getChangelist('delete')); if ($field_storages) { - // Add a step to the beginning of the configuration synchronization process - // to purge field data where the module that provides the field is being - // uninstalled. + // Add a step to the beginning of the configuration synchronization + // process to purge field data where the module that provides the field is + // being uninstalled. array_unshift($sync_steps, ['\Drupal\field\ConfigImporterFieldPurger', 'process']); } } diff --git a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php index eaa94b00d51..16321397808 100644 --- a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php +++ b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php @@ -261,7 +261,8 @@ class NumberFieldTest extends BrowserTestBase { $this->assertSession()->elementNotExists('xpath', '//div[@content="' . $valid_entry . '"]'); } - // Test for the content attribute when a Prefix is displayed. Presumably this also tests for the attribute when a Suffix is displayed. + // Test for the content attribute when a Prefix is displayed. Presumably + // this also tests for the attribute when a Suffix is displayed. $display_repository->getViewDisplay('entity_test', 'entity_test') ->setComponent($field_name, [ 'type' => 'number_integer', diff --git a/core/modules/field/tests/src/Kernel/BulkDeleteTest.php b/core/modules/field/tests/src/Kernel/BulkDeleteTest.php index 5ed14a4af81..8e306221519 100644 --- a/core/modules/field/tests/src/Kernel/BulkDeleteTest.php +++ b/core/modules/field/tests/src/Kernel/BulkDeleteTest.php @@ -357,8 +357,8 @@ class BulkDeleteTest extends FieldKernelTestBase { } // Check hooks invocations. - // FieldItemInterface::delete() should have been called once for each entity in the - // bundle. + // FieldItemInterface::delete() should have been called once for each entity + // in the bundle. $actual_hooks = FieldTestHelper::memorize(); $hooks = []; $hooks['field_test_field_delete'] = $this->entitiesByBundles[$bundle]; diff --git a/core/modules/field/tests/src/Kernel/DisplayApiTest.php b/core/modules/field/tests/src/Kernel/DisplayApiTest.php index fb4e446cfa2..83906f4fa60 100644 --- a/core/modules/field/tests/src/Kernel/DisplayApiTest.php +++ b/core/modules/field/tests/src/Kernel/DisplayApiTest.php @@ -296,7 +296,8 @@ class DisplayApiTest extends FieldKernelTestBase { * Tests that the prepareView() formatter method still fires for empty values. */ public function testFieldEmpty(): void { - // Uses \Drupal\field_test\Plugin\Field\FieldFormatter\TestFieldEmptyFormatter. + // Uses + // \Drupal\field_test\Plugin\Field\FieldFormatter\TestFieldEmptyFormatter. $display = [ 'label' => 'hidden', 'type' => 'field_empty_test', diff --git a/core/modules/field/tests/src/Kernel/DisplayModeUpdateTest.php b/core/modules/field/tests/src/Kernel/DisplayModeUpdateTest.php index 473b24ac8ae..942137b4206 100644 --- a/core/modules/field/tests/src/Kernel/DisplayModeUpdateTest.php +++ b/core/modules/field/tests/src/Kernel/DisplayModeUpdateTest.php @@ -112,7 +112,8 @@ class DisplayModeUpdateTest extends FieldKernelTestBase { */ public function testDisplayModeUpdateAfterFieldCreation(): void { - // Sanity test: field has not been created yet, so should not exist in display. + // Sanity test: field has not been created yet, so should not exist in + // display. $this->assertArrayNotHasKey('field_test', \Drupal::config($this->defaultViewDisplayName)->get('hidden')); $this->assertArrayNotHasKey('field_test', \Drupal::config($this->defaultFormDisplayName)->get('hidden')); $this->assertArrayNotHasKey('field_test', \Drupal::config($this->foobarViewDisplayName)->get('hidden')); diff --git a/core/modules/field/tests/src/Kernel/EntityReference/Views/EntityReferenceRelationshipTest.php b/core/modules/field/tests/src/Kernel/EntityReference/Views/EntityReferenceRelationshipTest.php index fa28b718173..52e4c6b4cfc 100644 --- a/core/modules/field/tests/src/Kernel/EntityReference/Views/EntityReferenceRelationshipTest.php +++ b/core/modules/field/tests/src/Kernel/EntityReference/Views/EntityReferenceRelationshipTest.php @@ -80,7 +80,8 @@ class EntityReferenceRelationshipTest extends ViewsKernelTestBase { // @see \Drupal\Core\Entity\Sql\DefaultTableMapping::generateFieldTableName() $this->createEntityReferenceField('entity_test_mul_changed', 'entity_test_mul_changed', 'field_test_data_with_a_long_name', 'field_test_data_with_a_long_name', 'entity_test'); - // Create reference from entity_test_mul to entity_test cardinality: infinite. + // Create reference from entity_test_mul to entity_test cardinality: + // infinite. $this->createEntityReferenceField('entity_test_mul', 'entity_test_mul', 'field_data_test_unlimited', 'field_data_test_unlimited', 'entity_test', 'default', [], FieldStorageConfig::CARDINALITY_UNLIMITED); ViewTestData::createTestViews(static::class, ['entity_reference_test_views']); diff --git a/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php b/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php index fffd2a500ef..175789b83ef 100644 --- a/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php +++ b/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php @@ -373,7 +373,8 @@ class FieldAttachOtherTest extends FieldKernelTestBase { } $this->assertSame($expected_values_2, $entity->{$this->fieldTestData->field_name_2}->getValue(), 'Submit filters empty values'); - // Call EntityFormDisplayInterface::extractFormValues() for a single field (the second field). + // Call EntityFormDisplayInterface::extractFormValues() for a single field + // (the second field). foreach ($display->getComponents() as $name => $options) { if ($name != $this->fieldTestData->field_name_2) { $display->removeComponent($name); diff --git a/core/modules/field_ui/src/Hook/FieldUiHooks.php b/core/modules/field_ui/src/Hook/FieldUiHooks.php index 819a4aacd21..9bc09e0070e 100644 --- a/core/modules/field_ui/src/Hook/FieldUiHooks.php +++ b/core/modules/field_ui/src/Hook/FieldUiHooks.php @@ -86,9 +86,9 @@ class FieldUiHooks { 'empty' => '', ], ], - // Provide a dedicated template for new storage options as their styling - // is quite different from a typical form element, so it works best to not - // include default form element classes. + // Provide a dedicated template for new storage options as their styling + // is quite different from a typical form element, so it works best to not + // include default form element classes. 'form_element__new_storage_type' => [ 'base hook' => 'form_element', 'render element' => 'element', diff --git a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php index dcf86adae11..83d60d38230 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php @@ -125,7 +125,8 @@ class ManageDisplayTest extends BrowserTestBase { ]; // Check that the field is displayed with the default formatter in 'rss' - // mode (uses 'default'), and hidden in 'teaser' mode (uses custom settings). + // mode (uses 'default'), and hidden in 'teaser' mode (uses custom + // settings). $this->assertNodeViewText($node, 'rss', $output['field_test_default'], "The field is displayed as expected in view modes that use 'default' settings."); $this->assertNodeViewNoText($node, 'teaser', $value, "The field is hidden in view modes that use custom settings."); diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsLifecycleTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsLifecycleTest.php index 97f3784c380..5d80b3c28ef 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageFieldsLifecycleTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsLifecycleTest.php @@ -217,7 +217,8 @@ class ManageFieldsLifecycleTest extends ManageFieldsFunctionalTestBase { // Test the cardinality validation is not access sensitive. - // Remove the cardinality limit 4 so we can add a node the user doesn't have access to. + // Remove the cardinality limit 4 so we can add a node the user doesn't have + // access to. $edit = [ 'field_storage[subform][cardinality]' => (string) FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, ]; diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php index 0608df798cc..e6e48ebf7dc 100644 --- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php +++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php @@ -261,7 +261,8 @@ class EntityDisplayTest extends KernelTestBase { ]; $this->assertEquals($expected, $display->getComponent($field_name)); - // Check that the getFormatter() method returns the correct formatter plugin. + // Check that the getFormatter() method returns the correct formatter + // plugin. $formatter = $display->getRenderer($field_name); $this->assertEquals($default_formatter, $formatter->getPluginId()); $this->assertEquals($formatter_settings, $formatter->getSettings()); diff --git a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php index da599930a1c..09b80e476d5 100644 --- a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php +++ b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php @@ -81,7 +81,8 @@ trait FieldUiTestTrait { // Test Breadcrumbs. $this->getSession()->getPage()->findLink($label); - // Ensure that each array key in $storage_edit is prefixed with field_storage. + // Ensure that each array key in $storage_edit is prefixed with + // field_storage. $prefixed_storage_edit = []; foreach ($storage_edit as $key => $value) { if (str_starts_with($key, 'field_storage')) { diff --git a/core/modules/file/file.module b/core/modules/file/file.module index e1c09d98be5..9c10140fa4b 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -318,8 +318,8 @@ function file_managed_file_submit($form, FormStateInterface $form_state) { foreach ($remove_fids as $fid) { // If it's a temporary file we can safely remove it immediately, otherwise - // it's up to the implementing module to remove usages of files to have them - // removed. + // it's up to the implementing module to remove usages of files to have + // them removed. if ($element['#files'][$fid] && $element['#files'][$fid]->isTemporary()) { $element['#files'][$fid]->delete(); } diff --git a/core/modules/file/src/FileViewsData.php b/core/modules/file/src/FileViewsData.php index a5f1934c2ac..a3f7a810fff 100644 --- a/core/modules/file/src/FileViewsData.php +++ b/core/modules/file/src/FileViewsData.php @@ -270,9 +270,9 @@ class FileViewsData extends EntityViewsData { ], ]; - // Provide basic fields from the {file_usage} table to all of the base tables - // we've declared joins to, because there is no 'skip base' property on these - // fields. + // Provide basic fields from the {file_usage} table to all of the base + // tables we've declared joins to, because there is no 'skip base' property + // on these fields. $data['file_usage']['module'] = [ 'title' => $this->t('Module'), 'help' => $this->t('The module managing this file relationship.'), diff --git a/core/modules/file/src/Hook/CronHook.php b/core/modules/file/src/Hook/CronHook.php index fa8d483deb3..fdc12547f5d 100644 --- a/core/modules/file/src/Hook/CronHook.php +++ b/core/modules/file/src/Hook/CronHook.php @@ -36,8 +36,8 @@ class CronHook { public function __invoke(): void { $age = $this->configFactory->get('system.file')->get('temporary_maximum_age'); $fileStorage = $this->entityTypeManager->getStorage('file'); - // Only delete temporary files if older than $age. Note that automatic cleanup - // is disabled if $age set to 0. + // Only delete temporary files if older than $age. Note that automatic + // cleanup is disabled if $age set to 0. if ($age) { $fids = $fileStorage->getQuery()->accessCheck(FALSE)->condition('status', FileInterface::STATUS_PERMANENT, '<>')->condition('changed', $this->time->getRequestTime() - $age, '<')->range(0, 100)->execute(); /** @var \Drupal\file\FileInterface[] $files */ diff --git a/core/modules/file/src/Hook/FileDownloadHook.php b/core/modules/file/src/Hook/FileDownloadHook.php index 5b4687256ea..21086c5eb11 100644 --- a/core/modules/file/src/Hook/FileDownloadHook.php +++ b/core/modules/file/src/Hook/FileDownloadHook.php @@ -35,12 +35,12 @@ class FileDownloadHook { if ($file->isTemporary()) { $usage = $this->fileUsage->listUsage($file); if (empty($usage) && $file->getOwnerId() != $this->currentUser->id()) { - // Deny access to temporary files without usage that are not owned by the - // same user. This prevents the security issue that a private file that - // was protected by field permissions becomes available after its usage - // was removed and before it is actually deleted from the file system. - // Modules that depend on this behavior should make the file permanent - // instead. + // Deny access to temporary files without usage that are not owned by + // the same user. This prevents the security issue that a private file + // that was protected by field permissions becomes available after its + // usage was removed and before it is actually deleted from the file + // system. Modules that depend on this behavior should make the file + // permanent instead. return -1; } } @@ -48,9 +48,9 @@ class FileDownloadHook { $references = file_get_file_references($file, NULL, EntityStorageInterface::FIELD_LOAD_CURRENT, NULL); // Stop processing if there are no references in order to avoid returning // headers for files controlled by other modules. Make an exception for - // temporary files where the host entity has not yet been saved (for example, - // an image preview on a node/add form) in which case, allow download by the - // file's owner. + // temporary files where the host entity has not yet been saved (for + // example, an image preview on a node/add form) in which case, allow + // download by the file's owner. if (empty($references) && ($file->isPermanent() || $file->getOwnerId() != $this->currentUser->id())) { return NULL; } diff --git a/core/modules/file/src/Hook/FileHooks.php b/core/modules/file/src/Hook/FileHooks.php index 2a10edc019e..2008a7a27e2 100644 --- a/core/modules/file/src/Hook/FileHooks.php +++ b/core/modules/file/src/Hook/FileHooks.php @@ -65,8 +65,8 @@ class FileHooks { */ #[Hook('field_widget_info_alter')] public function fieldWidgetInfoAlter(array &$info): void { - // Allows using the 'uri' widget for the 'file_uri' field type, which uses it - // as the default widget. + // Allows using the 'uri' widget for the 'file_uri' field type, which uses + // it as the default widget. // @see \Drupal\file\Plugin\Field\FieldType\FileUriItem $info['uri']['field_types'][] = 'file_uri'; } diff --git a/core/modules/file/src/Hook/TokenHooks.php b/core/modules/file/src/Hook/TokenHooks.php index cdb3e6c0818..80de5898260 100644 --- a/core/modules/file/src/Hook/TokenHooks.php +++ b/core/modules/file/src/Hook/TokenHooks.php @@ -79,7 +79,8 @@ class TokenHooks { $bubbleable_metadata->addCacheContexts(['url.site']); break; - // These tokens are default variations on the chained tokens handled below. + // These tokens are default variations on the chained tokens handled + // below. case 'created': $date_format = $dateFormatStorage->load('medium'); $bubbleable_metadata->addCacheableDependency($date_format); diff --git a/core/modules/file/tests/file_test/src/Hook/FileTestHooks.php b/core/modules/file/tests/file_test/src/Hook/FileTestHooks.php index 1e1ed914377..1f274d9ed0a 100644 --- a/core/modules/file/tests/file_test/src/Hook/FileTestHooks.php +++ b/core/modules/file/tests/file_test/src/Hook/FileTestHooks.php @@ -24,8 +24,8 @@ class FileTestHooks { public function fileLoad($files): void { foreach ($files as $file) { FileTestHelper::logCall('load', [$file->id()]); - // Assign a value on the object so that we can test that the $file is passed - // by reference. + // Assign a value on the object so that we can test that the $file is + // passed by reference. $file->file_test['loaded'] = TRUE; } } @@ -115,8 +115,8 @@ class FileTestHooks { } // Clean up Windows paths. $path = str_replace('\\', '/', $path); - // Serve files with one of the CDN extensions from CDN 1, all others from - // CDN 2. + // Serve files with one of the CDN extensions from CDN 1, all others + // from CDN 2. $pathinfo = pathinfo($path); if (array_key_exists('extension', $pathinfo) && in_array($pathinfo['extension'], $cdn_extensions)) { $uri = FileTestCdn::First->value . '/' . $path; @@ -146,8 +146,8 @@ class FileTestHooks { } } elseif ($alter_mode == 'protocol-relative') { - // Only serve shipped files and public created files with protocol-relative - // URLs. + // Only serve shipped files and public created files with + // protocol-relative URLs. $scheme = $stream_wrapper_manager::getScheme($uri); if (!$scheme || $scheme == 'public') { // Shipped files. diff --git a/core/modules/file/tests/src/Functional/DownloadTest.php b/core/modules/file/tests/src/Functional/DownloadTest.php index 83603f7508f..d90ec492487 100644 --- a/core/modules/file/tests/src/Functional/DownloadTest.php +++ b/core/modules/file/tests/src/Functional/DownloadTest.php @@ -53,8 +53,8 @@ class DownloadTest extends FileManagedTestBase { // Test generating a URL to a created file. $file = $this->createFile(); $url = $this->fileUrlGenerator->generateAbsoluteString($file->getFileUri()); - // URLs can't contain characters outside the ASCII set so $filename has to be - // encoded. + // URLs can't contain characters outside the ASCII set so $filename has to + // be encoded. $filename = $GLOBALS['base_url'] . '/' . \Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath() . '/' . rawurlencode($file->getFilename()); $this->assertEquals($filename, $url, 'Correctly generated a URL for a created file.'); $http_client = $this->getHttpClient(); diff --git a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php index d3ea6ae1d1d..895803fbdeb 100644 --- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php @@ -86,7 +86,8 @@ class FileFieldDisplayTest extends FileFieldTestBase { $default_output = \Drupal::service('renderer')->renderRoot($file_link); $this->assertSession()->responseContains($default_output); - // Turn the "display" option off and check that the file is no longer displayed. + // Turn the "display" option off and check that the file is no longer + // displayed. $edit = [$field_name . '[0][display]' => FALSE]; $this->drupalGet('node/' . $nid . '/edit'); $this->submitForm($edit, 'Save'); diff --git a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php index 1b5da30af8e..7830090636c 100644 --- a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php +++ b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php @@ -190,7 +190,8 @@ class SaveUploadFormTest extends FileManagedTestBase { FileTestHelper::reset(); $extensions = 'foo ' . $this->imageExtension; - // Now tell _file_save_upload_from_form() to allow the extension of our test image. + // Now tell _file_save_upload_from_form() to allow the extension of our test + // image. $edit = [ 'file_test_replace' => FileExists::Replace->name, 'files[file_test_upload][]' => $file_system->realpath($this->image->getFileUri()), @@ -570,7 +571,8 @@ class SaveUploadFormTest extends FileManagedTestBase { $this->assertSession()->statusCodeEquals(200); $this->assertSession()->pageTextContains("Epic upload FAIL!"); - // Search for combined error message followed by a formatted list of messages. + // Search for combined error message followed by a formatted list of + // messages. $this->assertSession()->responseContains('One or more files could not be uploaded.<ul>'); } diff --git a/core/modules/file/tests/src/Kernel/SaveTest.php b/core/modules/file/tests/src/Kernel/SaveTest.php index 9c85cbaec01..cd38137f977 100644 --- a/core/modules/file/tests/src/Kernel/SaveTest.php +++ b/core/modules/file/tests/src/Kernel/SaveTest.php @@ -61,8 +61,9 @@ class SaveTest extends FileManagedUnitTestBase { $this->assertEquals($file->isPermanent(), $loaded_file->isPermanent(), 'Status was saved correctly.'); $this->assertEquals('en', $loaded_file->langcode->value, 'Langcode was saved correctly.'); - // Try to insert a second file with the same name apart from case insensitivity - // to ensure the 'uri' index allows for filenames with different cases. + // Try to insert a second file with the same name apart from case + // insensitivity to ensure the 'uri' index allows for filenames with + // different cases. $uppercase_values = [ 'uid' => $account->id(), 'filename' => 'DRUPLICON.txt', diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index ecf07400036..6f2aa3b5284 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -427,7 +427,8 @@ function _filter_url($text, $filter) { $valid_url_query_ending_chars = '[a-zA-Z0-9_&=#\/]'; // Full path - // and allow @ in a URL, but only in the middle. Catch things like http://example.com/@user/ + // and allow @ in a URL, but only in the middle. Catch things like + // http://example.com/@user/ $valid_url_path = '(?:(?:' . $valid_url_path_characters . '*(?:' . $valid_url_balanced_parens . $valid_url_path_characters . '*)*' . $valid_url_ending_characters . ')|(?:@' . $valid_url_path_characters . '+\/))'; // Prepare domain name pattern. @@ -484,8 +485,8 @@ function _filter_url($text, $filter) { if ($chunk_type == 'text') { // Only process this text if there are no unclosed $ignore_tags. if ($open_tag == '') { - // If there is a match, inject a link into this chunk via the callback - // function contained in $task. + // If there is a match, inject a link into this chunk via the + // callback function contained in $task. $chunks[$i] = preg_replace_callback($pattern, $task, $chunks[$i]); } // Text chunk is done, so next chunk must be a tag. @@ -703,7 +704,8 @@ function _filter_autop($text) { $chunk = preg_replace("|<p>(<li.+?)</p>|", "$1", $chunk); $chunk = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $chunk); $chunk = str_replace('</blockquote></p>', '</p></blockquote>', $chunk); - // Under certain strange conditions it could create a P of entirely whitespace + // Under certain strange conditions it could create a P of entirely + // whitespace $chunk = preg_replace('|<p>\s*</p>\n?|', '', $chunk); $chunk = preg_replace('!<p>\s*(</?' . $block . '[^>]*>)!', "$1", $chunk); $chunk = preg_replace('!(</?' . $block . '[^>]*>)\s*</p>!', "$1", $chunk); diff --git a/core/modules/filter/src/Entity/FilterFormat.php b/core/modules/filter/src/Entity/FilterFormat.php index a11dc438621..12e7846163b 100644 --- a/core/modules/filter/src/Entity/FilterFormat.php +++ b/core/modules/filter/src/Entity/FilterFormat.php @@ -322,8 +322,8 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface, En return $new_restrictions; } // Subsequent filters with an "allowed html" setting must be intersected - // with the existing set, to ensure we only end up with the tags that are - // allowed by *all* filters with an "allowed html" setting. + // with the existing set, to ensure we only end up with the tags that + // are allowed by *all* filters with an "allowed html" setting. else { // Track the intersection of allowed tags. if (isset($restrictions['allowed'])) { @@ -334,7 +334,8 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface, En if (!array_key_exists($tag, $new_restrictions['allowed'])) { // The exception is the asterisk (which applies to all tags): it // does not need to be allowed by every filter in order to be - // used; not every filter needs attribute restrictions on all tags. + // used; not every filter needs attribute restrictions on all + // tags. if ($tag === '*') { continue; } diff --git a/core/modules/filter/src/FilterFormatFormBase.php b/core/modules/filter/src/FilterFormatFormBase.php index 7f5d4e242a6..336e49f6406 100644 --- a/core/modules/filter/src/FilterFormatFormBase.php +++ b/core/modules/filter/src/FilterFormatFormBase.php @@ -145,9 +145,9 @@ abstract class FilterFormatFormBase extends EntityForm { '#parents' => ['filters', $name, 'provider'], ]; - // Retrieve the settings form of the filter plugin. The plugin should not be - // aware of the text format. Therefore, it only receives a set of minimal - // base properties to allow advanced implementations to work. + // Retrieve the settings form of the filter plugin. The plugin should not + // be aware of the text format. Therefore, it only receives a set of + // minimal base properties to allow advanced implementations to work. $settings_form = [ '#parents' => ['filters', $name, 'settings'], '#tree' => TRUE, diff --git a/core/modules/filter/src/FilterPermissions.php b/core/modules/filter/src/FilterPermissions.php index fb8984d0b83..3e64fe751a8 100644 --- a/core/modules/filter/src/FilterPermissions.php +++ b/core/modules/filter/src/FilterPermissions.php @@ -46,8 +46,8 @@ class FilterPermissions implements ContainerInjectionInterface { */ public function permissions() { $permissions = []; - // Generate permissions for each text format. Warn the administrator that any - // of them are potentially unsafe. + // Generate permissions for each text format. Warn the administrator that + // any of them are potentially unsafe. /** @var \Drupal\filter\FilterFormatInterface[] $formats */ $formats = $this->entityTypeManager->getStorage('filter_format')->loadByProperties(['status' => TRUE]); uasort($formats, 'Drupal\Core\Config\Entity\ConfigEntityBase::sort'); diff --git a/core/modules/filter/src/Plugin/Filter/FilterCaption.php b/core/modules/filter/src/Plugin/Filter/FilterCaption.php index 1886fb7739e..5a5de11772f 100644 --- a/core/modules/filter/src/Plugin/Filter/FilterCaption.php +++ b/core/modules/filter/src/Plugin/Filter/FilterCaption.php @@ -121,7 +121,8 @@ class FilterCaption extends FilterBase implements ContainerFactoryPluginInterfac ]; $altered_html = \Drupal::service('renderer')->render($filter_caption); - // Load the altered HTML into a new DOMDocument and retrieve the element. + // Load the altered HTML into a new DOMDocument and retrieve the + // element. $updated_nodes = Html::load($altered_html)->getElementsByTagName('body') ->item(0) ->childNodes; diff --git a/core/modules/filter/tests/src/Kernel/FilterAPITest.php b/core/modules/filter/tests/src/Kernel/FilterAPITest.php index a302d60df1a..e5caa5d83e8 100644 --- a/core/modules/filter/tests/src/Kernel/FilterAPITest.php +++ b/core/modules/filter/tests/src/Kernel/FilterAPITest.php @@ -79,9 +79,9 @@ class FilterAPITest extends EntityKernelTestBase { $actual_filtered_text_without_html_generators = check_markup($text, 'filtered_html', '', [FilterInterface::TYPE_MARKUP_LANGUAGE]); $this->assertSame($expected_filter_text_without_html_generators, (string) $actual_filtered_text_without_html_generators, 'Expected filter result when skipping FilterInterface::TYPE_MARKUP_LANGUAGE filters.'); // Related to @see FilterSecurityTest.php/testSkipSecurityFilters(), but - // this check focuses on the ability to filter multiple filter types at once. - // Drupal core only ships with these two types of filters, so this is the - // most extensive test possible. + // this check focuses on the ability to filter multiple filter types at + // once. Drupal core only ships with these two types of filters, so this is + // the most extensive test possible. $actual_filtered_text_without_html_generators = check_markup($text, 'filtered_html', '', [FilterInterface::TYPE_HTML_RESTRICTOR, FilterInterface::TYPE_MARKUP_LANGUAGE]); $this->assertSame($expected_filter_text_without_html_generators, (string) $actual_filtered_text_without_html_generators, 'Expected filter result when skipping FilterInterface::TYPE_MARKUP_LANGUAGE filters, even when trying to disable filters of the FilterInterface::TYPE_HTML_RESTRICTOR type.'); } @@ -159,7 +159,8 @@ class FilterAPITest extends EntityKernelTestBase { ); // Test on very_restricted_html, where there's two different filters of the - // FilterInterface::TYPE_HTML_RESTRICTOR type, each restricting in different ways. + // FilterInterface::TYPE_HTML_RESTRICTOR type, each restricting in different + // ways. $very_restricted_html_format = FilterFormat::create([ 'format' => 'very_restricted_html', 'name' => 'Very Restricted HTML', diff --git a/core/modules/help/src/HelpTopicPluginManager.php b/core/modules/help/src/HelpTopicPluginManager.php index 12aef2382e3..28f99d2f1fd 100644 --- a/core/modules/help/src/HelpTopicPluginManager.php +++ b/core/modules/help/src/HelpTopicPluginManager.php @@ -96,8 +96,8 @@ class HelpTopicPluginManager extends DefaultPluginManager implements HelpTopicPl * The app root. */ public function __construct(ModuleHandlerInterface $module_handler, protected ThemeHandlerInterface $themeHandler, CacheBackendInterface $cache_backend, protected string $root) { - // Note that the parent construct is not called because this class does not use - // annotated class discovery. + // Note that the parent construct is not called because this class does not + // use annotated class discovery. $this->moduleHandler = $module_handler; $this->alterInfo('help_topics_info'); $this->setCacheBackend($cache_backend, 'help_topics'); diff --git a/core/modules/help/src/Hook/HelpHooks.php b/core/modules/help/src/Hook/HelpHooks.php index 0e92396aad3..55cb076775b 100644 --- a/core/modules/help/src/Hook/HelpHooks.php +++ b/core/modules/help/src/Hook/HelpHooks.php @@ -34,7 +34,8 @@ class HelpHooks { ':themes' => Url::fromRoute('system.themes_page')->toString(), ':download_themes' => 'https://www.drupal.org/project/themes', ]) . '</li>'; - // Display a link to the create content page if Node module is installed. + // Display a link to the create content page if Node module is + // installed. if (\Drupal::moduleHandler()->moduleExists('node')) { $output .= '<li>' . t('<strong>Start posting content</strong> Finally, you may <a href=":content">add new content</a> to your website.', [':content' => Url::fromRoute('node.add_page')->toString()]) . '</li>'; } @@ -113,8 +114,8 @@ class HelpHooks { */ #[Hook('block_view_help_block_alter')] public function blockViewHelpBlockAlter(array &$build, BlockPluginInterface $block): void { - // Assume that most users do not need or want to perform contextual actions on - // the help block, so don't needlessly draw attention to it. + // Assume that most users do not need or want to perform contextual actions + // on the help block, so don't needlessly draw attention to it. unset($build['#contextual_links']); } diff --git a/core/modules/help/tests/modules/help_page_test/src/Hook/HelpPageTestHooks.php b/core/modules/help/tests/modules/help_page_test/src/Hook/HelpPageTestHooks.php index 8bbfcb51f65..d45575b021c 100644 --- a/core/modules/help/tests/modules/help_page_test/src/Hook/HelpPageTestHooks.php +++ b/core/modules/help/tests/modules/help_page_test/src/Hook/HelpPageTestHooks.php @@ -29,8 +29,8 @@ class HelpPageTestHooks { case 'help_page_test.test_array': return ['#markup' => 'Help text from help_page_test_help module.']; } - // Ensure that hook_help() can return an empty string and not cause the block - // to display. + // Ensure that hook_help() can return an empty string and not cause the + // block to display. return ''; } diff --git a/core/modules/help/tests/modules/help_topics_test/src/Hook/HelpTopicsTestHooks.php b/core/modules/help/tests/modules/help_topics_test/src/Hook/HelpTopicsTestHooks.php index 8ce630ec1b8..f1704f4c408 100644 --- a/core/modules/help/tests/modules/help_topics_test/src/Hook/HelpTopicsTestHooks.php +++ b/core/modules/help/tests/modules/help_topics_test/src/Hook/HelpTopicsTestHooks.php @@ -28,7 +28,8 @@ class HelpTopicsTestHooks { */ #[Hook('help_topics_info_alter')] public function helpTopicsInfoAlter(array &$info): void { - // To prevent false positive search results limit list to testing topis only. + // To prevent false positive search results limit list to testing topis + // only. $filter = fn(string $key) => str_starts_with($key, 'help_topics_test') || in_array($key, ['help_topics_test_direct_yml', 'help_topics_derivatives:test_derived_topic'], TRUE); $info = array_filter($info, $filter, ARRAY_FILTER_USE_KEY); $info['help_topics_test.test']['top_level'] = \Drupal::state()->get('help_topics_test.test:top_level', TRUE); diff --git a/core/modules/image/src/Hook/ImageHooks.php b/core/modules/image/src/Hook/ImageHooks.php index 582ff65fe31..c65fd59d3b6 100644 --- a/core/modules/image/src/Hook/ImageHooks.php +++ b/core/modules/image/src/Hook/ImageHooks.php @@ -82,18 +82,18 @@ class ImageHooks { return [ // Theme functions in image.module. 'image_style' => [ - // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft - // allows the alt attribute to be omitted in some cases. Therefore, - // default the alt attribute to an empty string, but allow code using - // '#theme' => 'image_style' to pass explicit NULL for it to be omitted. - // Usually, neither omission nor an empty string satisfies accessibility - // requirements, so it is strongly encouraged for code using '#theme' => - // 'image_style' to pass a meaningful value for the alt variable. - // - https://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 - // - https://www.w3.org/TR/xhtml1/dtds.html - // - http://dev.w3.org/html5/spec/Overview.html#alt - // The title attribute is optional in all cases, so it is omitted by - // default. + // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft + // allows the alt attribute to be omitted in some cases. Therefore, + // default the alt attribute to an empty string, but allow code using + // '#theme' => 'image_style' to pass explicit NULL for it to be omitted. + // Usually, neither omission nor an empty string satisfies accessibility + // requirements, so it is strongly encouraged for code using '#theme' => + // 'image_style' to pass a meaningful value for the alt variable. + // - https://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8 + // - https://www.w3.org/TR/xhtml1/dtds.html + // - http://dev.w3.org/html5/spec/Overview.html#alt + // The title attribute is optional in all cases, so it is omitted by + // default. 'variables' => [ 'style_name' => NULL, 'uri' => NULL, @@ -193,7 +193,8 @@ class ImageHooks { } // Check the permissions of the original to grant access to this image. $headers = \Drupal::moduleHandler()->invokeAll('file_download', [$original_uri]); - // Confirm there's at least one module granting access and none denying access. + // Confirm there's at least one module granting access and none denying + // access. if (!empty($headers) && !in_array(-1, $headers)) { return [ // Send headers describing the image's size, and MIME-type. @@ -243,8 +244,8 @@ class ImageHooks { */ #[Hook('entity_presave')] public function entityPresave(EntityInterface $entity): void { - // Get the default image settings, return if not saving an image field storage - // or image field entity. + // Get the default image settings, return if not saving an image field + // storage or image field entity. $default_image = []; if (($entity instanceof FieldStorageConfigInterface || $entity instanceof FieldConfigInterface) && $entity->getType() == 'image') { $default_image = $entity->getSetting('default_image'); diff --git a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php index 547f47278b4..2cae36dc6cf 100644 --- a/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php +++ b/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php @@ -420,8 +420,9 @@ class ImageItem extends FileItem { if (!empty($element['x']['#value']) || !empty($element['y']['#value'])) { foreach (['x', 'y'] as $dimension) { if (!$element[$dimension]['#value']) { - // We expect the field name placeholder value to be wrapped in $this->t() - // here, so it won't be escaped again as it's already marked safe. + // We expect the field name placeholder value to be wrapped in + // $this->t() here, so it won't be escaped again as it's already + // marked safe. $form_state->setError($element[$dimension], new TranslatableMarkup('Both a height and width value must be specified in the @name field.', ['@name' => $element['#title']])); return; } diff --git a/core/modules/image/tests/src/Functional/ImageDimensionsTest.php b/core/modules/image/tests/src/Functional/ImageDimensionsTest.php index 8bc6ef46d85..4a7aed1aa17 100644 --- a/core/modules/image/tests/src/Functional/ImageDimensionsTest.php +++ b/core/modules/image/tests/src/Functional/ImageDimensionsTest.php @@ -112,7 +112,8 @@ class ImageDimensionsTest extends BrowserTestBase { $this->assertEquals(60, $image_file->getWidth()); $this->assertEquals(120, $image_file->getHeight()); - // Scale an image that is higher than it is wide (rotated by previous effect). + // Scale an image that is higher than it is wide (rotated by previous + // effect). $effect = [ 'id' => 'image_scale', 'data' => [ diff --git a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php index dd4c2a1f484..efeacd6ff16 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php @@ -446,7 +446,8 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { $this->drupalGet('node/' . $nid); $this->assertSession()->responseContains($default_output); - // Test the image loading "priority" formatter works together with "image_style". + // Test the image loading "priority" formatter works together with + // "image_style". $display_options['settings']['image_style'] = 'thumbnail'; $display->setComponent($field_name, $display_options) ->save(); diff --git a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditor5Test.php b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditor5Test.php index c0b50328ed1..340423c71be 100644 --- a/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditor5Test.php +++ b/core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditor5Test.php @@ -118,7 +118,8 @@ class FormErrorHandlerCKEditor5Test extends WebDriverTestBase { $errors_link->click(); // Check that the CKEditor5-enabled body field is visible in the viewport. - // The hash change adds an ID to the CKEditor 5 instance so check its visibility using the ID now. + // The hash change adds an ID to the CKEditor 5 instance so check its + // visibility using the ID now. $web_assert->assertVisibleInViewport('css', $ckeditor_id, 'topLeft', 'CKEditor5-enabled body field is visible.'); } diff --git a/core/modules/jsonapi/src/Controller/EntityResource.php b/core/modules/jsonapi/src/Controller/EntityResource.php index 523e45422d9..6416d6cb27a 100644 --- a/core/modules/jsonapi/src/Controller/EntityResource.php +++ b/core/modules/jsonapi/src/Controller/EntityResource.php @@ -612,7 +612,8 @@ class EntityResource { if ($response instanceof CacheableResponseInterface) { $response->addCacheableDependency($entity); - // Cacheability from the classes subscribed to CollectRelationshipMetaEvent is added to the response. + // Cacheability from the classes subscribed to + // CollectRelationshipMetaEvent is added to the response. $response->addCacheableDependency($collect_meta_event); } diff --git a/core/modules/jsonapi/src/Hook/JsonapiHooks.php b/core/modules/jsonapi/src/Hook/JsonapiHooks.php index b2f9714c09a..1aecba2edd4 100644 --- a/core/modules/jsonapi/src/Hook/JsonapiHooks.php +++ b/core/modules/jsonapi/src/Hook/JsonapiHooks.php @@ -99,8 +99,8 @@ class JsonapiHooks { public function jsonapiEntityFilterAccess(EntityTypeInterface $entity_type, AccountInterface $account): array { // All core entity types and most or all contrib entity types allow users // with the entity type's administrative permission to view all of the - // entities, so enable similarly permissive filtering to those users as well. - // A contrib module may override this decision by returning + // entities, so enable similarly permissive filtering to those users as + // well. A contrib module may override this decision by returning // AccessResult::forbidden() from its implementation of this hook. if ($admin_permission = $entity_type->getAdminPermission()) { return [ @@ -190,8 +190,8 @@ class JsonapiHooks { JSONAPI_FILTER_AMONG_ALL => $forbidden, JSONAPI_FILTER_AMONG_OWN => $forbidden, JSONAPI_FILTER_AMONG_PUBLISHED => $forbidden, - // For legacy reasons, the Node entity type has a "status" key, so forbid - // this subset as well, even though it has no semantic meaning. + // For legacy reasons, the Node entity type has a "status" key, so + // forbid this subset as well, even though it has no semantic meaning. JSONAPI_FILTER_AMONG_ENABLED => $forbidden, ]; } @@ -200,10 +200,10 @@ class JsonapiHooks { JSONAPI_FILTER_AMONG_OWN => AccessResult::allowedIfHasPermission($account, 'view own unpublished content'), // @see \Drupal\node\NodeGrantDatabaseStorage::access() // Note that: - // - This is just for the default grant. Other node access conditions are - // added via the 'node_access' query tag. - // - Permissions were checked earlier in this function, so we must vary the - // cache by them. + // - This is just for the default grant. Other node access conditions + // are added via the 'node_access' query tag. + // - Permissions were checked earlier in this function, so we must + // vary the cache by them. JSONAPI_FILTER_AMONG_PUBLISHED => AccessResult::allowed()->cachePerPermissions(), ]; } diff --git a/core/modules/jsonapi/src/JsonApiResource/ResourceObject.php b/core/modules/jsonapi/src/JsonApiResource/ResourceObject.php index ba1f62a6e9b..6d4cc6ce55f 100644 --- a/core/modules/jsonapi/src/JsonApiResource/ResourceObject.php +++ b/core/modules/jsonapi/src/JsonApiResource/ResourceObject.php @@ -97,7 +97,8 @@ class ResourceObject implements CacheableDependencyInterface, ResourceIdentifier $this->fields = $fields; $this->links = $links->withContext($this); - // If the specified language empty it falls back the same way as in the entity system + // If the specified language empty it falls back the same way as in the + // entity system // @see \Drupal\Core\Entity\EntityBase::language() $this->language = $language ?: new Language(['id' => LanguageInterface::LANGCODE_NOT_SPECIFIED]); } diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php index 1395209a064..0e9f6c519d4 100644 --- a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php +++ b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php @@ -2038,7 +2038,8 @@ abstract class ResourceTestBase extends BrowserTestBase { if ($this->entity->getEntityType()->hasKey('label')) { $request_options[RequestOptions::BODY] = $parseable_invalid_request_body; - // DX: 422 when invalid entity: multiple values sent for single-value field. + // DX: 422 when invalid entity: multiple values sent for single-value + // field. $response = $this->request('POST', $url, $request_options); $label_field = $this->entity->getEntityType()->getKey('label'); $label_field_capitalized = $this->entity->getFieldDefinition($label_field)->getLabel(); @@ -3542,8 +3543,8 @@ abstract class ResourceTestBase extends BrowserTestBase { $entity_type = $this->entity->getEntityType(); if ($entity_type instanceof ContentEntityTypeInterface && ($field_name = $entity_type->getRevisionMetadataKey('revision_log_message'))) { - // The default entity access control handler assumes that permissions do not - // change during the lifetime of a request and caches access results. + // The default entity access control handler assumes that permissions do + // not change during the lifetime of a request and caches access results. // However, we're changing permissions during a test run and need fresh // results, so reset the cache. \Drupal::entityTypeManager()->getAccessControlHandler($this->entity->getEntityTypeId())->resetCache(); diff --git a/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php b/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php index 6acb4a1cf56..d9cda8df404 100644 --- a/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/EventSubscriber/ResourceObjectNormalizerCacherTest.php @@ -130,7 +130,8 @@ class ResourceObjectNormalizerCacherTest extends KernelTestBase { public function testMaxAgeCorrection(): void { $this->installEntitySchema('entity_test_computed_field'); - // Use EntityTestComputedField since ComputedTestCacheableStringItemList has a max age of 800 + // Use EntityTestComputedField since ComputedTestCacheableStringItemList has + // a max age of 800 $baseMaxAge = 800; $entity = EntityTestComputedField::create([]); $entity->save(); diff --git a/core/modules/language/src/Element/LanguageConfiguration.php b/core/modules/language/src/Element/LanguageConfiguration.php index c7efaa9535b..c0633e30957 100644 --- a/core/modules/language/src/Element/LanguageConfiguration.php +++ b/core/modules/language/src/Element/LanguageConfiguration.php @@ -53,8 +53,8 @@ class LanguageConfiguration extends FormElementBase { // Add the entity type and bundle information to the form if they are set. // They will be used, in the submit handler, to generate the names of the - // configuration entities that will store the settings and are a way to uniquely - // identify the entity. + // configuration entities that will store the settings and are a way to + // uniquely identify the entity. $language = $form_state->get('language') ?: []; $language += [ $element['#name'] => [ diff --git a/core/modules/language/src/Entity/ConfigurableLanguage.php b/core/modules/language/src/Entity/ConfigurableLanguage.php index 9ac8c9a0839..d5656745ad9 100644 --- a/core/modules/language/src/Entity/ConfigurableLanguage.php +++ b/core/modules/language/src/Entity/ConfigurableLanguage.php @@ -156,7 +156,8 @@ class ConfigurableLanguage extends ConfigEntityBase implements ConfigurableLangu $language_manager::rebuildServices(); } if (!$update) { - // Install any available language configuration overrides for the language. + // Install any available language configuration overrides for the + // language. \Drupal::service('language.config_factory_override')->installLanguageOverrides($this->id()); } diff --git a/core/modules/language/src/Form/NegotiationBrowserForm.php b/core/modules/language/src/Form/NegotiationBrowserForm.php index 41dcd6d4ece..b43033a7725 100644 --- a/core/modules/language/src/Form/NegotiationBrowserForm.php +++ b/core/modules/language/src/Form/NegotiationBrowserForm.php @@ -71,9 +71,9 @@ class NegotiationBrowserForm extends ConfigFormBase { $existing_languages[$langcode] = $language->getName(); } - // If we have no languages available, present the list of predefined languages - // only. If we do have already added languages, set up two option groups with - // the list of existing and then predefined languages. + // If we have no languages available, present the list of predefined + // languages only. If we do have already added languages, set up two option + // groups with the list of existing and then predefined languages. if (empty($existing_languages)) { $language_options = $this->languageManager->getStandardLanguageListWithoutConfigured(); } diff --git a/core/modules/language/src/Form/NegotiationUrlForm.php b/core/modules/language/src/Form/NegotiationUrlForm.php index adc2e275454..a1762e1e978 100644 --- a/core/modules/language/src/Form/NegotiationUrlForm.php +++ b/core/modules/language/src/Form/NegotiationUrlForm.php @@ -155,8 +155,8 @@ class NegotiationUrlForm extends ConfigFormBase { $value = $form_state->getValue(['prefix', $langcode]); if ($value === '') { if (!($default_langcode == $langcode) && $form_state->getValue('language_negotiation_url_part') == LanguageNegotiationUrl::CONFIG_PATH_PREFIX) { - // Throw a form error if the prefix is blank for a non-default language, - // although it is required for selected negotiation type. + // Throw a form error if the prefix is blank for a non-default + // language, although it is required for selected negotiation type. $form_state->setErrorByName("prefix][$langcode", $this->t('The prefix may only be left blank for the <a href=":url">selected detection fallback language.</a>', [ ':url' => Url::fromRoute('language.negotiation_selected')->toString(), ])); @@ -181,7 +181,8 @@ class NegotiationUrlForm extends ConfigFormBase { if ($value === '') { if ($form_state->getValue('language_negotiation_url_part') == LanguageNegotiationUrl::CONFIG_DOMAIN) { - // Throw a form error if the domain is blank for a non-default language, + // Throw a form error if the domain is blank for a non-default + // language, // although it is required for selected negotiation type. $form_state->setErrorByName("domain][$langcode", $this->t('The domain may not be left blank for %language.', ['%language' => $language->getName()])); } diff --git a/core/modules/language/src/Hook/LanguageHooks.php b/core/modules/language/src/Hook/LanguageHooks.php index 3a3b51a9aaa..0f68d75dc6e 100644 --- a/core/modules/language/src/Hook/LanguageHooks.php +++ b/core/modules/language/src/Hook/LanguageHooks.php @@ -160,8 +160,8 @@ class LanguageHooks { */ #[Hook('element_info_alter')] public function elementInfoAlter(&$type): void { - // Alter the language_select element so that it will be rendered like a select - // field. + // Alter the language_select element so that it will be rendered like a + // select field. if (isset($type['language_select'])) { if (!isset($type['language_select']['#process'])) { $type['language_select']['#process'] = []; @@ -231,8 +231,8 @@ class LanguageHooks { } if (!in_array('language', $modules)) { if (InstallerKernel::installationAttempted() && ($profile = \Drupal::installProfile())) { - // If the install profile provides its own language.types configuration do - // not overwrite it. + // If the install profile provides its own language.types configuration + // do not overwrite it. $profile_directory = \Drupal::service('extension.list.profile')->getPath($profile); $profile_storages = [ new FileStorage($profile_directory . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY), @@ -245,8 +245,8 @@ class LanguageHooks { } } // Since newly (un)installed modules may change the default settings for - // non-locked language types (e.g. content language), we need to resave the - // language type configuration. + // non-locked language types (e.g. content language), we need to resave + // the language type configuration. /** @var \Drupal\language\LanguageNegotiatorInterface $negotiator */ $negotiator = \Drupal::service('language_negotiator'); $configurable = \Drupal::config('language.types')->get('configurable'); @@ -273,8 +273,9 @@ class LanguageHooks { */ #[Hook('form_alter')] public function formAlter(&$form, FormStateInterface $form_state) : void { - // Content entity forms may have added a langcode field. But content language - // configuration should decide if it should be exposed or not in the forms. + // Content entity forms may have added a langcode field. But content + // language configuration should decide if it should be exposed or not in + // the forms. $form_object = $form_state->getFormObject(); if ($form_object instanceof ContentEntityFormInterface && $form_object->getEntity()->getEntityType()->hasKey('langcode')) { /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */ @@ -302,9 +303,9 @@ class LanguageHooks { */ #[Hook('entity_field_access')] public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { - // Only allow edit access on a langcode field if the entity it is attached to - // is configured to have an alterable language. Also without items we can not - // decide whether or not to allow access. + // Only allow edit access on a langcode field if the entity it is attached + // to is configured to have an alterable language. Also without items we can + // not decide whether or not to allow access. if ($items && $operation == 'edit') { // Check if we are dealing with a langcode field. $langcode_key = $items->getEntity()->getEntityType()->getKey('langcode'); diff --git a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionAcceptLanguageTest.php b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionAcceptLanguageTest.php index d02c9cec4cc..3f29acfc2b6 100644 --- a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionAcceptLanguageTest.php +++ b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionAcceptLanguageTest.php @@ -99,7 +99,8 @@ class LanguageBrowserDetectionAcceptLanguageTest extends BrowserTestBase { $this->assertSession()->responseHeaderEquals('Content-Language', 'fr'); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'UNCACHEABLE (response policy)'); - // Check with browser without language settings - should return fallback language. + // Check with browser without language settings - should return fallback + // language. $this->drupalGet('/system-test/echo/language test', [], ['Accept-Language' => '']); $this->assertSession()->responseHeaderEquals('Content-Language', 'en'); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'UNCACHEABLE (response policy)'); diff --git a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php index 6365f34b01f..49a8671d480 100644 --- a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php @@ -126,10 +126,10 @@ class LanguageUILanguageNegotiationTest extends BrowserTestBase { $file->save(); // Setup the site languages by installing two languages. - // Set the default language in order for the translated string to be registered - // into database when seen by t(). Without doing this, our target string - // is for some reason not found when doing translate search. This might - // be some bug. + // Set the default language in order for the translated string to be + // registered into database when seen by t(). Without doing this, our target + // string is for some reason not found when doing translate search. This + // might be some bug. $default_language = \Drupal::languageManager()->getDefaultLanguage(); ConfigurableLanguage::createFromLangcode($langcode_browser_fallback)->save(); $this->config('system.site')->set('default_langcode', $langcode_browser_fallback)->save(); diff --git a/core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php b/core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php index 4ae5949a71a..1f8175ae903 100644 --- a/core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php +++ b/core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php @@ -192,7 +192,8 @@ class LanguageNegotiationContentEntityTest extends LanguageNegotiationTestBase { $this->assertTrue(isset($options['query'][LanguageNegotiationContentEntity::QUERY_PARAMETER])); $this->assertEquals('en', $options['query'][LanguageNegotiationContentEntity::QUERY_PARAMETER]); - // Case 3a1: via $options['language'] with an additional $options['query'][static::QUERY_PARAMETER]. + // Case 3a1: via $options['language'] with an additional + // $options['query'][static::QUERY_PARAMETER]. $options['language'] = $this->languages['en']; $options['query'][LanguageNegotiationContentEntity::QUERY_PARAMETER] = 'xx'; $this->assertEquals($path, $languageNegotiationContentEntityMock->processOutbound($path, $options, $request, $bubbleableMetadataMock)); diff --git a/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php b/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php index 322ce9fb69b..2529c5fbaec 100644 --- a/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php +++ b/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php @@ -162,8 +162,8 @@ class LayoutBuilderHooks { $replacement = $build[$field_name] ?? []; ExtraFieldBlock::replaceFieldPlaceholder($build, $replacement, $field_name); // After the rendered field in $build has been copied over to the - // ExtraFieldBlock block we must remove it from its original location or - // else it will be rendered twice. + // ExtraFieldBlock block we must remove it from its original location + // or else it will be rendered twice. unset($build[$field_name]); } } @@ -266,7 +266,8 @@ class LayoutBuilderHooks { /** @var \Drupal\block_content\BlockContentInterface $entity */ if ($operation === 'view' || $entity->isReusable() || empty(\Drupal::service('inline_block.usage')->getUsage($entity->id()))) { // If the operation is 'view' or this is reusable block or if this is - // non-reusable that isn't used by this module then don't alter the access. + // non-reusable that isn't used by this module then don't alter the + // access. return AccessResult::neutral(); } if ($account->hasPermission('create and edit custom blocks')) { @@ -347,8 +348,8 @@ class LayoutBuilderHooks { } return $link->getUrl()->getRouteName() !== "entity.entity_view_display.{$entity_type_id}.default"; }); - // Links cannot be removed from an existing breadcrumb object. Create a new - // object but carry over the cacheable metadata. + // Links cannot be removed from an existing breadcrumb object. Create a + // new object but carry over the cacheable metadata. $cacheability = CacheableMetadata::createFromObject($breadcrumb); $breadcrumb = new Breadcrumb(); $breadcrumb->setLinks($links); @@ -363,8 +364,8 @@ class LayoutBuilderHooks { public function entityTranslationCreate(EntityInterface $translation): void { /** @var \Drupal\Core\Entity\FieldableEntityInterface $translation */ if ($translation->hasField(OverridesSectionStorage::FIELD_NAME) && $translation->getFieldDefinition(OverridesSectionStorage::FIELD_NAME)->isTranslatable()) { - // When creating a new translation do not copy untranslated sections because - // per-language layouts are not supported. + // When creating a new translation do not copy untranslated sections + // because per-language layouts are not supported. $translation->set(OverridesSectionStorage::FIELD_NAME, []); } } diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php index c146e6bc955..c0efec280a9 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php @@ -578,8 +578,8 @@ class InlineBlockTest extends InlineBlockTestBase { $this->drupalGet($layout_default_path); // Add a basic block with the body field set. $page->clickLink('Add block'); - // Confirm that, when more than 1 type exists, "Create content block" shows a - // list of block types. + // Confirm that, when more than 1 type exists, "Create content block" shows + // a list of block types. $assert_session->assertWaitOnAjaxRequest(); $assert_session->linkNotExists('Basic block'); $assert_session->linkNotExists('Advanced block'); diff --git a/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php index 5670c143ccb..ee7d89ac6e8 100644 --- a/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php +++ b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php @@ -87,7 +87,8 @@ class LayoutBuilderEntityViewDisplayTest extends SectionListTestBase { $this->sectionList->setOverridable(); $this->assertTrue($this->sectionList->isLayoutBuilderEnabled()); - // Ensure Layout Builder is still enabled after setting Overridable to FALSE. + // Ensure Layout Builder is still enabled after setting Overridable to + // FALSE. $this->sectionList->setOverridable(FALSE); $this->assertTrue($this->sectionList->isLayoutBuilderEnabled()); } diff --git a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php index 805b73c3544..3a045b6f641 100644 --- a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php +++ b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php @@ -159,8 +159,8 @@ class LinkWidget extends WidgetBase { */ public static function validateTitleElement(&$element, FormStateInterface $form_state, $form) { if ($element['uri']['#value'] !== '' && $element['title']['#value'] === '') { - // We expect the field name placeholder value to be wrapped in $this->t() here, - // so it won't be escaped again as it's already marked safe. + // We expect the field name placeholder value to be wrapped in $this->t() + // here, so it won't be escaped again as it's already marked safe. $form_state->setError($element['title'], new TranslatableMarkup('@title field is required if there is @uri input.', ['@title' => $element['title']['#title'], '@uri' => $element['uri']['#title']])); } } @@ -298,8 +298,8 @@ class LinkWidget extends WidgetBase { $element['#element_validate'][] = [static::class, 'validateTitleNoLink']; } - // Exposing the attributes array in the widget is left for alternate and more - // advanced field widgets. + // Exposing the attributes array in the widget is left for alternate and + // more advanced field widgets. $element['attributes'] = [ '#type' => 'value', '#tree' => TRUE, diff --git a/core/modules/link/src/Plugin/migrate/process/FieldLink.php b/core/modules/link/src/Plugin/migrate/process/FieldLink.php index e8dd8f13dfd..7509b8685f4 100644 --- a/core/modules/link/src/Plugin/migrate/process/FieldLink.php +++ b/core/modules/link/src/Plugin/migrate/process/FieldLink.php @@ -101,7 +101,8 @@ class FieldLink extends ProcessPluginBase { if (!preg_match($internal_pattern . $end, $uri)) { $link_domains = '[a-z][a-z0-9-]{1,62}'; - // Starting a parenthesis group with (?: means that it is grouped, but is not captured + // Starting a parenthesis group with (?: means that it is grouped, but + // is not captured $authentication = "(?:(?:(?:[\w\.\-\+!$&'\(\)*\+,;=" . $link_i_chars . "]|%[0-9a-f]{2})+(?::(?:[\w" . $link_i_chars . "\.\-\+%!$&'\(\)*\+,;=]|%[0-9a-f]{2})*)?)?@)"; $domain = '(?:(?:[a-z0-9' . $link_i_chars . ']([a-z0-9' . $link_i_chars . '\-_\[\]])*)(\.(([a-z0-9' . $link_i_chars . '\-_\[\]])+\.)*(' . $link_domains . '|[a-z]{2}))?)'; $ipv4 = '(?:[0-9]{1,3}(\.[0-9]{1,3}){3})'; diff --git a/core/modules/link/tests/src/Functional/LinkFieldTest.php b/core/modules/link/tests/src/Functional/LinkFieldTest.php index 0880a73ed04..23d71d3d1a2 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldTest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -200,7 +200,8 @@ class LinkFieldTest extends BrowserTestBase { 'entity:user/invalid-parameter' => $validation_error_1, ]; - // Test external and internal URLs for 'link_type' = LinkItemInterface::LINK_GENERIC. + // Test external and internal URLs for + // 'link_type' = LinkItemInterface::LINK_GENERIC. $this->assertValidEntries($field_name, $valid_external_entries + $valid_internal_entries); $this->assertInvalidEntries($field_name, $invalid_external_entries + $invalid_internal_entries); diff --git a/core/modules/locale/src/Hook/LocaleHooks.php b/core/modules/locale/src/Hook/LocaleHooks.php index 5a5ef01c43f..545326f4e5e 100644 --- a/core/modules/locale/src/Hook/LocaleHooks.php +++ b/core/modules/locale/src/Hook/LocaleHooks.php @@ -295,7 +295,8 @@ class LocaleHooks { $form['languages'][$langcode]['locale_statistics'] = ['#markup' => t('not applicable')]; } // #type = link doesn't work with #weight on table. - // reset and set it back after locale_statistics to get it at the right end. + // reset and set it back after locale_statistics to get it at the right + // end. $operations = $form['languages'][$langcode]['operations']; unset($form['languages'][$langcode]['operations']); $form['languages'][$langcode]['operations'] = $operations; diff --git a/core/modules/locale/src/LocaleConfigManager.php b/core/modules/locale/src/LocaleConfigManager.php index 85aea647200..a248d2a8c2d 100644 --- a/core/modules/locale/src/LocaleConfigManager.php +++ b/core/modules/locale/src/LocaleConfigManager.php @@ -659,15 +659,17 @@ class LocaleConfigManager { // site language is not English. $default_langcode = $this->languageManager->getDefaultLanguage()->getId(); if ($default_langcode != 'en') { - // Update active configuration copies of all prior shipped configuration if - // they are still English. It is not enough to change configuration shipped - // with the components just installed, because installing a component such - // as views may bring in default configuration from prior components. + // Update active configuration copies of all prior shipped configuration + // if they are still English. It is not enough to change configuration + // shipped with the components just installed, because installing a + // component such as views may bring in default configuration from prior + // components. $names = $this->getComponentNames(); foreach ($names as $name) { $config = $this->configFactory->reset($name)->getEditable($name); // Should only update if still exists in active configuration. If locale - // module is enabled later, then some configuration may not exist anymore. + // module is enabled later, then some configuration may not exist + // anymore. if (!$config->isNew()) { $typed_config = $this->typedConfigManager->createFromNameAndData($config->getName(), $config->getRawData()); $langcode = $config->get('langcode'); diff --git a/core/modules/locale/tests/modules/locale_test/src/Hook/LocaleTestHooks.php b/core/modules/locale/tests/modules/locale_test/src/Hook/LocaleTestHooks.php index 35fb2bc58ff..098dc4cb92f 100644 --- a/core/modules/locale/tests/modules/locale_test/src/Hook/LocaleTestHooks.php +++ b/core/modules/locale/tests/modules/locale_test/src/Hook/LocaleTestHooks.php @@ -25,18 +25,18 @@ class LocaleTestHooks { */ #[Hook('system_info_alter')] public function systemInfoAlter(&$info, Extension $file, $type): void { - // Only modify the system info if required. - // By default the locale_test modules are hidden and have a project specified. - // To test the module detection process by locale_project_list() the - // test modules should mimic a custom module. I.e. be non-hidden. + // Only modify the system info if required. By default the locale_test + // modules are hidden and have a project specified. To test the module + // detection process by locale_project_list() the test modules should mimic + // a custom module. I.e. be non-hidden. if (\Drupal::state()->get('locale.test_system_info_alter')) { if ($file->getName() == 'locale_test' || $file->getName() == 'locale_test_translate') { // Don't hide the module. $info['hidden'] = FALSE; } } - // Alter the name and the core version of the project. This should not affect - // the locale project information. + // Alter the name and the core version of the project. This should not + // affect the locale project information. if (\Drupal::state()->get('locale.test_system_info_alter_name_core')) { if ($file->getName() == 'locale_test') { $info['core'] = '8.6.7'; @@ -67,8 +67,8 @@ class LocaleTestHooks { unset($projects['drupal']); } if (\Drupal::state()->get('locale.test_projects_alter')) { - // Instead of the default ftp.drupal.org we use the file system of the test - // instance to simulate a remote file location. + // Instead of the default ftp.drupal.org we use the file system of the + // test instance to simulate a remote file location. $url = Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString(); $remote_url = $url . PublicStream::basePath() . '/remote/'; // Completely replace the project data with a set of test projects. diff --git a/core/modules/locale/tests/modules/locale_test_translate/src/Hook/LocaleTestTranslateHooks.php b/core/modules/locale/tests/modules/locale_test_translate/src/Hook/LocaleTestTranslateHooks.php index 0a969379657..692d85b77a5 100644 --- a/core/modules/locale/tests/modules/locale_test_translate/src/Hook/LocaleTestTranslateHooks.php +++ b/core/modules/locale/tests/modules/locale_test_translate/src/Hook/LocaleTestTranslateHooks.php @@ -35,8 +35,8 @@ class LocaleTestTranslateHooks { #[Hook('modules_installed')] public function modulesInstalled($modules, $is_syncing): void { // Ensure that writing to configuration during install does not cause - // \Drupal\locale\LocaleConfigSubscriber to create incorrect translations due - // the configuration langcode and data being out-of-sync. + // \Drupal\locale\LocaleConfigSubscriber to create incorrect translations + // due the configuration langcode and data being out-of-sync. \Drupal::configFactory()->getEditable('locale_test_translate.settings')->set('key_set_during_install', TRUE)->save(); } diff --git a/core/modules/media/src/Hook/MediaHooks.php b/core/modules/media/src/Hook/MediaHooks.php index 0745eb8e5b5..25e9383e81c 100644 --- a/core/modules/media/src/Hook/MediaHooks.php +++ b/core/modules/media/src/Hook/MediaHooks.php @@ -292,8 +292,8 @@ class MediaHooks { */ #[Hook('field_type_category_info_alter')] public function fieldTypeCategoryInfoAlter(&$definitions): void { - // The `media` field type belongs in the `general` category, so the libraries - // need to be attached using an alter hook. + // The `media` field type belongs in the `general` category, so the + // libraries need to be attached using an alter hook. $definitions[FieldTypeCategoryManagerInterface::FALLBACK_CATEGORY]['libraries'][] = 'media/drupal.media-icon'; } diff --git a/core/modules/media_library/src/Hook/MediaLibraryHooks.php b/core/modules/media_library/src/Hook/MediaLibraryHooks.php index dd46212e861..248cdcc30a4 100644 --- a/core/modules/media_library/src/Hook/MediaLibraryHooks.php +++ b/core/modules/media_library/src/Hook/MediaLibraryHooks.php @@ -161,10 +161,10 @@ class MediaLibraryHooks { $query = MediaLibraryState::fromRequest($view->getRequest())->all(); } catch (\InvalidArgumentException $e) { - // MediaLibraryState::fromRequest() will throw an exception if the view - // is being previewed, since not all required query parameters will be - // present. In a preview, however, this can be omitted since we're - // merely previewing. + // MediaLibraryState::fromRequest() will throw an exception if the + // view is being previewed, since not all required query parameters + // will be present. In a preview, however, this can be omitted since + // we're merely previewing. // @todo Use the views API for checking for the preview mode when it // lands. https://www.drupal.org/project/drupal/issues/3060855 if (empty($view->preview) && empty($view->live_preview)) { diff --git a/core/modules/menu_link_content/src/Hook/MenuLinkContentHooks.php b/core/modules/menu_link_content/src/Hook/MenuLinkContentHooks.php index 67d2311e28f..d79542bca19 100644 --- a/core/modules/menu_link_content/src/Hook/MenuLinkContentHooks.php +++ b/core/modules/menu_link_content/src/Hook/MenuLinkContentHooks.php @@ -101,8 +101,8 @@ class MenuLinkContentHooks { $entity_type_id = $entity->getEntityTypeId(); foreach ($entity->uriRelationships() as $rel) { $url = $entity->toUrl($rel); - // Entities can provide uri relationships that are not routed, in this case - // getRouteParameters() will throw an exception. + // Entities can provide uri relationships that are not routed, in this + // case getRouteParameters() will throw an exception. if (!$url->isRouted()) { continue; } diff --git a/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentCacheabilityBubblingTest.php b/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentCacheabilityBubblingTest.php index 7bfd96a34ae..0079b83ad19 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentCacheabilityBubblingTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentCacheabilityBubblingTest.php @@ -91,7 +91,8 @@ class MenuLinkContentCacheabilityBubblingTest extends KernelTestBase { // cacheability metadata of the same type is working (two links with cache // tags). $test_cases = [ - // \Drupal\Core\RouteProcessor\RouteProcessorCurrent: 'route' cache context. + // \Drupal\Core\RouteProcessor\RouteProcessorCurrent: 'route' cache + // context. [ 'uri' => 'route:<current>', 'cacheability' => (new BubbleableMetadata())->setCacheContexts(['route']), diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module index 39fcdd4f468..2976cad4dc8 100644 --- a/core/modules/menu_ui/menu_ui.module +++ b/core/modules/menu_ui/menu_ui.module @@ -159,8 +159,8 @@ function menu_ui_form_node_form_submit($form, FormStateInterface $form_state) { if (empty(trim($values['title']))) { $values['title'] = $node->label(); } - // Decompose the selected menu parent option into 'menu_name' and 'parent', - // if the form used the default parent selection widget. + // 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'])) { [$menu_name, $parent] = explode(':', $values['menu_parent'], 2); $values['menu_name'] = $menu_name; diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php index 9b4561f4da0..2350bbf8ddd 100644 --- a/core/modules/menu_ui/src/MenuForm.php +++ b/core/modules/menu_ui/src/MenuForm.php @@ -234,7 +234,8 @@ class MenuForm extends EntityForm { // Use a dedicated menu tree access check manipulator as users editing // this form, granted with 'administer menu' permission, should be able to // access menu links with inaccessible routes. The default menu tree - // manipulator only allows the access to menu links with accessible routes. + // manipulator only allows the access to menu links with accessible + // routes. // @see \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators::checkAccess() // @see \Drupal\menu_ui\Menu\MenuUiMenuTreeManipulators::checkAccess() ['callable' => 'menu_ui.menu_tree_manipulators:checkAccess'], @@ -340,7 +341,8 @@ class MenuForm extends EntityForm { $form['links'][$id]['#attributes']['class'][] = 'menu-link-content--pending-revision'; } - // TableDrag: Sort the table row according to its existing/configured weight. + // TableDrag: Sort the table row according to its existing/configured + // weight. $form['links'][$id]['#weight'] = $element['#item']->link->getWeight(); // Add special classes to be used for tabledrag.js. diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php index 86391f0569c..69b11f376d0 100644 --- a/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php @@ -274,7 +274,8 @@ class MenuUiNodeTest extends BrowserTestBase { $child_item->save(); // Edit the first node. $this->drupalGet('node/' . $node->id() . '/edit'); - // Assert that it is not possible to set the parent of the first node to itself or the second node. + // Assert that it is not possible to set the parent of the first node to + // itself or the second node. $this->assertSession()->optionNotExists('edit-menu-menu-parent', 'tools:' . $item->getPluginId()); $this->assertSession()->optionNotExists('edit-menu-menu-parent', 'tools:' . $child_item->getPluginId()); // Assert that disallowed Administration menu is not available in options. @@ -357,14 +358,16 @@ class MenuUiNodeTest extends BrowserTestBase { $this->drupalGet('node/' . $node->id(), ['language' => $languages[$langcodes[1]]]); $this->assertSession()->linkExists($translated_node_title); - // Revisit the edit page in original language, check the loaded menu item title and save. + // Revisit the edit page in original language, check the loaded menu item + // title and save. $options = ['language' => $languages[$langcodes[0]]]; $url = $node->toUrl('edit-form', $options); $this->drupalGet($url); $this->assertSession()->fieldValueEquals('edit-menu-title', $node_title); $this->submitForm([], 'Save (this translation)'); - // Revisit the edit page of the translation and check the loaded menu item title. + // Revisit the edit page of the translation and check the loaded menu item + // title. $options = ['language' => $languages[$langcodes[1]]]; $url = $node->toUrl('edit-form', $options); $this->drupalGet($url); diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php index 231d1b83fe3..e00e8af7476 100644 --- a/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -325,8 +325,8 @@ class MigrateExecutable implements MigrateExecutableInterface { // Announce that rollback is about to happen. $this->getEventDispatcher()->dispatch(new MigrateRollbackEvent($this->migration), MigrateEvents::PRE_ROLLBACK); - // Optimistically assume things are going to work out; if not, $return will be - // updated to some other status. + // Optimistically assume things are going to work out; if not, $return will + // be updated to some other status. $return = MigrationInterface::RESULT_COMPLETED; $this->migration->setStatus(MigrationInterface::STATUS_ROLLING_BACK); @@ -556,8 +556,8 @@ class MigrateExecutable implements MigrateExecutableInterface { ); $usage = $this->attemptMemoryReclaim(); $pct_memory = $usage / $this->memoryLimit; - // Use a lower threshold - we don't want to be in a situation where we keep - // coming back here and trimming a tiny amount + // Use a lower threshold - we don't want to be in a situation where we + // keep coming back here and trimming a tiny amount if ($pct_memory > (0.90 * $threshold)) { $this->message->display( $this->t( diff --git a/core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php b/core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php index fec7cafce2b..e64bdf78fd2 100644 --- a/core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php +++ b/core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php @@ -90,7 +90,8 @@ class AnnotatedClassDiscoveryAutomatedProviders extends AnnotatedClassDiscovery if ($fileinfo->getExtension() == 'php') { if ($cached = $this->fileCache->get($fileinfo->getPathName())) { if (isset($cached['id'])) { - // Explicitly unserialize this to create a new object instance. + // Explicitly unserialize this to create a new object + // instance. $definitions[$cached['id']] = unserialize($cached['content']); } continue; diff --git a/core/modules/migrate/src/Plugin/migrate/process/UrlEncode.php b/core/modules/migrate/src/Plugin/migrate/process/UrlEncode.php index e216ebea70b..0bb7086371d 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/UrlEncode.php +++ b/core/modules/migrate/src/Plugin/migrate/process/UrlEncode.php @@ -47,7 +47,8 @@ class UrlEncode extends ProcessPluginBase { if (in_array($parsed_url_key, $url_parts_to_encode)) { // urlencode() would convert spaces to + signs. $urlencoded_parsed_url_value = rawurlencode($parsed_url_value); - // Restore special characters depending on which part of the URL this is. + // Restore special characters depending on which part of the URL this + // is. switch ($parsed_url_key) { case 'query': $urlencoded_parsed_url_value = str_replace('%26', '&', $urlencoded_parsed_url_value); diff --git a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php index 2b7840ec9f3..05123fe9b78 100644 --- a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php +++ b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php @@ -265,13 +265,13 @@ abstract class SqlBase extends SourcePluginBase implements ContainerFactoryPlugi // The rules for determining what conditions to add to the query are as // follows (applying first applicable rule): // 1. If the map is joinable, join it. We will want to accept all rows - // which are either not in the map, or marked in the map as NEEDS_UPDATE. - // Note that if high water fields are in play, we want to accept all rows - // above the high water mark in addition to those selected by the map - // conditions, so we need to OR them together (but AND with any existing - // conditions in the query). So, ultimately the SQL condition will look - // like (original conditions) AND (map IS NULL OR map needs update - // OR above high water). + // which are either not in the map, or marked in the map as + // NEEDS_UPDATE. Note that if high water fields are in play, we want to + // accept all rows above the high water mark in addition to those + // selected by the map conditions, so we need to OR them together (but + // AND with any existing conditions in the query). So, ultimately the + // SQL condition will look like (original conditions) AND (map IS NULL + // OR map needs update OR above high water). $conditions = $this->query->orConditionGroup(); $condition_added = FALSE; $added_fields = []; diff --git a/core/modules/migrate/tests/src/Kernel/MigrateBundleTest.php b/core/modules/migrate/tests/src/Kernel/MigrateBundleTest.php index f8854f8f55d..1c132ec834d 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateBundleTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateBundleTest.php @@ -100,7 +100,8 @@ class MigrateBundleTest extends MigrateTestBase { $term_migration = \Drupal::service('plugin.manager.migration')->createStubMigration($definition); - // Import and validate the term entities were created with the correct bundle. + // Import and validate the term entities were created with the correct + // bundle. $term_executable = new MigrateExecutable($term_migration, $this); $term_executable->import(); /** @var \Drupal\taxonomy\Entity\Term $term */ @@ -142,7 +143,8 @@ class MigrateBundleTest extends MigrateTestBase { $term_migration = \Drupal::service('plugin.manager.migration')->createStubMigration($definition); - // Import and validate the term entities were created with the correct bundle. + // Import and validate the term entities were created with the correct + // bundle. $term_executable = new MigrateExecutable($term_migration, $this); $term_executable->import(); /** @var \Drupal\taxonomy\Entity\Term $term */ diff --git a/core/modules/migrate_drupal/src/Hook/MigrateDrupalHooks.php b/core/modules/migrate_drupal/src/Hook/MigrateDrupalHooks.php index c52ab7b3f35..aa4d7e7718d 100644 --- a/core/modules/migrate_drupal/src/Hook/MigrateDrupalHooks.php +++ b/core/modules/migrate_drupal/src/Hook/MigrateDrupalHooks.php @@ -89,9 +89,9 @@ class MigrateDrupalHooks { } } catch (RequirementsException $e) { - // This code currently runs whenever the definitions are being loaded and - // if you have a Drupal 7 source site then the requirements will not be - // met for the d6_taxonomy_vocabulary migration. + // This code currently runs whenever the definitions are being loaded + // and if you have a Drupal 7 source site then the requirements will not + // be met for the d6_taxonomy_vocabulary migration. } catch (DatabaseExceptionWrapper $e) { // When the definitions are loaded it is possible the tables will not @@ -119,8 +119,8 @@ class MigrateDrupalHooks { } } // If this is a complete node migration then for all migrations, except the - // classic node migrations, replace any dependency on a classic node migration - // with a dependency on the complete node migration. + // classic node migrations, replace any dependency on a classic node + // migration with a dependency on the complete node migration. if (NodeMigrateType::getNodeMigrateType($connection, $version ?? FALSE) === NodeMigrateType::NODE_MIGRATE_TYPE_COMPLETE) { $classic_migration_match = '/d([67])_(node|node_translation|node_revision|node_entity_translation)($|:.*)/'; $replace_with_complete_migration = function (&$value, $key, $classic_migration_match) { diff --git a/core/modules/mysql/src/Driver/Database/mysql/Connection.php b/core/modules/mysql/src/Driver/Database/mysql/Connection.php index bd4fb0ba3cc..bc4a360d4ae 100644 --- a/core/modules/mysql/src/Driver/Database/mysql/Connection.php +++ b/core/modules/mysql/src/Driver/Database/mysql/Connection.php @@ -119,13 +119,15 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn ]; $connection_options['pdo'] += [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, - // So we don't have to mess around with cursors and unbuffered queries by default. + // So we don't have to mess around with cursors and unbuffered queries by + // default. \PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE, // Make sure MySQL returns all matched rows on update queries including // rows that actually didn't have to be updated because the values didn't // change. This matches common behavior among other database systems. \PDO::MYSQL_ATTR_FOUND_ROWS => TRUE, - // Because MySQL's prepared statements skip the query cache, because it's dumb. + // Because MySQL's prepared statements skip the query cache, because it's + // dumb. \PDO::ATTR_EMULATE_PREPARES => TRUE, // Limit SQL to a single statement like mysqli. \PDO::MYSQL_ATTR_MULTI_STATEMENTS => FALSE, diff --git a/core/modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php b/core/modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php index a2a5814db96..66d781b5eb9 100644 --- a/core/modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php +++ b/core/modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php @@ -76,7 +76,8 @@ class DbDumpCommandTest extends DriverSpecificKernelTestBase { $this->assertStringNotContainsString("'path' => 'test", $output, 'Insert path field not found'); $this->assertStringNotContainsString("'pattern_outline' => 'test", $output, 'Insert pattern_outline field not found'); - // Assert that insert statement doesn't exist for wildcard schema only match. + // Assert that insert statement doesn't exist for wildcard schema only + // match. $command_tester->execute(['--schema-only' => 'route.*']); $output = $command_tester->getDisplay(); $this->assertStringContainsString("createTable('router", $output, 'Table router found'); diff --git a/core/modules/navigation/src/Hook/NavigationHooks.php b/core/modules/navigation/src/Hook/NavigationHooks.php index 995f0683e1a..024c1607dd5 100644 --- a/core/modules/navigation/src/Hook/NavigationHooks.php +++ b/core/modules/navigation/src/Hook/NavigationHooks.php @@ -74,10 +74,10 @@ class NavigationHooks { $navigation_renderer->buildTopBar($page_top); return; } - // But if in layout mode, add an empty element to leave space. We need to use - // an empty .admin-toolbar element because the css uses the adjacent sibling - // selector. The actual rendering of the navigation blocks/layout occurs in - // the layout form. + // But if in layout mode, add an empty element to leave space. We need to + // use an empty .admin-toolbar element because the css uses the adjacent + // sibling selector. The actual rendering of the navigation blocks/layout + // occurs in the layout form. $page_top['navigation'] = [ '#type' => 'html_tag', '#tag' => 'aside', diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index 9d1e3d5231f..9823a2cdac7 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -156,8 +156,8 @@ function hook_node_access_records(NodeInterface $node): array { // treated just like any other node and we completely ignore it. if ($node->private->value) { // Only published Catalan translations of private nodes should be viewable - // to all users. If we fail to check $node->isPublished(), all users would be able - // to view an unpublished node. + // to all users. If we fail to check $node->isPublished(), all users would + // be able to view an unpublished node. if ($node->isPublished()) { $grants[] = [ 'realm' => 'example', @@ -379,16 +379,16 @@ function hook_ranking(): array { $data += [ 'vote_average' => [ 'title' => t('Average vote'), - // Note that we use i.sid, the search index's search item id, rather than - // n.nid. + // Note that we use i.sid, the search index's search item id, rather + // than n.nid. 'join' => [ 'type' => 'LEFT', 'table' => 'vote_node_data', 'alias' => 'vote_node_data', 'on' => 'vote_node_data.nid = i.sid', ], - // The highest possible score should be 1, and the lowest possible score, - // always 0, should be 0. + // The highest possible score should be 1, and the lowest possible + // score, always 0, should be 0. 'score' => 'vote_node_data.average / CAST(%f AS DECIMAL)', // Pass in the highest possible voting score as a decimal argument. 'arguments' => [\Drupal::config('vote.settings')->get('score_max')], diff --git a/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php b/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php index 98728b367f7..f8d81facf91 100644 --- a/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php +++ b/core/modules/node/src/EventSubscriber/NodeTranslationExceptionSubscriber.php @@ -96,8 +96,8 @@ class NodeTranslationExceptionSubscriber implements EventSubscriberInterface { $route_name = $previous_exception->getRouteName(); $parameters = $previous_exception->getRawParameters(); if ($route_name === 'entity.node.canonical' && isset($parameters['node'])) { - // If the node_translation_redirect state is not set, we don't need to check - // for a redirection. + // If the node_translation_redirect state is not set, we don't need to + // check for a redirection. if (!$this->state->get('node_translation_redirect')) { return; } diff --git a/core/modules/node/src/Hook/NodeHooks1.php b/core/modules/node/src/Hook/NodeHooks1.php index 9dd35b02282..a2f032c75c8 100644 --- a/core/modules/node/src/Hook/NodeHooks1.php +++ b/core/modules/node/src/Hook/NodeHooks1.php @@ -220,12 +220,12 @@ class NodeHooks1 { ], 'sticky' => [ 'title' => t('Content is sticky at top of lists'), - // The sticky flag is either 0 or 1, which is automatically normalized. + // The sticky flag is either 0 or 1, which is automatically normalized. 'score' => 'n.sticky', ], 'promote' => [ 'title' => t('Content is promoted to the front page'), - // The promote flag is either 0 or 1, which is automatically normalized. + // The promote flag is either 0 or 1, which is automatically normalized. 'score' => 'n.promote', ], ]; @@ -234,7 +234,7 @@ class NodeHooks1 { if ($node_min_max = \Drupal::state()->get('node.min_max_update_time')) { $ranking['recent'] = [ 'title' => t('Recently created'), - // Exponential decay with half life of 14% of the age range of nodes. + // Exponential decay with half life of 14% of the age range of nodes. 'score' => 'EXP(-5 * (1 - (n.created - :node_oldest) / :node_range))', 'arguments' => [ ':node_oldest' => $node_min_max['min_created'], @@ -473,8 +473,8 @@ class NodeHooks1 { */ #[Hook('modules_installed')] public function modulesInstalled(array $modules): void { - // Check if any of the newly enabled modules require the node_access table to - // be rebuilt. + // Check if any of the newly enabled modules require the node_access table + // to be rebuilt. if (!node_access_needs_rebuild() && \Drupal::moduleHandler()->hasImplementations('node_grants', $modules)) { node_access_needs_rebuild(TRUE); } @@ -490,9 +490,9 @@ class NodeHooks1 { foreach ($modules as $module) { // At this point, the module is already disabled, but its code is still // loaded in memory. Module functions must no longer be called. We only - // check whether a hook implementation function exists and do not invoke it. - // Node access also needs to be rebuilt if language module is disabled to - // remove any language-specific grants. + // check whether a hook implementation function exists and do not invoke + // it. Node access also needs to be rebuilt if language module is disabled + // to remove any language-specific grants. if (!node_access_needs_rebuild() && (\Drupal::moduleHandler()->hasImplementations('node_grants', $module) || $module == 'language')) { node_access_needs_rebuild(TRUE); } diff --git a/core/modules/node/src/NodeAccessControlHandler.php b/core/modules/node/src/NodeAccessControlHandler.php index 13020cea47b..963ab53ded4 100644 --- a/core/modules/node/src/NodeAccessControlHandler.php +++ b/core/modules/node/src/NodeAccessControlHandler.php @@ -273,7 +273,8 @@ class NodeAccessControlHandler extends EntityAccessControlHandler implements Nod $grants = $this->moduleHandler->invokeAll('node_access_records', [$node]); // Let modules alter the grants. $this->moduleHandler->alter('node_access_records', $grants, $node); - // If no grants are set and the node is published, then use the default grant. + // If no grants are set and the node is published, then use the default + // grant. if (empty($grants) && $node->isPublished()) { $grants[] = ['realm' => 'all', 'gid' => 0, 'grant_view' => 1, 'grant_update' => 0, 'grant_delete' => 0]; } diff --git a/core/modules/node/src/NodeViewsData.php b/core/modules/node/src/NodeViewsData.php index 2f3a8372775..9c7d549bd1f 100644 --- a/core/modules/node/src/NodeViewsData.php +++ b/core/modules/node/src/NodeViewsData.php @@ -250,8 +250,8 @@ class NodeViewsData extends EntityViewsData { ], ]; - // Define the base group of this table. Fields that don't have a group defined - // will go into this field by default. + // Define the base group of this table. Fields that don't have a group + // defined will go into this field by default. $data['node_access']['table']['group'] = $this->t('Content access'); // For other base tables, explain how we join. diff --git a/core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php b/core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php index a89e94f92e3..4a02045ba2c 100644 --- a/core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php +++ b/core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php @@ -27,8 +27,8 @@ class NodeSelection extends DefaultSelection { // Adding the 'node_access' tag is sadly insufficient for nodes: core // requires us to also know about the concept of 'published' and // 'unpublished'. We need to do that as long as there are no access control - // modules in use on the site. As long as one access control module is there, - // it is supposed to handle this check. + // modules in use on the site. As long as one access control module is + // there, it is supposed to handle this check. if (!$this->currentUser->hasPermission('bypass node access') && !$this->moduleHandler->hasImplementations('node_grants')) { $query->condition('status', NodeInterface::PUBLISHED); } diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php index c6173d76487..544a796666d 100644 --- a/core/modules/node/src/Plugin/Search/NodeSearch.php +++ b/core/modules/node/src/Plugin/Search/NodeSearch.php @@ -443,7 +443,8 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter foreach ($ranking as $rank => $values) { if (isset($this->configuration['rankings'][$rank]) && !empty($this->configuration['rankings'][$rank])) { $node_rank = $this->configuration['rankings'][$rank]; - // If the table defined in the ranking isn't already joined, then add it. + // If the table defined in the ranking isn't already joined, then add + // it. if (isset($values['join']) && !isset($tables[$values['join']['alias']])) { $query->addJoin($values['join']['type'], $values['join']['table'], $values['join']['alias'], $values['join']['on']); } diff --git a/core/modules/node/tests/modules/node_test/src/Hook/NodeTestHooks.php b/core/modules/node/tests/modules/node_test/src/Hook/NodeTestHooks.php index 5e56d092acb..1887bc56ea6 100644 --- a/core/modules/node/tests/modules/node_test/src/Hook/NodeTestHooks.php +++ b/core/modules/node/tests/modules/node_test/src/Hook/NodeTestHooks.php @@ -105,7 +105,8 @@ class NodeTestHooks { public function nodeAccessRecordsAlter(&$grants, NodeInterface $node): void { if (!empty($grants)) { foreach ($grants as $key => $grant) { - // Alter grant from test_page_realm to test_alter_realm and modify the gid. + // Alter grant from test_page_realm to test_alter_realm and modify the + // gid. if ($grant['realm'] == 'test_page_realm' && $node->isPromoted()) { $grants[$key]['realm'] = 'test_alter_realm'; $grants[$key]['gid'] = 2; diff --git a/core/modules/node/tests/src/Functional/NodeCreationTest.php b/core/modules/node/tests/src/Functional/NodeCreationTest.php index cafed715e7d..ed151d7cd88 100644 --- a/core/modules/node/tests/src/Functional/NodeCreationTest.php +++ b/core/modules/node/tests/src/Functional/NodeCreationTest.php @@ -105,7 +105,8 @@ class NodeCreationTest extends NodeTestBase { $this->assertSession()->pageTextContains($node->getOwner()->getAccountName()); $this->assertSession()->pageTextContains($this->container->get('date.formatter')->format($node->getCreatedTime())); - // Check if the node revision checkbox is not rendered on node creation form. + // Check if the node revision checkbox is not rendered on node creation + // form. $admin_user = $this->drupalCreateUser([ 'administer nodes', 'create page content', diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php index 933769be78f..bc8cfa927e4 100644 --- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php +++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php @@ -101,7 +101,8 @@ class NodeEditFormTest extends NodeTestBase { // Stay on the current page, without reloading. $this->submitForm($edit, 'Save'); - // Check that the title and body fields are displayed with the updated values. + // Check that the title and body fields are displayed with the updated + // values. $this->assertSession()->pageTextContains($edit[$title_key]); $this->assertSession()->pageTextContains($edit[$body_key]); diff --git a/core/modules/node/tests/src/Functional/NodeSaveTest.php b/core/modules/node/tests/src/Functional/NodeSaveTest.php index cc842b7187f..a46f75408aa 100644 --- a/core/modules/node/tests/src/Functional/NodeSaveTest.php +++ b/core/modules/node/tests/src/Functional/NodeSaveTest.php @@ -36,7 +36,8 @@ class NodeSaveTest extends NodeTestBase { protected function setUp(): void { parent::setUp(); - // Create a user that is allowed to post; we'll use this to test the submission. + // Create a user that is allowed to post; we'll use this to test the + // submission. $web_user = $this->drupalCreateUser(['create article content']); $this->drupalLogin($web_user); $this->webUser = $web_user; diff --git a/core/modules/node/tests/src/Functional/NodeTypeInitialLanguageTest.php b/core/modules/node/tests/src/Functional/NodeTypeInitialLanguageTest.php index 31d3470d3fd..5e00a80fc03 100644 --- a/core/modules/node/tests/src/Functional/NodeTypeInitialLanguageTest.php +++ b/core/modules/node/tests/src/Functional/NodeTypeInitialLanguageTest.php @@ -51,7 +51,8 @@ class NodeTypeInitialLanguageTest extends NodeTestBase { $this->assertTrue($this->assertSession()->optionExists('edit-language-configuration-langcode', LanguageInterface::LANGCODE_SITE_DEFAULT)->isSelected()); $this->assertSession()->checkboxNotChecked('edit-language-configuration-language-alterable'); - // Tests if the language field cannot be rearranged on the manage fields tab. + // Tests if the language field cannot be rearranged on the manage fields + // tab. $this->drupalGet('admin/structure/types/manage/article/fields'); $this->assertSession()->elementNotExists('xpath', '//*[@id="field-overview"]/*[@id="language"]'); diff --git a/core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php b/core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php index a8f608d2ab1..31580f03c01 100644 --- a/core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php +++ b/core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php @@ -118,7 +118,8 @@ class NodeTypeTranslationTest extends BrowserTestBase { "translation[config_names][node.type.$type][name]" => $translated_name, ]; - // Edit the title label to avoid having an exception when we save the translation. + // Edit the title label to avoid having an exception when we save the + // translation. $this->drupalGet("admin/structure/types/manage/{$type}/translate/{$langcode}/add"); $this->submitForm($edit, 'Save translation'); @@ -153,7 +154,8 @@ class NodeTypeTranslationTest extends BrowserTestBase { $this->drupalGet("admin/structure/types/manage/{$type}"); $this->submitForm(['title_label' => 'Edited title'], 'Save'); - // Assert that the title label is displayed on the translation form with the right value. + // Assert that the title label is displayed on the translation form with the + // right value. $this->drupalGet("admin/structure/types/manage/$type/translate/$langcode/add"); $this->assertSession()->pageTextContains('Edited title'); diff --git a/core/modules/node/tests/src/Functional/Views/FrontPageTest.php b/core/modules/node/tests/src/Functional/Views/FrontPageTest.php index d6e58a950d4..2791d4ab9cf 100644 --- a/core/modules/node/tests/src/Functional/Views/FrontPageTest.php +++ b/core/modules/node/tests/src/Functional/Views/FrontPageTest.php @@ -62,7 +62,8 @@ class FrontPageTest extends ViewTestBase { $view = Views::getView('frontpage'); - // Tests \Drupal\node\Plugin\views\row\RssPluginBase::calculateDependencies(). + // Tests + // \Drupal\node\Plugin\views\row\RssPluginBase::calculateDependencies(). $expected = [ 'config' => [ 'core.entity_view_mode.node.rss', diff --git a/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php b/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php index 649af1c322b..5d4dbfd659c 100644 --- a/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php +++ b/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php @@ -84,8 +84,8 @@ class StatusExtraTest extends NodeTestBase { $this->assertSession()->pageTextNotContains($node_unpublished2->label()); $this->assertSession()->pageTextNotContains($node_unpublished3->label()); - // The author without the permission to see their own unpublished node should - // just see the published node. + // The author without the permission to see their own unpublished node + // should just see the published node. $this->drupalLogin($node_author_not_unpublished); $this->drupalGet('test_status_extra'); $this->assertSession()->pageTextContains($node_published->label()); diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php index f954fd6b233..65e41cf095a 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php @@ -158,7 +158,8 @@ class MigrateNodeTest extends MigrateNodeTestBase { $node = Node::load(12); $this->assertSame('zu', $manager->getTranslationMetadata($node->getTranslation('en'))->getSource()); - // Node 11 is a translation of node 10, and should not be imported separately. + // Node 11 is a translation of node 10, and should not be imported + // separately. $this->assertNull(Node::load(11), "Node 11 doesn't exist in D8, it was a translation"); // Rerun migration with two source database changes. diff --git a/core/modules/node/tests/src/Kernel/Views/NodeViewsFieldAccessTest.php b/core/modules/node/tests/src/Kernel/Views/NodeViewsFieldAccessTest.php index 8b4b0977fa9..5ef71dbf550 100644 --- a/core/modules/node/tests/src/Kernel/Views/NodeViewsFieldAccessTest.php +++ b/core/modules/node/tests/src/Kernel/Views/NodeViewsFieldAccessTest.php @@ -72,6 +72,7 @@ class NodeViewsFieldAccessTest extends FieldFieldAccessTestBase { $this->assertFieldAccess('node', 'promote', 'On'); $this->assertFieldAccess('node', 'sticky', 'Off'); + // phpcs:ignore Drupal.Files.LineLength // $this->assertFieldAccess('node', 'created', \Drupal::service('date.formatter')->format(123456)); // $this->assertFieldAccess('node', 'changed', \Drupal::service('date.formatter')->format(\Drupal::time()->getRequestTime())); } diff --git a/core/modules/package_manager/tests/src/Kernel/FixtureManipulatorTest.php b/core/modules/package_manager/tests/src/Kernel/FixtureManipulatorTest.php index 566201f9135..6389539adaf 100644 --- a/core/modules/package_manager/tests/src/Kernel/FixtureManipulatorTest.php +++ b/core/modules/package_manager/tests/src/Kernel/FixtureManipulatorTest.php @@ -129,8 +129,8 @@ class FixtureManipulatorTest extends PackageManagerKernelTestBase { catch (\LogicException $e) { $this->assertStringContainsString("Expected package 'my/package' to not be installed, but it was.", $e->getMessage()); } - // Ensure that none of the failed calls to ::addPackage() changed the installed - // packages. + // Ensure that none of the failed calls to ::addPackage() changed the + // installed packages. $this->assertPackageListsEqual($this->originalFixturePackages, $this->inspector->getInstalledPackagesList($this->dir)); $root_info = $this->inspector->getRootPackageInfo($this->dir); $this->assertSame( diff --git a/core/modules/package_manager/tests/src/Kernel/InstalledPackagesListTest.php b/core/modules/package_manager/tests/src/Kernel/InstalledPackagesListTest.php index d0fb6b37827..3da65bdc271 100644 --- a/core/modules/package_manager/tests/src/Kernel/InstalledPackagesListTest.php +++ b/core/modules/package_manager/tests/src/Kernel/InstalledPackagesListTest.php @@ -61,7 +61,8 @@ class InstalledPackagesListTest extends PackageManagerKernelTestBase { ]); $this->assertNull($list->getPackageByDrupalProjectName('example3')); - // The project does not physically exist, which means it must be a metapackage. + // The project does not physically exist, which means it must be a + // metapackage. $list = new InstalledPackagesList([ 'drupal/missing' => InstalledPackage::createFromArray([ 'name' => 'drupal/missing', diff --git a/core/modules/path_alias/src/AliasManager.php b/core/modules/path_alias/src/AliasManager.php index f3b3d4fc5a5..c5ed8fdc2ad 100644 --- a/core/modules/path_alias/src/AliasManager.php +++ b/core/modules/path_alias/src/AliasManager.php @@ -240,8 +240,8 @@ class AliasManager implements AliasManagerInterface { * An optional path for which an alias is being inserted. */ protected function pathAliasPrefixListRebuild($path = NULL) { - // When paths are inserted, only rebuild the prefix list if the path has a top - // level component which is not already in the prefix list. + // When paths are inserted, only rebuild the prefix list if the path has a + // top level component which is not already in the prefix list. if (!empty($path)) { if ($this->pathPrefixes->get(strtok($path, '/'))) { return; diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php b/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php index ae49ae9890b..40b2de75cf0 100644 --- a/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php +++ b/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php @@ -150,7 +150,8 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn // http://bugs.php.net/bug.php?id=53217 // so backslashes in the password need to be doubled up. // The bug was reported against pdo_pgsql 1.0.2, backslashes in passwords - // will break on this doubling up when the bug is fixed, so check the version + // will break on this doubling up when the bug is fixed, so check the + // version // elseif (phpversion('pdo_pgsql') < 'version_this_was_fixed_in') { else { $connection_options['password'] = str_replace('\\', '\\\\', $connection_options['password']); diff --git a/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php b/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php index a17cbe5e274..f58f7563896 100644 --- a/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php +++ b/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php @@ -200,7 +200,8 @@ class ResourceResponseSubscriber implements EventSubscriberInterface { * {@inheritdoc} */ public static function getSubscribedEvents(): array { - // Run before \Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber + // Run before + // \Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber // (priority 7), so that Dynamic Page Cache can cache flattened responses. $events[KernelEvents::RESPONSE][] = ['onResponse', 128]; return $events; diff --git a/core/modules/rest/src/Plugin/views/display/RestExport.php b/core/modules/rest/src/Plugin/views/display/RestExport.php index 8622300e6d7..dcd2a8d0a3f 100644 --- a/core/modules/rest/src/Plugin/views/display/RestExport.php +++ b/core/modules/rest/src/Plugin/views/display/RestExport.php @@ -264,7 +264,8 @@ class RestExport extends PathPluginBase implements ResponseDisplayPluginInterfac $options['defaults']['default']['style'] = FALSE; $options['defaults']['default']['row'] = FALSE; - // Remove css/exposed form settings, as they are not used for the data display. + // Remove css/exposed form settings, as they are not used for the data + // display. unset($options['exposed_form']); unset($options['exposed_block']); unset($options['css_class']); diff --git a/core/modules/rest/tests/modules/config_test_rest/src/Hook/ConfigTestRestHooks.php b/core/modules/rest/tests/modules/config_test_rest/src/Hook/ConfigTestRestHooks.php index 12d2e1a3fae..ab16ed77676 100644 --- a/core/modules/rest/tests/modules/config_test_rest/src/Hook/ConfigTestRestHooks.php +++ b/core/modules/rest/tests/modules/config_test_rest/src/Hook/ConfigTestRestHooks.php @@ -22,8 +22,9 @@ class ConfigTestRestHooks { #[Hook('entity_type_alter')] public function entityTypeAlter(array &$entity_types) : void { // Undo part of what config_test_entity_type_alter() did: remove this - // config_test_no_status entity type, because it uses the same entity class as - // the config_test entity type, which makes REST deserialization impossible. + // config_test_no_status entity type, because it uses the same entity class + // as the config_test entity type, which makes REST deserialization + // impossible. unset($entity_types['config_test_no_status']); } @@ -32,9 +33,9 @@ class ConfigTestRestHooks { */ #[Hook('config_test_access')] public function configTestAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { - // Add permission, so that EntityResourceTestBase's scenarios can test access - // being denied. By default, all access is always allowed for the config_test - // config entity. + // Add permission, so that EntityResourceTestBase's scenarios can test + // access being denied. By default, all access is always allowed for the + // config_test config entity. $access_result = AccessResult::forbiddenIf(!$account->hasPermission('view config_test'))->cachePerPermissions(); if (!$access_result->isAllowed() && $access_result instanceof AccessResultReasonInterface) { $access_result->setReason("The 'view config_test' permission is required."); diff --git a/core/modules/search/src/Plugin/views/argument/Search.php b/core/modules/search/src/Plugin/views/argument/Search.php index 9a47b172a00..c28dba3cf1c 100644 --- a/core/modules/search/src/Plugin/views/argument/Search.php +++ b/core/modules/search/src/Plugin/views/argument/Search.php @@ -87,7 +87,8 @@ class Search extends ArgumentPluginBase { $search_condition = $this->view->query->getConnection()->condition('AND'); - // Create a new join to relate the 'search_total' table to our current 'search_index' table. + // Create a new join to relate the 'search_total' table to our current + // 'search_index' table. $definition = [ 'table' => 'search_total', 'field' => 'word', diff --git a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php index d354fc4570c..d6ca9ced6ed 100644 --- a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php +++ b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php @@ -91,7 +91,8 @@ class SearchConfigSettingsFormTest extends BrowserTestBase { */ public function testSearchSettingsPage(): void { - // Test that the settings form displays the correct count of items left to index. + // Test that the settings form displays the correct count of items left to + // index. $this->drupalGet('admin/config/search/pages'); $this->assertSession()->pageTextContains('There are 0 items left to index.'); diff --git a/core/modules/search/tests/src/Functional/SearchExactTest.php b/core/modules/search/tests/src/Functional/SearchExactTest.php index 33b6b8a72ef..ab330bba5e5 100644 --- a/core/modules/search/tests/src/Functional/SearchExactTest.php +++ b/core/modules/search/tests/src/Functional/SearchExactTest.php @@ -66,14 +66,16 @@ class SearchExactTest extends BrowserTestBase { $this->assertSession()->linkByHrefExists('page=3', 0, '4th page link is found for keyword search.'); $this->assertSession()->linkByHrefNotExists('page=4', '5th page link is not found for keyword search.'); - // Test that the correct number of pager links are found for exact phrase search. + // Test that the correct number of pager links are found for exact phrase + // search. $edit = ['keys' => '"love pizza"']; $this->drupalGet('search/node'); $this->submitForm($edit, 'Search'); $this->assertSession()->linkByHrefExists('page=1', 0, '2nd page link is found for exact phrase search.'); $this->assertSession()->linkByHrefNotExists('page=2', '3rd page link is not found for exact phrase search.'); - // Check that with post settings turned on the post information is displayed. + // Check that with post settings turned on the post information is + // displayed. $node_type_config = \Drupal::configFactory()->getEditable('node.type.page'); $node_type_config->set('display_submitted', TRUE); $node_type_config->save(); diff --git a/core/modules/serialization/src/Normalizer/EntityNormalizer.php b/core/modules/serialization/src/Normalizer/EntityNormalizer.php index d20e3b68a63..0bab5e03cce 100644 --- a/core/modules/serialization/src/Normalizer/EntityNormalizer.php +++ b/core/modules/serialization/src/Normalizer/EntityNormalizer.php @@ -42,8 +42,8 @@ class EntityNormalizer extends ComplexDataNormalizer implements DenormalizerInte // The bundle property will be required to denormalize a bundleable // fieldable entity. if ($entity_type_definition->entityClassImplements(FieldableEntityInterface::class)) { - // Extract bundle data to pass into entity creation if the entity type uses - // bundles. + // Extract bundle data to pass into entity creation if the entity type + // uses bundles. if ($entity_type_definition->hasKey('bundle')) { // Get an array containing the bundle only. This also remove the bundle // key from the $data array. diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php index 749cb785916..6fd98597229 100644 --- a/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php +++ b/core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php @@ -58,8 +58,8 @@ class ListNormalizerTest extends UnitTestCase { ->method('getPropertyInstance') ->willReturn($this->typedData); - // Set up a mock container as ItemList() will call for the 'typed_data_manager' - // service. + // Set up a mock container as ItemList() will call for the + // 'typed_data_manager' service. $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') ->onlyMethods(['get']) ->getMock(); diff --git a/core/modules/settings_tray/src/Hook/SettingsTrayHooks.php b/core/modules/settings_tray/src/Hook/SettingsTrayHooks.php index 2f48d05d1fc..014999107c6 100644 --- a/core/modules/settings_tray/src/Hook/SettingsTrayHooks.php +++ b/core/modules/settings_tray/src/Hook/SettingsTrayHooks.php @@ -74,8 +74,8 @@ class SettingsTrayHooks { #[Hook('block_view_alter')] public function blockViewAlter(array &$build): void { if (isset($build['#contextual_links']['block'])) { - // Ensure that contextual links vary by whether the block has config overrides - // or not. + // Ensure that contextual links vary by whether the block has config + // overrides or not. // @see _contextual_links_to_id() $build['#contextual_links']['block']['metadata']['has_overrides'] = _settings_tray_has_block_overrides($build['#block']) ? 1 : 0; } diff --git a/core/modules/settings_tray/tests/src/Functional/SettingsTrayTest.php b/core/modules/settings_tray/tests/src/Functional/SettingsTrayTest.php index c9cc4ffa41e..fa9cd7944ab 100644 --- a/core/modules/settings_tray/tests/src/Functional/SettingsTrayTest.php +++ b/core/modules/settings_tray/tests/src/Functional/SettingsTrayTest.php @@ -53,7 +53,8 @@ class SettingsTrayTest extends BrowserTestBase { $test_block_plugin_ids = [ // Block that explicitly provides an "settings_tray" form class. 'settings_tray_test_class', - // Block that explicitly provides no "settings_tray" form, thus opting out. + // Block that explicitly provides no "settings_tray" form, thus opting + // out. 'settings_tray_test_false', // Block that does nothing explicit for Settings Tray. 'settings_tray_test_none', @@ -102,7 +103,8 @@ class SettingsTrayTest extends BrowserTestBase { // Assert that block has been marked as "editable" and contextual that // should exist does. $web_assert->elementExists('css', $this->getBlockSelector($non_excluded_block) . "[data-drupal-settingstray=\"editable\"]"); - // Assert that each block that has a "forms[settings_tray] = FALSE" annotation: + // Assert that each block that has a "forms[settings_tray] = FALSE" + // annotation: // - is still rendered on the page // - but is not marked as "editable" by settings_tray_preprocess_block() // - and does not have the Settings Tray contextual link. diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php index ef3e977a93c..15b14a771e8 100644 --- a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php +++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayTestBase.php @@ -125,7 +125,8 @@ class SettingsTrayTestBase extends OffCanvasTestBase { $web_assert->elementNotExists('css', '.contextual .trigger.visually-hidden'); // The toolbar edit button should read "Editing". $web_assert->elementContains('css', static::TOOLBAR_EDIT_LINK_SELECTOR, 'Editing'); - // The main canvas element should have the "js-settings-tray-edit-mode" class. + // The main canvas element should have the "js-settings-tray-edit-mode" + // class. $web_assert->elementExists('css', '.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode'); } diff --git a/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php b/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php index 00d27976d90..419eb8cb35d 100644 --- a/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php +++ b/core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php @@ -62,7 +62,8 @@ class ShortcutSetDeleteForm extends EntityDeleteForm { } // Also, if a module implements hook_shortcut_default_set(), it's possible - // that this set is being used as a default set. Add a message about that too. + // that this set is being used as a default set. Add a message about that + // too. if ($this->moduleHandler->hasImplementations('shortcut_default_set')) { $info .= '<p>' . $this->t('If you have chosen this shortcut set as the default for some or all users, they may also be affected by deleting it.') . '</p>'; } diff --git a/core/modules/shortcut/src/Form/SwitchShortcutSet.php b/core/modules/shortcut/src/Form/SwitchShortcutSet.php index df6f09444b2..79853239369 100644 --- a/core/modules/shortcut/src/Form/SwitchShortcutSet.php +++ b/core/modules/shortcut/src/Form/SwitchShortcutSet.php @@ -187,8 +187,8 @@ class SwitchShortcutSet extends FormBase { ':switch-url' => Url::fromRoute('<current>')->toString(), ]; if ($account_is_user) { - // Only administrators can create new shortcut sets, so we know they have - // access to switch back. + // Only administrators can create new shortcut sets, so we know they + // have access to switch back. $this->messenger()->addStatus($this->t('You are now using the new %set_name shortcut set. You can edit it from this page or <a href=":switch-url">switch back to a different one.</a>', $replacements)); } else { diff --git a/core/modules/shortcut/src/Hook/ShortcutHooks.php b/core/modules/shortcut/src/Hook/ShortcutHooks.php index 2d48f552f18..9dd73cb3ce4 100644 --- a/core/modules/shortcut/src/Hook/ShortcutHooks.php +++ b/core/modules/shortcut/src/Hook/ShortcutHooks.php @@ -116,8 +116,9 @@ class ShortcutHooks { */ #[Hook('themes_installed')] public function themesInstalled($theme_list): void { - // Theme settings are not configuration entities and cannot depend on modules - // so to set a module-specific setting, we need to set it with logic. + // Theme settings are not configuration entities and cannot depend on + // modules so to set a module-specific setting, we need to set it with + // logic. if (in_array('claro', $theme_list, TRUE)) { \Drupal::configFactory()->getEditable("claro.settings")->set('third_party_settings.shortcut.module_link', TRUE)->save(TRUE); } diff --git a/core/modules/sqlite/src/Driver/Database/sqlite/Connection.php b/core/modules/sqlite/src/Driver/Database/sqlite/Connection.php index 1dfd88f65df..e949cdd7652 100644 --- a/core/modules/sqlite/src/Driver/Database/sqlite/Connection.php +++ b/core/modules/sqlite/src/Driver/Database/sqlite/Connection.php @@ -169,7 +169,8 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn public function __destruct() { if ($this->tableDropped && !empty($this->attachedDatabases)) { foreach ($this->attachedDatabases as $prefix) { - // Check if the database is now empty, ignore the internal SQLite tables. + // Check if the database is now empty, ignore the internal SQLite + // tables. try { $count = $this->query('SELECT COUNT(*) FROM ' . $prefix . '.sqlite_master WHERE type = :type AND name NOT LIKE :pattern', [':type' => 'table', ':pattern' => 'sqlite_%'])->fetchField(); @@ -246,7 +247,8 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn * SQLite compatibility implementation for the LEAST() SQL function. */ public static function sqlFunctionLeast() { - // Remove all NULL, FALSE and empty strings values but leaves 0 (zero) values. + // Remove all NULL, FALSE and empty strings values but leaves 0 (zero) + // values. $values = FilterArray::removeEmptyStrings(func_get_args()); return count($values) < 1 ? NULL : min($values); diff --git a/core/modules/sqlite/src/Driver/Database/sqlite/Schema.php b/core/modules/sqlite/src/Driver/Database/sqlite/Schema.php index fc14f5107ed..3779e762519 100644 --- a/core/modules/sqlite/src/Driver/Database/sqlite/Schema.php +++ b/core/modules/sqlite/src/Driver/Database/sqlite/Schema.php @@ -323,8 +323,8 @@ class Schema extends DatabaseSchema { // supports adding new fields to a table, in some simple cases. In most // cases, we have to create a new table and copy the data over. if (empty($keys_new) && (empty($specification['not null']) || isset($specification['default']))) { - // When we don't have to create new keys and we are not creating a - // NOT NULL column without a default value, we can use the quicker version. + // When we don't have to create new keys and we are not creating a NOT + // NULL column without a default value, we can use the quicker version. $query = 'ALTER TABLE {' . $table . '} ADD ' . $this->createFieldSql($field, $this->processField($specification)); $this->executeDdlStatement($query); diff --git a/core/modules/sqlite/src/Driver/Database/sqlite/Statement.php b/core/modules/sqlite/src/Driver/Database/sqlite/Statement.php index d7d8daf46ac..5a2d6b82684 100644 --- a/core/modules/sqlite/src/Driver/Database/sqlite/Statement.php +++ b/core/modules/sqlite/src/Driver/Database/sqlite/Statement.php @@ -97,7 +97,8 @@ class Statement extends StatementPrefetchIterator implements StatementInterface // @see http://www.sqlite.org/faq.html#q15 // @see http://www.sqlite.org/rescode.html#schema if (!empty($e->errorInfo[1]) && $e->errorInfo[1] === 17) { - // The schema has changed. SQLite specifies that we must resend the query. + // The schema has changed. SQLite specifies that we must resend the + // query. $return = parent::execute($args, $options); } else { diff --git a/core/modules/system/src/EventSubscriber/SecurityFileUploadEventSubscriber.php b/core/modules/system/src/EventSubscriber/SecurityFileUploadEventSubscriber.php index f7736c9ee44..737b9a7a53e 100644 --- a/core/modules/system/src/EventSubscriber/SecurityFileUploadEventSubscriber.php +++ b/core/modules/system/src/EventSubscriber/SecurityFileUploadEventSubscriber.php @@ -83,9 +83,9 @@ class SecurityFileUploadEventSubscriber implements EventSubscriberInterface { if (!$insecure_uploads && in_array(strtolower($final_extension), FileSystemInterface::INSECURE_EXTENSIONS, TRUE)) { if (empty($extensions) || in_array('txt', $extensions, TRUE)) { - // Add .txt to potentially executable files prior to munging to help prevent - // exploits. This results in a filenames like filename.php being changed to - // filename.php.txt prior to munging. + // Add .txt to potentially executable files prior to munging to help + // prevent exploits. This results in a filenames like filename.php being + // changed to filename.php.txt prior to munging. $filename_parts[] = $final_extension; $final_extension = 'txt'; } diff --git a/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php index fc0d10a4f0d..90dc9ead38b 100644 --- a/core/modules/system/src/Form/ModulesListForm.php +++ b/core/modules/system/src/Form/ModulesListForm.php @@ -328,7 +328,8 @@ class ModulesListForm extends FormBase { // Disable the checkbox for required modules. if (!empty($module->info['required'])) { - // Used when displaying modules that are required by the installation profile + // Used when displaying modules that are required by the installation + // profile $row['enable']['#disabled'] = TRUE; $row['#required_by'][] = $distribution . (!empty($module->info['explanation']) ? ' (' . $module->info['explanation'] . ')' : ''); } @@ -352,7 +353,8 @@ class ModulesListForm extends FormBase { ]); } - // Ensure this module is compatible with the currently installed version of PHP. + // Ensure this module is compatible with the currently installed version of + // PHP. if (version_compare(phpversion(), $module->info['php']) < 0) { $compatible = FALSE; $required = $module->info['php'] . (substr_count($module->info['php'], '.') < 2 ? '.*' : ''); diff --git a/core/modules/system/src/Form/ThemeSettingsForm.php b/core/modules/system/src/Form/ThemeSettingsForm.php index 58c9ba6fa64..9133eb8aa10 100644 --- a/core/modules/system/src/Form/ThemeSettingsForm.php +++ b/core/modules/system/src/Form/ThemeSettingsForm.php @@ -195,7 +195,8 @@ class ThemeSettingsForm extends ConfigFormBase { foreach ($toggles as $name => $title) { if ((!$theme) || in_array($name, $features)) { $form['theme_settings']['toggle_' . $name] = ['#type' => 'checkbox', '#title' => $title, '#default_value' => theme_get_setting('features.' . $name, $theme)]; - // Disable checkboxes for features not supported in the current configuration. + // Disable checkboxes for features not supported in the current + // configuration. if (isset($disabled['toggle_' . $name])) { $form['theme_settings']['toggle_' . $name]['#disabled'] = TRUE; } @@ -433,8 +434,8 @@ class ThemeSettingsForm extends ConfigFormBase { $form_state->unsetValue('favicon_path'); } - // If the user provided a path for a logo or favicon file, make sure a file - // exists at that path. + // If the user provided a path for a logo or favicon file, make sure a + // file exists at that path. if ($form_state->getValue('logo_path')) { $path = $this->validatePath($form_state->getValue('logo_path')); if (!$path) { @@ -467,8 +468,8 @@ class ThemeSettingsForm extends ConfigFormBase { $values = $form_state->getValues(); - // If the user uploaded a new logo or favicon, save it to a permanent location - // and use it in place of the default theme-provided file. + // If the user uploaded a new logo or favicon, save it to a permanent + // location and use it in place of the default theme-provided file. $default_scheme = $this->config('system.file')->get('default_scheme'); try { if (!empty($values['logo_upload'])) { @@ -494,8 +495,8 @@ class ThemeSettingsForm extends ConfigFormBase { unset($values['logo_upload']); unset($values['favicon_upload']); - // If the user entered a path relative to the system files directory for - // a logo or favicon, store a public:// URI so the theme system can handle it. + // If the user entered a path relative to the system files directory for a + // logo or favicon, store a public:// URI so the theme system can handle it. if (!empty($values['logo_path'])) { $values['logo_path'] = $this->validatePath($values['logo_path']); } diff --git a/core/modules/system/src/Hook/SystemHooks.php b/core/modules/system/src/Hook/SystemHooks.php index fb637c669d8..9147cc327ea 100644 --- a/core/modules/system/src/Hook/SystemHooks.php +++ b/core/modules/system/src/Hook/SystemHooks.php @@ -205,11 +205,12 @@ class SystemHooks { // Generate the values for the core/drupal.ajax library. // We need to send ajaxPageState settings for core/drupal.ajax if: // - ajaxPageState is being loaded in this Response, in which case it will - // already exist at $settings['ajaxPageState'] (because the core/drupal.ajax - // library definition specifies a placeholder 'ajaxPageState' setting). + // already exist at $settings['ajaxPageState'] (because the + // core/drupal.ajax library definition specifies a placeholder + // 'ajaxPageState' setting). // - core/drupal.ajax already has been loaded and hence this is an AJAX - // Response in which we must send the list of extra asset libraries that are - // being added in this AJAX Response. + // Response in which we must send the list of extra asset libraries that + // are being added in this AJAX Response. /** @var \Drupal\Core\Asset\LibraryDependencyResolver $library_dependency_resolver */ $library_dependency_resolver = \Drupal::service('library.dependency_resolver'); if (isset($settings['ajaxPageState']) || in_array('core/drupal.ajax', $library_dependency_resolver->getLibrariesWithDependencies($assets->getAlreadyLoadedLibraries()))) { @@ -229,7 +230,8 @@ class SystemHooks { */ #[Hook('js_settings_alter')] public function jsSettingsAlter(&$settings, AttachedAssetsInterface $assets): void { - // As this is being output in the final response always use the main request. + // As this is being output in the final response always use the main + // request. $request = \Drupal::requestStack()->getMainRequest(); $current_query = $request->query->all(); // Let output path processors set a prefix. @@ -292,7 +294,8 @@ class SystemHooks { */ #[Hook('system_info_alter')] public function systemInfoAlter(&$info, Extension $file, $type): void { - // Remove page-top and page-bottom from the blocks UI since they are reserved for + // Remove page-top and page-bottom from the blocks UI since they are + // reserved for // modules to populate from outside the blocks system. if ($type == 'theme') { $info['regions_hidden'][] = 'page_top'; @@ -457,9 +460,9 @@ class SystemHooks { // To ensure that all the advisory messages are grouped together on // the page, they must all be warnings or all be errors. If any // advisories are not public service announcements, then display all - // the messages as errors because security advisories already tied to - // a specific release are immediately actionable by upgrading to a - // secure version of a project. + // the messages as errors because security advisories already tied + // to a specific release are immediately actionable by upgrading to + // a secure version of a project. $display_as_errors = $display_as_errors ? TRUE : !$advisory->isPsa(); $links[] = new Link($advisory->getTitle(), Url::fromUri($advisory->getUrl())); } diff --git a/core/modules/system/src/Hook/SystemTokensHooks.php b/core/modules/system/src/Hook/SystemTokensHooks.php index 37eae8f9060..ee05509017d 100644 --- a/core/modules/system/src/Hook/SystemTokensHooks.php +++ b/core/modules/system/src/Hook/SystemTokensHooks.php @@ -170,8 +170,8 @@ class SystemTokensHooks { elseif ($type == 'date') { if (empty($data['date'])) { $date = \Drupal::time()->getRequestTime(); - // We depend on the current request time, so the tokens are not cacheable - // at all. + // We depend on the current request time, so the tokens are not + // cacheable at all. $bubbleable_metadata->setCacheMaxAge(0); } else { diff --git a/core/modules/system/system.install b/core/modules/system/system.install index f13f548bec4..8da736101f1 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -870,7 +870,8 @@ function system_requirements($phase): array { else { $error = t('The directory %directory is not writable.', ['%directory' => $directory]); } - // The files directory requirement check is done only during install and runtime. + // The files directory requirement check is done only during install and + // runtime. if ($phase == 'runtime') { $description = t('You may need to set the correct directory at the <a href=":admin-file-system">file system settings page</a> or change the current directory\'s permissions so that it is writable.', [':admin-file-system' => Url::fromRoute('system.file_system_settings')->toString()]); } @@ -992,7 +993,8 @@ function system_requirements($phase): array { $requirements['update access']['title'] = t('Access to update.php'); } - // Display an error if a newly introduced dependency in a module is not resolved. + // Display an error if a newly introduced dependency in a module is not + // resolved. if ($phase === 'update' || $phase === 'runtime') { $create_extension_incompatibility_list = function (array $extension_names, PluralTranslatableMarkup $description, PluralTranslatableMarkup $title, TranslatableMarkup|string $message = '', TranslatableMarkup|string $additional_description = '') { if ($message === '') { diff --git a/core/modules/system/tests/modules/advisory_feed_test/src/AdvisoryTestClientMiddleware.php b/core/modules/system/tests/modules/advisory_feed_test/src/AdvisoryTestClientMiddleware.php index 45c06c4b107..54939c5c5b0 100644 --- a/core/modules/system/tests/modules/advisory_feed_test/src/AdvisoryTestClientMiddleware.php +++ b/core/modules/system/tests/modules/advisory_feed_test/src/AdvisoryTestClientMiddleware.php @@ -22,8 +22,8 @@ class AdvisoryTestClientMiddleware { $test_end_point = \Drupal::state()->get('advisories_test_endpoint'); if ($test_end_point && str_contains((string) $request->getUri(), '://updates.drupal.org/psa.json')) { // Only override $uri if it matches the advisories JSON feed to avoid - // changing any other uses of the 'http_client' service during tests with - // this module installed. + // changing any other uses of the 'http_client' service during tests + // with this module installed. $request = $request->withUri(new Uri($test_end_point)); } return $handler($request, $options); diff --git a/core/modules/system/tests/modules/advisory_feed_test/src/Hook/AdvisoryFeedTestHooks.php b/core/modules/system/tests/modules/advisory_feed_test/src/Hook/AdvisoryFeedTestHooks.php index 3827b3dac7c..227fc29e100 100644 --- a/core/modules/system/tests/modules/advisory_feed_test/src/Hook/AdvisoryFeedTestHooks.php +++ b/core/modules/system/tests/modules/advisory_feed_test/src/Hook/AdvisoryFeedTestHooks.php @@ -17,10 +17,10 @@ class AdvisoryFeedTestHooks { */ #[Hook('system_info_alter')] public function systemInfoAlter(&$info, Extension $file): void { - // Alter the 'generic_module1_test' module to use the 'generic_module1_project' - // project name. This ensures that for an extension where the 'name' and - // the 'project' properties do not match, 'project' is used for matching - // 'project' in the JSON feed. + // Alter the 'generic_module1_test' module to use the + // 'generic_module1_project' project name. This ensures that for an + // extension where the 'name' and the 'project' properties do not match, + // 'project' is used for matching 'project' in the JSON feed. $system_info = [ 'generic_module1_test' => [ 'project' => 'generic_module1_project', diff --git a/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php b/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php index cf509addbcf..a3e65453b04 100644 --- a/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php +++ b/core/modules/system/tests/modules/common_test/src/Hook/CommonTestHooks.php @@ -149,8 +149,8 @@ class CommonTestHooks { */ #[Hook('page_attachments_alter')] public function pageAttachmentsAlter(array &$page): void { - // Remove a library that was added in common_test_page_attachments(), to test - // that this hook can do what it claims to do. + // Remove a library that was added in common_test_page_attachments(), to + // test that this hook can do what it claims to do. if (isset($page['#attached']['library']) && ($index = array_search('core/bar', $page['#attached']['library'])) && $index !== FALSE) { unset($page['#attached']['library'][$index]); } diff --git a/core/modules/system/tests/modules/dependency_version_test/src/Hook/DependencyVersionTestHooks.php b/core/modules/system/tests/modules/dependency_version_test/src/Hook/DependencyVersionTestHooks.php index d0e7773bb67..f2bb524f623 100644 --- a/core/modules/system/tests/modules/dependency_version_test/src/Hook/DependencyVersionTestHooks.php +++ b/core/modules/system/tests/modules/dependency_version_test/src/Hook/DependencyVersionTestHooks.php @@ -17,7 +17,8 @@ class DependencyVersionTestHooks { */ #[Hook('system_info_alter')] public function systemInfoAlter(&$info, Extension $file, $type): void { - // Simulate that the core version for Views module contains the string '8.x'. + // Simulate that the core version for Views module contains the string + // '8.x'. if ($file->getName() == 'views') { $info['version'] = '9.8.x-dev'; } diff --git a/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php b/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php index bc68c2e66a4..68ae20a3f81 100644 --- a/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php +++ b/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php @@ -217,9 +217,9 @@ class EntityTestHooks { public function entityExtraFieldInfo(): array { $extra['entity_test']['bundle_with_extra_fields'] = [ 'display' => [ - // Note: those extra fields do not currently display anything, they are - // just used in \Drupal\Tests\field_ui\Kernel\EntityDisplayTest to test - // the behavior of entity display objects. + // Note: those extra fields do not currently display anything, they are + // just used in \Drupal\Tests\field_ui\Kernel\EntityDisplayTest to test + // the behavior of entity display objects. 'display_extra_field' => [ 'label' => $this->t('Display extra field'), 'description' => $this->t('An extra field on the display side.'), diff --git a/core/modules/system/tests/modules/form_test/src/Callbacks.php b/core/modules/system/tests/modules/form_test/src/Callbacks.php index 1943c9ea811..1077ae518ca 100644 --- a/core/modules/system/tests/modules/form_test/src/Callbacks.php +++ b/core/modules/system/tests/modules/form_test/src/Callbacks.php @@ -35,7 +35,8 @@ class Callbacks { $triggered = TRUE; } elseif ($form_state->has('form_test_name')) { - // To simplify this test, just take over the element's value into $form_state. + // To simplify this test, just take over the element's value into + // $form_state. $form_state->setValueForElement($element, $form_state->get('form_test_name')); $triggered = TRUE; diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxesRadiosForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxesRadiosForm.php index bd1d8e71521..b260d786187 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxesRadiosForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxesRadiosForm.php @@ -26,8 +26,8 @@ class FormTestCheckboxesRadiosForm extends FormBase { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $customize = FALSE) { - // Expand #type checkboxes, setting custom element properties for some but not - // all options. + // Expand #type checkboxes, setting custom element properties for some but + // not all options. $form['checkboxes'] = [ '#type' => 'checkboxes', '#title' => 'Checkboxes', diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestClickedButtonForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestClickedButtonForm.php index 95338fa2403..542c4e162e2 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestClickedButtonForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestClickedButtonForm.php @@ -25,11 +25,11 @@ class FormTestClickedButtonForm extends FormBase { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $first = NULL, $second = NULL, $third = NULL) { - // A single text field. In IE, when a form has only one non-button input field - // and the ENTER key is pressed while that field has focus, the form is - // submitted without any information identifying the button responsible for - // the submission. In other browsers, the form is submitted as though the - // first button were clicked. + // A single text field. In IE, when a form has only one non-button input + // field and the ENTER key is pressed while that field has focus, the form + // is submitted without any information identifying the button responsible + // for the submission. In other browsers, the form is submitted as though + // the first button were clicked. $form['text'] = [ '#title' => 'Text', '#type' => 'textfield', diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php index 30317f64209..7109c954672 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php @@ -49,7 +49,8 @@ class FormTestDisabledElementsForm extends FormBase { ], '#multiple' => TRUE, '#default_value' => ['test_2' => 'test_2'], - // The keys of #test_hijack_value need to match the #name of the control. + // The keys of #test_hijack_value need to match the #name of the + // control. // @see FormsTestCase::testDisabledElements() '#test_hijack_value' => $type == 'select' ? ['' => 'test_1'] : ['test_1' => 'test_1'], '#disabled' => TRUE, diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestFormStateValuesCleanAdvancedForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestFormStateValuesCleanAdvancedForm.php index 156b84f6438..95214419255 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestFormStateValuesCleanAdvancedForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestFormStateValuesCleanAdvancedForm.php @@ -25,7 +25,8 @@ class FormTestFormStateValuesCleanAdvancedForm extends FormBase { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { - // Build an example form containing a managed file and a submit form element. + // Build an example form containing a managed file and a submit form + // element. $form['image'] = [ '#type' => 'managed_file', '#title' => $this->t('Image'), diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php index b554d383822..1754a55f601 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php @@ -103,8 +103,8 @@ class FormTestLimitValidationErrorsForm extends FormBase { * {@inheritdoc} */ public function partialSubmitForm(array &$form, FormStateInterface $form_state) { - // The title has not been validated, thus its value - in case of the test case - // an empty string - may not be set. + // The title has not been validated, thus its value - in case of the test + // case an empty string - may not be set. if (!$form_state->hasValue('title') && $form_state->hasValue('test')) { $this->messenger()->addStatus('Only validated values appear in the form values.'); } diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestRebuildPreserveValuesForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestRebuildPreserveValuesForm.php index ebab3c5a76a..d510237bebb 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestRebuildPreserveValuesForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestRebuildPreserveValuesForm.php @@ -44,10 +44,11 @@ class FormTestRebuildPreserveValuesForm extends FormBase { '#default_value' => 'DEFAULT 1', ], ]; - // Provide an 'add more' button that rebuilds the form with an additional two - // checkboxes and a textfield. The test is to make sure that the rebuild + // Provide an 'add more' button that rebuilds the form with an additional + // two checkboxes and a textfield. The test is to make sure that the rebuild // triggered by this button preserves the user input values for the initial - // elements and initializes the new elements with the correct default values. + // elements and initializes the new elements with the correct default + // values. if (!$form_state->has('add_more')) { $form['add_more'] = [ '#type' => 'submit', diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestStorageForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestStorageForm.php index 65529168921..637399b3638 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestStorageForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestStorageForm.php @@ -91,8 +91,8 @@ class FormTestStorageForm extends FormBase { */ public function validateForm(array &$form, FormStateInterface $form_state) { if ($this->getRequest()->get('cache')) { - // Manually activate caching, so we can test that the storage keeps working - // when it's enabled. + // Manually activate caching, so we can test that the storage keeps + // working when it's enabled. $form_state->setCached(); } } @@ -104,9 +104,9 @@ class FormTestStorageForm extends FormBase { */ public function elementValidateValueCached($element, FormStateInterface $form_state) { // If caching is enabled and we receive a certain value, change the storage. - // This presumes that another submitted form value triggers a validation error - // elsewhere in the form. Form API should still update the cached form storage - // though. + // This presumes that another submitted form value triggers a validation + // error elsewhere in the form. Form API should still update the cached form + // storage though. if ($this->getRequest()->get('cache') && $form_state->getValue('value') == 'change_title') { $form_state->set(['thing', 'changed'], TRUE); } diff --git a/core/modules/system/tests/modules/menu_test/src/Hook/MenuTestHooks.php b/core/modules/system/tests/modules/menu_test/src/Hook/MenuTestHooks.php index 112acb27364..25da8a85066 100644 --- a/core/modules/system/tests/modules/menu_test/src/Hook/MenuTestHooks.php +++ b/core/modules/system/tests/modules/menu_test/src/Hook/MenuTestHooks.php @@ -19,9 +19,9 @@ class MenuTestHooks { */ #[Hook('menu_links_discovered_alter')] public function menuLinksDiscoveredAlter(&$links): void { - // Many of the machine names here are slightly different from the route name. - // Since the machine name is arbitrary, this helps ensure that core does not - // add mistaken assumptions about the correlation. + // Many of the machine names here are slightly different from the route + // name. Since the machine name is arbitrary, this helps ensure that core + // does not add mistaken assumptions about the correlation. $links['menu_test.menu_name_test']['menu_name'] = MenuTestHelper::menuName(); $links['menu_test.context']['title'] = \Drupal::config('menu_test.menu_item')->get('title'); // Adds a custom menu link. diff --git a/core/modules/system/tests/modules/off_canvas_test/src/Hook/OffCanvasTestHooks.php b/core/modules/system/tests/modules/off_canvas_test/src/Hook/OffCanvasTestHooks.php index 4fa7c429ebd..107310ccc3b 100644 --- a/core/modules/system/tests/modules/off_canvas_test/src/Hook/OffCanvasTestHooks.php +++ b/core/modules/system/tests/modules/off_canvas_test/src/Hook/OffCanvasTestHooks.php @@ -16,11 +16,11 @@ class OffCanvasTestHooks { */ #[Hook('page_attachments')] public function pageAttachments(array &$attachments): void { - // This library wraps around the Drupal.offCanvas.resetSize() method and adds - // a special data-resize-done attribute to help functional JavaScript tests - // use the off-canvas area when it is fully loaded and ready to be interacted - // with. - // @see \Drupal\Tests\system\Traits\OffCanvasTestTrait::waitForOffCanvasArea() + // This library wraps around the Drupal.offCanvas.resetSize() method and + // adds a special data-resize-done attribute to help functional JavaScript + // tests use the off-canvas area when it is fully loaded and ready to be + // interacted with. @see + // \Drupal\Tests\system\Traits\OffCanvasTestTrait::waitForOffCanvasArea() $attachments['#attached']['library'][] = 'off_canvas_test/resize_helper'; } diff --git a/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php b/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php index c84cef72f2a..0bd18025888 100644 --- a/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php +++ b/core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php @@ -114,9 +114,9 @@ class SessionTestController extends ControllerBase { public function setMessage() { $this->messenger()->addStatus($this->t('This is a dummy message.')); return new Response((string) $this->t('A message was set.')); - // Do not return anything, so the current request does not result in a themed - // page with messages. The message will be displayed in the following request - // instead. + // Do not return anything, so the current request does not result in a + // themed page with messages. The message will be displayed in the following + // request instead. } /** diff --git a/core/modules/system/tests/modules/system_test/src/Hook/SystemTestHooks.php b/core/modules/system/tests/modules/system_test/src/Hook/SystemTestHooks.php index 0909f0c38e7..62b9b9633a1 100644 --- a/core/modules/system/tests/modules/system_test/src/Hook/SystemTestHooks.php +++ b/core/modules/system/tests/modules/system_test/src/Hook/SystemTestHooks.php @@ -55,8 +55,8 @@ class SystemTestHooks { // Save the config.installer isSyncing() value to state to check that it is // correctly set when installing module during config import. \Drupal::state()->set('system_test_modules_uninstalled_config_installer_syncing', \Drupal::service('config.installer')->isSyncing()); - // Save the $is_syncing parameter value to state to check that it is correctly - // set when installing module during config import. + // Save the $is_syncing parameter value to state to check that it is + // correctly set when installing module during config import. \Drupal::state()->set('system_test_modules_uninstalled_syncing_param', $is_syncing); } @@ -135,8 +135,8 @@ class SystemTestHooks { // Save the config.installer isSyncing() value to state to check that it is // correctly set when installing module during config import. \Drupal::state()->set('system_test_preinstall_module_config_installer_syncing', \Drupal::service('config.installer')->isSyncing()); - // Save the $is_syncing parameter value to state to check that it is correctly - // set when installing module during config import. + // Save the $is_syncing parameter value to state to check that it is + // correctly set when installing module during config import. \Drupal::state()->set('system_test_preinstall_module_syncing_param', $is_syncing); } @@ -149,8 +149,8 @@ class SystemTestHooks { // Save the config.installer isSyncing() value to state to check that it is // correctly set when uninstalling module during config import. \Drupal::state()->set('system_test_preuninstall_module_config_installer_syncing', \Drupal::service('config.installer')->isSyncing()); - // Save the $is_syncing parameter value to state to check that it is correctly - // set when installing module during config import. + // Save the $is_syncing parameter value to state to check that it is + // correctly set when installing module during config import. \Drupal::state()->set('system_test_preuninstall_module_syncing_param', $is_syncing); } diff --git a/core/modules/system/tests/modules/theme_test/src/Hook/ThemeTestHooks.php b/core/modules/system/tests/modules/theme_test/src/Hook/ThemeTestHooks.php index 25578bb0124..f0669b10614 100644 --- a/core/modules/system/tests/modules/theme_test/src/Hook/ThemeTestHooks.php +++ b/core/modules/system/tests/modules/theme_test/src/Hook/ThemeTestHooks.php @@ -108,9 +108,9 @@ class ThemeTestHooks { #[Hook('library_info_alter')] public function libraryInfoAlter(array &$libraries, string $extension) : void { // Allow test code to simulate library changes in a particular extension by - // setting a state key in the form `theme_test_library_info_alter $extension`, - // whose values is an array containing everything that should be recursively - // merged into the given extension's library definitions. + // setting a state key in the form `theme_test_library_info_alter + // $extension`, whose values is an array containing everything that should + // be recursively merged into the given extension's library definitions. $info = \Drupal::state()->get('theme_test_library_info_alter' . " {$extension}"); if (is_array($info)) { $libraries = NestedArray::mergeDeep($libraries, $info); diff --git a/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php b/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php index ccf0d3c4287..0da5fe1250d 100644 --- a/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php +++ b/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php @@ -132,15 +132,18 @@ class ElementsTableSelectTest extends BrowserTestBase { * Tests the #js_select property. */ public function testAdvancedSelect(): void { - // When #multiple = TRUE a Select all checkbox should be displayed by default. + // When #multiple = TRUE a Select all checkbox should be displayed by + // default. $this->drupalGet('form_test/tableselect/advanced-select/multiple-true-default'); $this->assertSession()->elementExists('xpath', '//th[@class="select-all"]'); - // When #js_select is set to FALSE, a "Select all" checkbox should not be displayed. + // When #js_select is set to FALSE, a "Select all" checkbox should not be + // displayed. $this->drupalGet('form_test/tableselect/advanced-select/multiple-true-no-advanced-select'); $this->assertSession()->elementNotExists('xpath', '//th[@class="select-all"]'); - // A "Select all" checkbox never makes sense when #multiple = FALSE, regardless of the value of #js_select. + // A "Select all" checkbox never makes sense when #multiple = FALSE, + // regardless of the value of #js_select. $this->drupalGet('form_test/tableselect/advanced-select/multiple-false-default'); $this->assertSession()->elementNotExists('xpath', '//th[@class="select-all"]'); diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php index 9675dbfa3fb..6812903dccc 100644 --- a/core/modules/system/tests/src/Functional/Form/FormTest.php +++ b/core/modules/system/tests/src/Functional/Form/FormTest.php @@ -156,7 +156,8 @@ class FormTest extends BrowserTestBase { } } } - // Clear the expected form error messages so they don't appear as exceptions. + // Clear the expected form error messages so they don't appear as + // exceptions. \Drupal::messenger()->deleteAll(); } @@ -752,7 +753,8 @@ class FormTest extends BrowserTestBase { } // Submit the form with no input, as the browser does for disabled elements, - // and fetch the $form_state->getValues() that is passed to the submit handler. + // and fetch the $form_state->getValues() that is passed to the submit + // handler. $this->drupalGet('form-test/disabled-elements'); $this->submitForm([], 'Submit'); $returned_values['normal'] = Json::decode($this->getSession()->getPage()->getContent()); diff --git a/core/modules/system/tests/src/Functional/Form/RebuildTest.php b/core/modules/system/tests/src/Functional/Form/RebuildTest.php index f3f115c959c..6181b1d0f79 100644 --- a/core/modules/system/tests/src/Functional/Form/RebuildTest.php +++ b/core/modules/system/tests/src/Functional/Form/RebuildTest.php @@ -61,7 +61,8 @@ class RebuildTest extends BrowserTestBase { $assert_session->checkboxNotChecked('edit-checkbox-1-default-on'); $assert_session->fieldValueEquals('edit-text-1', 'foo'); - // Verify that newly added elements were initialized with their default values. + // Verify that newly added elements were initialized with their default + // values. $assert_session->checkboxChecked('edit-checkbox-2-default-on'); $assert_session->checkboxNotChecked('edit-checkbox-2-default-off'); $assert_session->fieldValueEquals('edit-text-2', 'DEFAULT 2'); diff --git a/core/modules/system/tests/src/Functional/Menu/MenuAccessTest.php b/core/modules/system/tests/src/Functional/Menu/MenuAccessTest.php index 1ce24316648..5a5d6d77315 100644 --- a/core/modules/system/tests/src/Functional/Menu/MenuAccessTest.php +++ b/core/modules/system/tests/src/Functional/Menu/MenuAccessTest.php @@ -327,10 +327,11 @@ class MenuAccessTest extends BrowserTestBase { Url::fromRoute('menu_test.child_test_param_explicit', ['param' => 'my_default']) ); - // If we try to access a route that takes a parameter but route is not in the - // with that parameter we should always be denied access because the sole - // purpose of \Drupal\system\Controller\SystemController::systemAdminMenuBlockPage - // is to display items in the menu. + // If we try to access a route that takes a parameter but route is not in + // the with that parameter we should always be denied access because the + // sole purpose of + // \Drupal\system\Controller\SystemController::systemAdminMenuBlockPage is + // to display items in the menu. $this->drupalLogin($parentUser); $this->assertMenuItemRoutesAccess( 403, diff --git a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php index b0982f77df7..65c42e3c1b9 100644 --- a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php @@ -60,7 +60,8 @@ class PrepareUninstallTest extends BrowserTestBase { // Create 10 nodes. for ($i = 1; $i <= 5; $i++) { $this->nodes[] = $this->drupalCreateNode(['type' => 'page']); - // These 5 articles are inaccessible to the admin user doing the uninstalling. + // These 5 articles are inaccessible to the admin user doing the + // uninstalling. $this->nodes[] = $this->drupalCreateNode(['type' => 'article', 'uid' => 0, 'private' => TRUE]); } @@ -120,7 +121,8 @@ class PrepareUninstallTest extends BrowserTestBase { // Delete Node data. $this->drupalGet('admin/modules/uninstall/entity/node'); - // Only the 5 pages should be listed as the 5 articles are initially inaccessible. + // Only the 5 pages should be listed as the 5 articles are initially + // inaccessible. foreach ($this->nodes as $node) { if ($node->bundle() === 'page') { $this->assertSession()->pageTextContains($node->label()); diff --git a/core/modules/system/tests/src/Functional/Module/VersionTest.php b/core/modules/system/tests/src/Functional/Module/VersionTest.php index ffe38adc8d5..7f3af598cfb 100644 --- a/core/modules/system/tests/src/Functional/Module/VersionTest.php +++ b/core/modules/system/tests/src/Functional/Module/VersionTest.php @@ -21,7 +21,8 @@ class VersionTest extends ModuleTestBase { */ public function testModuleVersions(): void { $dependencies = [ - // Alternating between being compatible and incompatible with 8.x-2.4-beta3. + // Alternating between being compatible and incompatible with + // 8.x-2.4-beta3. // The first is always a compatible. 'common_test', // Branch incompatibility. diff --git a/core/modules/system/tests/src/Functional/Routing/RouterTest.php b/core/modules/system/tests/src/Functional/Routing/RouterTest.php index e2446a5e858..97fa05f2f99 100644 --- a/core/modules/system/tests/src/Functional/Routing/RouterTest.php +++ b/core/modules/system/tests/src/Functional/Routing/RouterTest.php @@ -92,11 +92,13 @@ class RouterTest extends BrowserTestBase { $this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache-Contexts'); $this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache-Tags'); $this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache-Max-Age'); - // 5. controller result: CacheableResponse object, globally cacheable route access. + // 5. controller result: CacheableResponse object, globally cacheable route + // access. $this->drupalGet('router_test/test21'); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Contexts', ''); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Tags', 'http_response'); - // 6. controller result: CacheableResponse object, per-role cacheable route access. + // 6. controller result: CacheableResponse object, per-role cacheable route + // access. $this->drupalGet('router_test/test22'); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Contexts', 'user.roles'); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Tags', 'http_response'); diff --git a/core/modules/system/tests/src/Functional/Session/SessionTest.php b/core/modules/system/tests/src/Functional/Session/SessionTest.php index 7512d30c51c..f32462f63a8 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionTest.php @@ -230,7 +230,8 @@ class SessionTest extends BrowserTestBase { $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); $this->assertSession()->responseHeaderDoesNotExist('Set-Cookie'); - // Verify that no session is created if drupal_save_session(FALSE) is called. + // Verify that no session is created if drupal_save_session(FALSE) is + // called. $this->drupalGet('session-test/set-message-but-do-not-save'); $this->assertSessionCookie(FALSE); $this->assertSessionEmpty(TRUE); diff --git a/core/modules/system/tests/src/Functional/System/AdminTest.php b/core/modules/system/tests/src/Functional/System/AdminTest.php index 3575ee1bd9d..021e7bdcea2 100644 --- a/core/modules/system/tests/src/Functional/System/AdminTest.php +++ b/core/modules/system/tests/src/Functional/System/AdminTest.php @@ -136,7 +136,8 @@ class AdminTest extends BrowserTestBase { protected function getTopLevelMenuLinks() { $menu_tree = \Drupal::menuTree(); - // The system.admin link is normally the parent of all top-level admin links. + // The system.admin link is normally the parent of all top-level admin + // links. $parameters = new MenuTreeParameters(); $parameters->setRoot('system.admin')->excludeRoot()->setTopLevelOnly()->onlyEnabledLinks(); $tree = $menu_tree->load(NULL, $parameters); diff --git a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php index 993cc02cc62..901df6480ca 100644 --- a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php +++ b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php @@ -148,7 +148,8 @@ class SiteMaintenanceTest extends BrowserTestBase { $this->assertEquals('Site under maintenance', $this->cssSelect('main h1')[0]->getText()); $this->assertSession()->pageTextContains($offline_message); - // Verify that custom site offline message is not displayed on user/password. + // Verify that custom site offline message is not displayed on + // user/password. $this->drupalGet('user/password'); $this->assertSession()->pageTextContains('Username or email address'); diff --git a/core/modules/system/tests/src/Functional/System/ThemeTest.php b/core/modules/system/tests/src/Functional/System/ThemeTest.php index 0d6d4aff5e6..a5fbadec916 100644 --- a/core/modules/system/tests/src/Functional/System/ThemeTest.php +++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php @@ -330,8 +330,8 @@ class ThemeTest extends BrowserTestBase { $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); $this->drupalLogin($this->adminUser); - // Save Olivero's theme settings which should invalidate the 'rendered' cache - // tag in \Drupal\system\EventSubscriber\ConfigCacheTag. + // Save Olivero's theme settings which should invalidate the 'rendered' + // cache tag in \Drupal\system\EventSubscriber\ConfigCacheTag. $this->drupalGet('admin/appearance/settings/olivero'); $this->submitForm([], 'Save configuration'); $this->drupalLogout(); @@ -443,7 +443,8 @@ class ThemeTest extends BrowserTestBase { // Test the default theme on the secondary links (blocks admin page). $this->drupalGet('admin/structure/block'); $this->assertSession()->pageTextContains('Olivero'); - // Switch back to Stark and test again to test that the menu cache is cleared. + // Switch back to Stark and test again to test that the menu cache is + // cleared. $this->drupalGet('admin/appearance'); // Stark is the first 'Set as default' link. $this->clickLink('Set as default'); diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php index 736fb6975b9..8963a8cce4e 100644 --- a/core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php +++ b/core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php @@ -78,7 +78,8 @@ class ThemeInfoTest extends BrowserTestBase { $this->assertSession()->elementNotExists('xpath', '//link[contains(@href, "sub-remove.css")]'); $this->assertSession()->elementNotExists('xpath', '//link[contains(@href, "base-add.sub-remove.css")]'); - // Verify that CSS files with the same name are loaded from both the base theme and subtheme. + // Verify that CSS files with the same name are loaded from both the base + // theme and subtheme. $this->assertSession()->elementsCount('xpath', '//link[contains(@href, "' . $base . '/same-name.css")]', 1); $this->assertSession()->elementsCount('xpath', '//link[contains(@href, "' . $sub . '/same-name.css")]', 1); diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/PreventDowngradeTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/PreventDowngradeTest.php index 1b6e9638da7..400ebcdfd6e 100644 --- a/core/modules/system/tests/src/Functional/UpdateSystem/PreventDowngradeTest.php +++ b/core/modules/system/tests/src/Functional/UpdateSystem/PreventDowngradeTest.php @@ -84,7 +84,8 @@ class PreventDowngradeTest extends UpdatePathTestBase { ->condition('name', 'core.extension') ->execute(); - // Set the schema for 'downgrade_prevention_test' to the update function, 11102. + // Set the schema for 'downgrade_prevention_test' to the update function, + // 11102. $database->update('key_value') ->fields([ 'value' => 'i:11102;', diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php index 52524acf9fd..3f0de14a252 100644 --- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php +++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php @@ -536,7 +536,8 @@ class UpdateScriptTest extends BrowserTestBase { // But verify that we warn the admin about this situation. $this->assertSession()->elementTextEquals('xpath', '//div[@aria-label="Warning message"]', 'Warning message Module update_test_0 has an entry in the system.schema key/value storage, but is not installed. More information about this error.'); - // Finally, try with both kinds of orphans and make sure we get both warnings. + // Finally, try with both kinds of orphans and make sure we get both + // warnings. \Drupal::service('update.update_hook_registry')->setInstalledVersion('my_already_removed_module', 8000); $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->updateRequirementsProblem(); @@ -793,7 +794,8 @@ class UpdateScriptTest extends BrowserTestBase { ]); $this->drupalLogin($admin_user); - // Visit status report page and ensure, that link to update.php has no path prefix set. + // Visit status report page and ensure, that link to update.php has no path + // prefix set. $this->drupalGet('en/admin/reports/status', ['external' => TRUE]); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->linkByHrefExists('/update.php'); diff --git a/core/modules/system/tests/src/Kernel/Common/AlterTest.php b/core/modules/system/tests/src/Kernel/Common/AlterTest.php index dc83508160f..18217579ad9 100644 --- a/core/modules/system/tests/src/Kernel/Common/AlterTest.php +++ b/core/modules/system/tests/src/Kernel/Common/AlterTest.php @@ -62,9 +62,9 @@ class AlterTest extends KernelTestBase { $this->assertEquals($entity_expected, $entity_copy, 'Second argument to \\Drupal::moduleHandler->alter() was altered.'); $this->assertEquals($array2_expected, $array2_copy, 'Third argument to \\Drupal::moduleHandler->alter() was altered.'); - // Verify alteration order when passing an array of types to \Drupal::moduleHandler->alter(). - // common_test_module_implements_alter() places 'block' implementation after - // other modules. + // Verify alteration order when passing an array of types to + // \Drupal::moduleHandler->alter(). common_test_module_implements_alter() + // places 'block' implementation after other modules. $array_copy = $array; $array_expected = ['foo' => 'Drupal block theme']; \Drupal::moduleHandler()->alter(['drupal_alter', 'drupal_alter_foo'], $array_copy); diff --git a/core/modules/system/tests/src/Kernel/Common/UrlTest.php b/core/modules/system/tests/src/Kernel/Common/UrlTest.php index 3d7dacc4027..6c50fe94325 100644 --- a/core/modules/system/tests/src/Kernel/Common/UrlTest.php +++ b/core/modules/system/tests/src/Kernel/Common/UrlTest.php @@ -247,11 +247,13 @@ class UrlTest extends KernelTestBase { ]; $this->assertEquals($result, UrlHelper::parse($url), 'Relative URL parsed correctly.'); - // Test that drupal can recognize an absolute URL. Used to prevent attack vectors. + // Test that drupal can recognize an absolute URL. Used to prevent attack + // vectors. $url = 'https://www.example.org/foo/bar?foo=bar&bar=baz&baz#foo'; $this->assertTrue(UrlHelper::isExternal($url), 'Correctly identified an external URL.'); - // Test that UrlHelper::parse() does not allow spoofing a URL to force a malicious redirect. + // Test that UrlHelper::parse() does not allow spoofing a URL to force a + // malicious redirect. $parts = UrlHelper::parse('forged:http://cwe.mitre.org/data/definitions/601.html'); $this->assertFalse(UrlHelper::isValid($parts['path'], TRUE), '\Drupal\Component\Utility\UrlHelper::isValid() correctly parsed a forged URL.'); } diff --git a/core/modules/system/tests/src/Kernel/System/CronQueueTest.php b/core/modules/system/tests/src/Kernel/System/CronQueueTest.php index 7ca305c65aa..96a02f8f164 100644 --- a/core/modules/system/tests/src/Kernel/System/CronQueueTest.php +++ b/core/modules/system/tests/src/Kernel/System/CronQueueTest.php @@ -203,9 +203,9 @@ class CronQueueTest extends KernelTestBase { $this->assertEquals(1, $queue->numberOfItems(), 'Failing item still in the queue after throwing an exception.'); // Expire the queue item manually. system_cron() relies in - // \Drupal::time()->getRequestTime() to find queue items whose expire field needs to be - // reset to 0. This is a Kernel test, so \Drupal::time()->getRequestTime() won't change - // when cron runs. + // \Drupal::time()->getRequestTime() to find queue items whose expire field + // needs to be reset to 0. This is a Kernel test, so + // \Drupal::time()->getRequestTime() won't change when cron runs. // @see system_cron() // @see \Drupal\Core\Cron::processQueues() $this->connection->update('queue') diff --git a/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php b/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php index 5c22219838c..96f31165617 100644 --- a/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php +++ b/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php @@ -67,8 +67,8 @@ class ThemeTest extends KernelTestBase { } } - // suggestion_not_implemented is not an implemented theme hook so \Drupal::theme() service - // should return FALSE instead of a string. + // suggestion_not_implemented is not an implemented theme hook so + // \Drupal::theme() service should return FALSE instead of a string. $output = \Drupal::theme()->render(['suggestion_not_implemented'], []); $this->assertFalse($output, '\Drupal::theme() returns FALSE when a hook suggestion is not implemented.'); } diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php index 6a1bba9d5be..e610551762e 100644 --- a/core/modules/taxonomy/src/Form/OverviewTerms.php +++ b/core/modules/taxonomy/src/Form/OverviewTerms.php @@ -539,12 +539,14 @@ class OverviewTerms extends FormBase { foreach ($form_state->getValue('terms') as $tid => $values) { if (isset($form['terms'][$tid]['#term'])) { $term = $form['terms'][$tid]['#term']; - // Give terms at the root level a weight in sequence with terms on previous pages. + // Give terms at the root level a weight in sequence with terms on + // previous pages. if ($values['term']['parent'] == 0 && $term->getWeight() != $weight) { $term->setWeight($weight); $changed_terms[$term->id()] = $term; } - // Terms not at the root level can safely start from 0 because they're all on this page. + // Terms not at the root level can safely start from 0 because they're + // all on this page. elseif ($values['term']['parent'] > 0) { $level_weights[$values['term']['parent']] = isset($level_weights[$values['term']['parent']]) ? $level_weights[$values['term']['parent']] + 1 : 0; if ($level_weights[$values['term']['parent']] != $term->getWeight()) { diff --git a/core/modules/taxonomy/src/Hook/TaxonomyHooks.php b/core/modules/taxonomy/src/Hook/TaxonomyHooks.php index de383fbfa80..710708551ad 100644 --- a/core/modules/taxonomy/src/Hook/TaxonomyHooks.php +++ b/core/modules/taxonomy/src/Hook/TaxonomyHooks.php @@ -147,8 +147,8 @@ class TaxonomyHooks { */ #[Hook('node_update')] public function nodeUpdate(EntityInterface $node): void { - // If we're not dealing with the default revision of the node, do not make any - // change to the taxonomy index. + // If we're not dealing with the default revision of the node, do not make + // any change to the taxonomy index. if (!$node->isDefaultRevision()) { return; } diff --git a/core/modules/taxonomy/src/Hook/TaxonomyTokensHooks.php b/core/modules/taxonomy/src/Hook/TaxonomyTokensHooks.php index 63809355c63..b75d4172493 100644 --- a/core/modules/taxonomy/src/Hook/TaxonomyTokensHooks.php +++ b/core/modules/taxonomy/src/Hook/TaxonomyTokensHooks.php @@ -113,8 +113,8 @@ class TaxonomyTokensHooks { break; case 'description': - // "processed" returns a \Drupal\Component\Render\MarkupInterface via - // check_markup(). + // "processed" returns a \Drupal\Component\Render\MarkupInterface + // via check_markup(). $replacements[$original] = $term->description->processed; break; diff --git a/core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php b/core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php index 36e627385cf..e766aa20d66 100644 --- a/core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php @@ -107,7 +107,8 @@ class TaxonomyTermPagerTest extends TaxonomyTestBase { $loaded_terms = $state->get('taxonomy_test_taxonomy_term_load'); $this->assertCount(4, $loaded_terms); - // Adding a new term with weight < 0 implies that all root terms are updated. + // Adding a new term with weight < 0 implies that all root terms are + // updated. $this->createTerm($this->vocabulary, ['weight' => -1]); $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', ['query' => ['page' => 2]]); $state->set('taxonomy_test_taxonomy_term_load', []); diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php index 0126d73a4d2..39dc0cbbfc3 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php @@ -57,19 +57,21 @@ class TaxonomyFieldAllTermsTest extends TaxonomyTestBase { public function testViewsHandlerAllTermsWithTokens(): void { $this->drupalGet('taxonomy_all_terms_token_test'); - // Term itself: {{ term_node_tid }} + // Term itself: {{ term_node_tid }}. $this->assertSession()->pageTextContains('Term: ' . $this->term1->getName()); - // The taxonomy term ID for the term: {{ term_node_tid__tid }} + // The taxonomy term ID for the term: {{ term_node_tid__tid }}. $this->assertSession()->pageTextContains('The taxonomy term ID for the term: ' . $this->term1->id()); - // The taxonomy term name for the term: {{ term_node_tid__name }} + // The taxonomy term name for the term: {{ term_node_tid__name }}. $this->assertSession()->pageTextContains('The taxonomy term name for the term: ' . $this->term1->getName()); - // The machine name for the vocabulary the term belongs to: {{ term_node_tid__vocabulary_vid }} + // The machine name for the vocabulary the term belongs to: + // {{ term_node_tid__vocabulary_vid }}. $this->assertSession()->pageTextContains('The machine name for the vocabulary the term belongs to: ' . $this->term1->bundle()); - // The name for the vocabulary the term belongs to: {{ term_node_tid__vocabulary }} + // The name for the vocabulary the term belongs to: {{ + // term_node_tid__vocabulary }}. $vocabulary = Vocabulary::load($this->term1->bundle()); $this->assertSession()->pageTextContains('The name for the vocabulary the term belongs to: ' . $vocabulary->label()); } diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TermTranslationViewsTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TermTranslationViewsTest.php index e4d1a71de0a..4d6a953d7e6 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/TermTranslationViewsTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/TermTranslationViewsTest.php @@ -79,8 +79,8 @@ class TermTranslationViewsTest extends TaxonomyTestBase { $this->drupalLogin($this->rootUser); foreach ($this->terms as $term) { - // Test with "Content: Has taxonomy term ID (with depth)" contextual filter. - // Generate base language url and send request. + // Test with "Content: Has taxonomy term ID (with depth)" contextual + // filter. Generate base language url and send request. $url = Url::fromRoute('view.taxonomy_translated_term_name_test.page_1', ['arg_0' => $term->id()])->toString(); $this->drupalGet($url); $this->assertSession()->pageTextContains($term->label()); diff --git a/core/modules/text/tests/src/Kernel/TextSummaryTest.php b/core/modules/text/tests/src/Kernel/TextSummaryTest.php index 92c0301b3b2..cc5fb943545 100644 --- a/core/modules/text/tests/src/Kernel/TextSummaryTest.php +++ b/core/modules/text/tests/src/Kernel/TextSummaryTest.php @@ -70,7 +70,8 @@ class TextSummaryTest extends KernelTestBase { 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ' . 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'; // cSpell:enable - // First three sentences add up to: 336, so add one for space and then 3 to get half-way into next word. + // First three sentences add up to: 336, so add one for space and then 3 to + // get half-way into next word. $this->assertTextSummary($text, $expected, NULL, 340); } diff --git a/core/modules/text/text.module b/core/modules/text/text.module index 8ab9db53906..d93c36f2489 100644 --- a/core/modules/text/text.module +++ b/core/modules/text/text.module @@ -39,7 +39,8 @@ function text_summary($text, $format = NULL, $size = NULL) { // Find where the delimiter is in the body. $delimiter = strpos($text, '<!--break-->'); - // If the size is zero, and there is no delimiter, the entire body is the summary. + // If the size is zero, and there is no delimiter, the entire body is the + // summary. if ($size == 0 && $delimiter === FALSE) { return $text; } diff --git a/core/modules/toolbar/src/Hook/ToolbarHooks.php b/core/modules/toolbar/src/Hook/ToolbarHooks.php index 8c4a74b30e5..3929a65e6f9 100644 --- a/core/modules/toolbar/src/Hook/ToolbarHooks.php +++ b/core/modules/toolbar/src/Hook/ToolbarHooks.php @@ -110,8 +110,8 @@ class ToolbarHooks { // @see toolbar_subtrees_jsonp() [$hash, $hash_cacheability] = _toolbar_get_subtrees_hash(); $subtrees_attached['drupalSettings']['toolbar'] = ['subtreesHash' => $hash]; - // The administration element has a link that is themed to correspond to - // a toolbar tray. The tray contains the full administrative menu of the site. + // The administration element has a link that is themed to correspond to a + // toolbar tray. The tray contains the full administrative menu of the site. $items['administration'] = [ '#type' => 'toolbar_item', 'tab' => [ @@ -124,11 +124,12 @@ class ToolbarHooks { 'toolbar-icon', 'toolbar-icon-menu', ], - // A data attribute that indicates to the client to defer loading of - // the admin menu subtrees until this tab is activated. Admin menu - // subtrees will not render to the DOM if this attribute is removed. - // The value of the attribute is intentionally left blank. Only the - // presence of the attribute is necessary. + // A data attribute that indicates to the client to defer + // loading of the admin menu subtrees until this tab is + // activated. Admin menu subtrees will not render to the DOM + // if this attribute is removed. The value of the attribute is + // intentionally left blank. Only the presence of the + // attribute is necessary. 'data-drupal-subtrees' => '', ], ], diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php index 993c5d91d46..3a884626d4e 100644 --- a/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php +++ b/core/modules/toolbar/tests/src/Functional/ToolbarCacheContextsTest.php @@ -84,8 +84,8 @@ class ToolbarCacheContextsTest extends BrowserTestBase { // Test with default combination and permission to see toolbar. $this->assertToolbarCacheContexts(['user', 'session'], 'Expected cache contexts found for default combination and permission to see toolbar.'); - // Test without user toolbar tab. User module is a required module so we have to - // manually remove the user toolbar tab. + // Test without user toolbar tab. User module is a required module so we + // have to manually remove the user toolbar tab. $this->installExtraModules(['toolbar_disable_user_toolbar']); $this->assertToolbarCacheContexts(['user.permissions'], 'Expected cache contexts found without user toolbar tab.'); diff --git a/core/modules/update/src/Form/UpdateManagerUpdate.php b/core/modules/update/src/Form/UpdateManagerUpdate.php index ee3a6e16525..6fb59d6cce4 100644 --- a/core/modules/update/src/Form/UpdateManagerUpdate.php +++ b/core/modules/update/src/Form/UpdateManagerUpdate.php @@ -206,9 +206,9 @@ class UpdateManagerUpdate extends FormBase { // If the recommended release for a contributed project is not compatible // with the currently installed version of core, list that project in a - // separate table. If core compatibility is not defined, it means we can't determine - // compatibility requirements (or we're looking at core), so we assume it - // is compatible. + // separate table. If core compatibility is not defined, it means we can't + // determine compatibility requirements (or we're looking at core), so we + // assume it is compatible. $compatible = $recommended_release->isCoreCompatible() ?? TRUE; if ($needs_manual) { diff --git a/core/modules/update/src/Hook/UpdateHooks.php b/core/modules/update/src/Hook/UpdateHooks.php index a6365935781..f33078b2e80 100644 --- a/core/modules/update/src/Hook/UpdateHooks.php +++ b/core/modules/update/src/Hook/UpdateHooks.php @@ -82,7 +82,8 @@ class UpdateHooks { case 'system.batch_page.html': return; - // If we are on the appearance or modules list, display a detailed report + // If we are on the appearance or modules list, display a detailed + // report // of the update status. case 'system.themes_page': case 'system.modules_list': @@ -93,8 +94,8 @@ class UpdateHooks { $status = update_requirements('runtime'); foreach (['core', 'contrib'] as $report_type) { $type = 'update_' . $report_type; - // hook_requirements() supports render arrays therefore we need to render - // them before using + // hook_requirements() supports render arrays therefore we need to + // render them before using // \Drupal\Core\Messenger\MessengerInterface::addStatus(). if (isset($status[$type]['description']) && is_array($status[$type]['description'])) { $status[$type]['description'] = \Drupal::service('renderer')->renderInIsolation($status[$type]['description']); @@ -141,8 +142,8 @@ class UpdateHooks { ], 'file' => 'update.report.inc', ], - // We are using template instead of '#type' => 'table' here to keep markup - // out of preprocess and allow for easier changes to markup. + // We are using template instead of '#type' => 'table' here to keep markup + // out of preprocess and allow for easier changes to markup. 'update_version' => [ 'variables' => [ 'version' => NULL, @@ -297,10 +298,10 @@ class UpdateHooks { ]), ]; } - // Parse all the .info.yml files and make sure at least one is compatible with - // this version of Drupal core. If one is compatible, then the project as a - // whole is considered compatible (since, for example, the project may ship - // with some out-of-date modules that are not necessary for its overall + // Parse all the .info.yml files and make sure at least one is compatible + // with this version of Drupal core. If one is compatible, then the project + // as a whole is considered compatible (since, for example, the project may + // ship with some out-of-date modules that are not necessary for its overall // functionality). $compatible_project = FALSE; $incompatible = []; diff --git a/core/modules/update/tests/modules/update_test/src/Hook/UpdateTestHooks.php b/core/modules/update/tests/modules/update_test/src/Hook/UpdateTestHooks.php index 4dff6a3af0b..42941bcb464 100644 --- a/core/modules/update/tests/modules/update_test/src/Hook/UpdateTestHooks.php +++ b/core/modules/update/tests/modules/update_test/src/Hook/UpdateTestHooks.php @@ -67,8 +67,8 @@ class UpdateTestHooks { */ #[Hook('filetransfer_info')] public function filetransferInfo(): array { - // Define a test file transfer method, to ensure that there will always be at - // least one method available in the user interface (regardless of the + // Define a test file transfer method, to ensure that there will always be + // at least one method available in the user interface (regardless of the // environment in which the update manager tests are run). return [ 'system_test' => [ diff --git a/core/modules/update/tests/src/Unit/ProjectCoreCompatibilityTest.php b/core/modules/update/tests/src/Unit/ProjectCoreCompatibilityTest.php index e8d872bb88f..73c5dc48562 100644 --- a/core/modules/update/tests/src/Unit/ProjectCoreCompatibilityTest.php +++ b/core/modules/update/tests/src/Unit/ProjectCoreCompatibilityTest.php @@ -73,7 +73,8 @@ class ProjectCoreCompatibilityTest extends UnitTestCase { '8.9.2' => [], ], ]; - // Confirm that with no core supported branches the releases are not changed. + // Confirm that with no core supported branches the releases are not + // changed. $test_cases['no 9 releases, no supported branches'] += [ 'expected_releases' => $test_cases['no 9 releases, no supported branches']['project_data']['releases'], 'expected_security_updates' => $test_cases['no 9 releases, no supported branches']['project_data']['security updates'], diff --git a/core/modules/user/src/AccountForm.php b/core/modules/user/src/AccountForm.php index bd8427ecc85..921c7c96707 100644 --- a/core/modules/user/src/AccountForm.php +++ b/core/modules/user/src/AccountForm.php @@ -105,7 +105,8 @@ abstract class AccountForm extends ContentEntityForm implements TrustedCallbackI '#access' => $account->mail->access('edit'), ]; - // Only show name field on registration form or user can change own username. + // Only show name field on registration form or user can change own + // username. $form['account']['name'] = [ '#type' => 'textfield', '#title' => $this->t('Username'), diff --git a/core/modules/user/src/Entity/EntityPermissionsRouteProvider.php b/core/modules/user/src/Entity/EntityPermissionsRouteProvider.php index 7e15cdbf5c6..78f4dd55d7d 100644 --- a/core/modules/user/src/Entity/EntityPermissionsRouteProvider.php +++ b/core/modules/user/src/Entity/EntityPermissionsRouteProvider.php @@ -93,8 +93,8 @@ class EntityPermissionsRouteProvider implements EntityRouteProviderInterface, En '_permission' => 'administer permissions', ], [ - // Indicate that Drupal\Core\Entity\Enhancer\EntityBundleRouteEnhancer should - // set the bundle parameter. + // Indicate that Drupal\Core\Entity\Enhancer\EntityBundleRouteEnhancer + // should set the bundle parameter. '_field_ui' => TRUE, 'parameters' => [ $entity_type_id => [ diff --git a/core/modules/user/src/Form/UserCancelForm.php b/core/modules/user/src/Form/UserCancelForm.php index 787339e07fd..98593834dbe 100644 --- a/core/modules/user/src/Form/UserCancelForm.php +++ b/core/modules/user/src/Form/UserCancelForm.php @@ -60,8 +60,8 @@ class UserCancelForm extends ContentEntityConfirmFormBase { $default_method = $this->config('user.settings')->get('cancel_method'); $own_account = $this->entity->id() == $this->currentUser()->id(); // Options supplied via user_cancel_methods() can have a custom - // #confirm_description property for the confirmation form description. - // This text refers to "Your account" so only user it if cancelling own account. + // #confirm_description property for the confirmation form description. This + // text refers to "Your account" so only user it if cancelling own account. if ($own_account && isset($this->cancelMethods[$default_method]['#confirm_description'])) { return $this->cancelMethods[$default_method]['#confirm_description']; } diff --git a/core/modules/user/src/Form/UserLoginForm.php b/core/modules/user/src/Form/UserLoginForm.php index b8cbaed6090..c373cb265ad 100644 --- a/core/modules/user/src/Form/UserLoginForm.php +++ b/core/modules/user/src/Form/UserLoginForm.php @@ -182,7 +182,8 @@ class UserLoginForm extends FormBase implements WorkspaceSafeFormInterface { // reached. Default is 50 failed attempts allowed in one hour. This is // independent of the per-user limit to catch attempts from one IP to log // in to many different user accounts. We have a reasonably high limit - // since there may be only one apparent IP for all users at an institution. + // since there may be only one apparent IP for all users at an + // institution. if (!$this->userFloodControl->isAllowed('user.failed_login_ip', $flood_config->get('ip_limit'), $flood_config->get('ip_window'))) { $form_state->set('flood_control_triggered', 'ip'); return; diff --git a/core/modules/user/src/Form/UserMultipleCancelConfirm.php b/core/modules/user/src/Form/UserMultipleCancelConfirm.php index f0463686a80..5169ce46ecb 100644 --- a/core/modules/user/src/Form/UserMultipleCancelConfirm.php +++ b/core/modules/user/src/Form/UserMultipleCancelConfirm.php @@ -206,7 +206,8 @@ class UserMultipleCancelConfirm extends ConfirmFormBase { if ($uid <= 1) { continue; } - // Prevent user administrators from deleting themselves without confirmation. + // Prevent user administrators from deleting themselves without + // confirmation. if ($uid == $current_user_id) { $admin_form_mock = []; $admin_form_state = $form_state; diff --git a/core/modules/user/src/Hook/UserHooks.php b/core/modules/user/src/Hook/UserHooks.php index be1f4d6395a..838f2b56209 100644 --- a/core/modules/user/src/Hook/UserHooks.php +++ b/core/modules/user/src/Hook/UserHooks.php @@ -110,9 +110,9 @@ class UserHooks { */ #[Hook('js_settings_alter')] public function jsSettingsAlter(&$settings, AttachedAssetsInterface $assets): void { - // Provide the user ID in drupalSettings to allow JavaScript code to customize - // the experience for the end user, rather than the server side, which would - // break the render cache. + // Provide the user ID in drupalSettings to allow JavaScript code to + // customize the experience for the end user, rather than the server side, + // which would break the render cache. // Similarly, provide a permissions hash, so that permission-dependent data // can be reliably cached on the client side. $user = \Drupal::currentUser(); @@ -189,8 +189,8 @@ class UserHooks { foreach (Element::children($build['user_picture']) as $key) { if (!isset($build['user_picture'][$key]['#item']) || !$build['user_picture'][$key]['#item'] instanceof ImageItem) { // User picture field is provided by standard profile install. If the - // display is configured to use a different formatter, the #item render - // key may not exist, or may not be an image field. + // display is configured to use a different formatter, the #item + // render key may not exist, or may not be an image field. continue; } /** @var \Drupal\image\Plugin\Field\FieldType\ImageItem $item */ @@ -212,7 +212,8 @@ class UserHooks { public function templatePreprocessDefaultVariablesAlter(&$variables): void { $user = \Drupal::currentUser(); $variables['user'] = clone $user; - // Remove password and session IDs, since themes should not need nor see them. + // Remove password and session IDs, since themes should not need nor see + // them. unset($variables['user']->pass, $variables['user']->sid, $variables['user']->ssid); $variables['is_admin'] = $user->hasPermission('access administration pages'); $variables['logged_in'] = $user->isAuthenticated(); @@ -412,9 +413,9 @@ class UserHooks { ], '#create_placeholder' => TRUE, '#lazy_builder_preview' => [ - // Add a line of whitespace to the placeholder to ensure the icon is - // positioned in the same place it will be when the lazy loaded content - // appears. + // Add a line of whitespace to the placeholder to ensure the icon is + // positioned in the same place it will be when the lazy loaded content + // appears. '#markup' => ' ', ], ]; @@ -446,8 +447,8 @@ class UserHooks { $form['timezone']['configurable_timezones_wrapper'] = [ '#type' => 'container', '#states' => [ - // Hide the user configured timezone settings when users are forced to use - // the default setting. + // Hide the user configured timezone settings when users are forced to + // use the default setting. 'invisible' => [ 'input[name="configurable_timezones"]' => [ 'checked' => FALSE, diff --git a/core/modules/user/src/Hook/UserTokensHooks.php b/core/modules/user/src/Hook/UserTokensHooks.php index 1ecfc63b593..2305596d5d1 100644 --- a/core/modules/user/src/Hook/UserTokensHooks.php +++ b/core/modules/user/src/Hook/UserTokensHooks.php @@ -118,7 +118,8 @@ class UserTokensHooks { $replacements[$original] = $account->id() ? $account->toUrl('edit-form', $url_options)->toString() : t('not yet assigned'); break; - // These tokens are default variations on the chained tokens handled below. + // These tokens are default variations on the chained tokens handled + // below. case 'last-login': $date_format = DateFormat::load('medium'); $bubbleable_metadata->addCacheableDependency($date_format); diff --git a/core/modules/user/src/Plugin/migrate/destination/EntityUser.php b/core/modules/user/src/Plugin/migrate/destination/EntityUser.php index e66ec9ee6a6..52c679d8a3e 100644 --- a/core/modules/user/src/Plugin/migrate/destination/EntityUser.php +++ b/core/modules/user/src/Plugin/migrate/destination/EntityUser.php @@ -140,9 +140,9 @@ class EntityUser extends EntityContentBase { protected function save(ContentEntityInterface $entity, array $old_destination_id_values = []) { // Do not overwrite the root account password. if ($entity->id() != 1) { - // Set the pre_hashed password so that the PasswordItem field does not hash - // already hashed passwords. If the md5_passwords configuration option is - // set we need to rehash the password and prefix with a U. + // Set the pre_hashed password so that the PasswordItem field does not + // hash already hashed passwords. If the md5_passwords configuration + // option is set we need to rehash the password and prefix with a U. // @see \Drupal\Core\Field\Plugin\Field\FieldType\PasswordItem::preSave() $entity->pass->pre_hashed = TRUE; if (isset($this->configuration['md5_passwords'])) { diff --git a/core/modules/user/src/Plugin/views/argument_validator/User.php b/core/modules/user/src/Plugin/views/argument_validator/User.php index 97f77a77c98..6133434644c 100644 --- a/core/modules/user/src/Plugin/views/argument_validator/User.php +++ b/core/modules/user/src/Plugin/views/argument_validator/User.php @@ -82,7 +82,8 @@ class User extends Entity { * {@inheritdoc} */ public function submitOptionsForm(&$form, FormStateInterface $form_state, &$options = []) { - // Filter trash out of the options so we don't store giant unnecessary arrays + // Filter trash out of the options so we don't store giant unnecessary + // arrays $options['roles'] = array_filter($options['roles']); } diff --git a/core/modules/user/tests/src/Functional/UserAdminTest.php b/core/modules/user/tests/src/Functional/UserAdminTest.php index d52cc1bd05d..a400af7a7e0 100644 --- a/core/modules/user/tests/src/Functional/UserAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserAdminTest.php @@ -144,7 +144,8 @@ class UserAdminTest extends BrowserTestBase { $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_b)); $this->assertSession()->elementExists('xpath', static::getLinkSelectorForUser($user_c)); - // Test unblocking of a user from /admin/people page and sending of activation mail + // Test unblocking of a user from /admin/people page and sending of + // activation mail $edit_unblock = []; $edit_unblock['action'] = 'user_unblock_user_action'; $edit_unblock['user_bulk_form[4]'] = TRUE; @@ -158,7 +159,8 @@ class UserAdminTest extends BrowserTestBase { $this->assertTrue($account->isActive(), 'User C unblocked'); $this->assertMail("to", $account->getEmail(), "Activation mail sent to user C"); - // Test blocking and unblocking another user from /user/[uid]/edit form and sending of activation mail + // Test blocking and unblocking another user from /user/[uid]/edit form and + // sending of activation mail. $user_d = $this->drupalCreateUser([]); $account1 = $user_storage->load($user_d->id()); $this->drupalGet('user/' . $account1->id() . '/edit'); diff --git a/core/modules/user/tests/src/Functional/UserEditTest.php b/core/modules/user/tests/src/Functional/UserEditTest.php index e8596786373..ad05af938ed 100644 --- a/core/modules/user/tests/src/Functional/UserEditTest.php +++ b/core/modules/user/tests/src/Functional/UserEditTest.php @@ -28,7 +28,8 @@ class UserEditTest extends BrowserTestBase { $user2 = $this->drupalCreateUser([]); $this->drupalLogin($user1); - // Test that error message appears when attempting to use a non-unique user name. + // Test that error message appears when attempting to use a non-unique user + // name. $edit['name'] = $user2->getAccountName(); $this->drupalGet("user/" . $user1->id() . "/edit"); $this->submitForm($edit, 'Save'); diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php index 9f1eccf6b1b..0eeee42d2c9 100644 --- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php +++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php @@ -177,7 +177,8 @@ class UserPasswordResetTest extends BrowserTestBase { $this->assertSession()->pageTextNotContains('Expected user_string to be a string, NULL given'); $this->drupalLogout(); - // Create a password reset link as if the request time was 60 seconds older than the allowed limit. + // Create a password reset link as if the request time was 60 seconds older + // than the allowed limit. $timeout = $this->config('user.settings')->get('password_reset_timeout'); $bogus_timestamp = \Drupal::time()->getRequestTime() - $timeout - 60; $_uid = $this->account->id(); @@ -203,7 +204,8 @@ class UserPasswordResetTest extends BrowserTestBase { $this->submitForm($edit, 'Submit'); $this->assertCount($before, $this->drupalGetMails(['id' => 'user_password_reset']), 'No email was sent when requesting password reset for a blocked account'); - // Verify a password reset link is invalidated when the user's email address changes. + // Verify a password reset link is invalidated when the user's email address + // changes. $this->drupalGet('user/password'); $edit = ['name' => $this->account->getAccountName()]; $this->submitForm($edit, 'Submit'); @@ -260,7 +262,8 @@ class UserPasswordResetTest extends BrowserTestBase { $this->account->save(); $this->assertSame($setPreferredLangcode, $this->account->getPreferredLangcode(FALSE)); - // Test Default langcode is different from active langcode when visiting different. + // Test Default langcode is different from active langcode when visiting + // different. if ($setPreferredLangcode !== 'en') { $this->drupalGet($prefix . '/user/password'); $this->assertSame($activeLangcode, $this->getSession()->getResponseHeader('Content-language')); @@ -454,7 +457,8 @@ class UserPasswordResetTest extends BrowserTestBase { $random_name = $this->randomMachineName(); $edit = ['name' => $random_name]; $this->submitForm($edit, 'Submit'); - // Because we're testing with a random name, the password reset will not be valid. + // Because we're testing with a random name, the password reset will not + // be valid. $this->assertNoValidPasswordReset($random_name); $this->assertNoPasswordIpFlood(); } diff --git a/core/modules/user/tests/src/Functional/UserPermissionsAdminTest.php b/core/modules/user/tests/src/Functional/UserPermissionsAdminTest.php index fd96252c689..67458e6b4a6 100644 --- a/core/modules/user/tests/src/Functional/UserPermissionsAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserPermissionsAdminTest.php @@ -49,8 +49,8 @@ class UserPermissionsAdminTest extends BrowserTestBase { 'view user email addresses', ], $role->getPermissions()); - // Remove the first permission, resulting in a single permission in the first - // key of the array. + // Remove the first permission, resulting in a single permission in the + // first key of the array. $this->submitForm([ 'test_role[change own username]' => 0, ], 'Save permissions'); diff --git a/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/core/modules/user/tests/src/Functional/UserRegistrationTest.php index f9905878bd7..fd6bfe52938 100644 --- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -162,7 +162,8 @@ class UserRegistrationTest extends BrowserTestBase { $this->submitForm($edit, 'Create new account'); $this->assertSession()->pageTextContains('The email address ' . $duplicate_user->getEmail() . ' is already taken.'); - // Attempt to bypass duplicate email registration validation by adding spaces. + // Attempt to bypass duplicate email registration validation by adding + // spaces. $edit['mail'] = ' ' . $duplicate_user->getEmail() . ' '; $this->drupalGet('user/register'); diff --git a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php index dbaf9dea6bb..0f53ebbfd49 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTest.php @@ -69,7 +69,8 @@ class MigrateUserProfileFieldInstanceTest extends MigrateDrupal6TestBase { $this->assertSame('Birthdate', $field->label()); $this->assertSame("Enter your birth date and we'll send you a coupon.", $field->getDescription()); - // Another migrated checkbox field, with a different source visibility setting. + // Another migrated checkbox field, with a different source visibility + // setting. $field = FieldConfig::load('user.user.profile_really_really_love_mig'); $this->assertSame('I really, really, really love migrations', $field->label()); $this->assertSame("If you check this box, you love migrations.", $field->getDescription()); diff --git a/core/modules/views/src/Element/View.php b/core/modules/views/src/Element/View.php index 96c2e77915b..700802fd2f2 100644 --- a/core/modules/views/src/Element/View.php +++ b/core/modules/views/src/Element/View.php @@ -66,11 +66,11 @@ class View extends RenderElementBase { } else { // Add contextual links to the view. We need to attach them to the dummy - // $view_array variable, since contextual_preprocess() requires that they - // be attached to an array (not an object) in order to process them. For - // our purposes, it doesn't matter what we attach them to, since once they - // are processed by contextual_preprocess() they will appear in the - // $title_suffix variable (which we will then render in + // $view_array variable, since contextual_preprocess() requires that + // they be attached to an array (not an object) in order to process + // them. For our purposes, it doesn't matter what we attach them to, + // since once they are processed by contextual_preprocess() they will + // appear in the $title_suffix variable (which we will then render in // views-view.html.twig). $view->setDisplay($element['#display_id']); // Add the result of the executed view as a child element so any diff --git a/core/modules/views/src/EventSubscriber/RouteSubscriber.php b/core/modules/views/src/EventSubscriber/RouteSubscriber.php index 7a9d9b89f20..6e6ca6e6544 100644 --- a/core/modules/views/src/EventSubscriber/RouteSubscriber.php +++ b/core/modules/views/src/EventSubscriber/RouteSubscriber.php @@ -138,8 +138,8 @@ class RouteSubscriber extends RouteSubscriberBase { if (($view = $view->getExecutable()) && $view instanceof ViewExecutable) { if ($view->setDisplay($display_id) && $display = $view->displayHandlers->get($display_id)) { if ($display instanceof DisplayRouterInterface) { - // If the display returns TRUE a route item was found, so it does not - // have to be added. + // If the display returns TRUE a route item was found, so it does + // not have to be added. $view_route_names = $display->alterRoutes($collection); $this->viewRouteNames = $view_route_names + $this->viewRouteNames; foreach ($view_route_names as $id_display => $route_name) { diff --git a/core/modules/views/src/Form/ViewsFormMainForm.php b/core/modules/views/src/Form/ViewsFormMainForm.php index ebb8be19f07..25480f11989 100644 --- a/core/modules/views/src/Form/ViewsFormMainForm.php +++ b/core/modules/views/src/Form/ViewsFormMainForm.php @@ -81,8 +81,8 @@ class ViewsFormMainForm implements FormInterface, TrustedCallbackInterface { $form['#pre_render'][] = [static::class, 'preRenderViewsForm']; - // Add the output markup to the form array so that it's included when the form - // array is passed to the theme function. + // Add the output markup to the form array so that it's included when the + // form array is passed to the theme function. $form['output'] = $output; // This way any additional form elements will go before the view // (below the exposed widgets). diff --git a/core/modules/views/src/Hook/ViewsHooks.php b/core/modules/views/src/Hook/ViewsHooks.php index d463e3664ca..8d31b03d073 100644 --- a/core/modules/views/src/Hook/ViewsHooks.php +++ b/core/modules/views/src/Hook/ViewsHooks.php @@ -102,9 +102,9 @@ class ViewsHooks { ], ]; $variables = [ - // For displays, we pass in a dummy array as the first parameter, since - // $view is an object but the core contextual_preprocess() function only - // attaches contextual links when the primary theme argument is an array. + // For displays, we pass in a dummy array as the first parameter, since + // $view is an object but the core contextual_preprocess() function only + // attaches contextual links when the primary theme argument is an array. 'display' => [ 'view_array' => [], 'view' => NULL, @@ -166,8 +166,8 @@ class ViewsHooks { $module_handler = \Drupal::moduleHandler(); // Register theme functions for all style plugins. It provides a basic auto // implementation of theme functions or template files by using the plugin - // definitions (theme, theme_file, module, register_theme). Template files are - // assumed to be located in the templates folder. + // definitions (theme, theme_file, module, register_theme). Template files + // are assumed to be located in the templates folder. foreach ($plugins as $type => $info) { foreach ($info as $def) { // Not all plugins have theme functions, and they can also explicitly diff --git a/core/modules/views/src/Hook/ViewsViewsHooks.php b/core/modules/views/src/Hook/ViewsViewsHooks.php index 63229a8ca39..fbcbc6b11bc 100644 --- a/core/modules/views/src/Hook/ViewsViewsHooks.php +++ b/core/modules/views/src/Hook/ViewsViewsHooks.php @@ -163,8 +163,8 @@ class ViewsViewsHooks { $data = NestedArray::mergeDeep($data, $views_data->getViewsData()); } } - // Field modules can implement hook_field_views_data() to override the default - // behavior for adding fields. + // Field modules can implement hook_field_views_data() to override the + // default behavior for adding fields. $module_handler = \Drupal::moduleHandler(); $entity_type_manager = \Drupal::entityTypeManager(); if ($entity_type_manager->hasDefinition('field_storage_config')) { @@ -252,8 +252,8 @@ class ViewsViewsHooks { 'base field' => $target_entity_type->getKey('id'), 'relationship field' => $field_name . '_target_id', ]; - // Provide a reverse relationship for the entity type that is referenced by - // the field. + // Provide a reverse relationship for the entity type that is referenced + // by the field. $args['@entity'] = $entity_type->getLabel(); $args['@label'] = $target_entity_type->getSingularLabel(); $pseudo_field_name = 'reverse__' . $entity_type_id . '__' . $field_name; diff --git a/core/modules/views/src/ManyToOneHelper.php b/core/modules/views/src/ManyToOneHelper.php index fe19c75ca25..56afc646c4b 100644 --- a/core/modules/views/src/ManyToOneHelper.php +++ b/core/modules/views/src/ManyToOneHelper.php @@ -88,8 +88,8 @@ class ManyToOneHelper { $join = $this->getJoin(); } - // See if there's a chain between us and the base relationship. If so, we need - // to create a new relationship to use. + // See if there's a chain between us and the base relationship. If so, we + // need to create a new relationship to use. $relationship = $this->handler->relationship; // Determine the primary table to seek diff --git a/core/modules/views/src/Plugin/Derivative/ViewsBlock.php b/core/modules/views/src/Plugin/Derivative/ViewsBlock.php index 3706e39eda2..189a4f0efca 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsBlock.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsBlock.php @@ -95,8 +95,8 @@ class ViewsBlock implements ContainerDeriverInterface { else { // Allow translators to control the punctuation. Plugin // definitions get cached, so use TranslatableMarkup() instead of - // $this->t() to avoid double escaping when $admin_label is rendered - // during requests that use the cached definition. + // $this->t() to avoid double escaping when $admin_label is + // rendered during requests that use the cached definition. $admin_label = new TranslatableMarkup('@view: @display', ['@view' => $view->label(), '@display' => $display->display['display_title']]); } } diff --git a/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php index 3283daabbdb..c9bd4a60004 100644 --- a/core/modules/views/src/Plugin/views/HandlerBase.php +++ b/core/modules/views/src/Plugin/views/HandlerBase.php @@ -184,7 +184,8 @@ abstract class HandlerBase extends PluginBase implements ViewsHandlerInterface { } } - // If grouping, check to see if the aggregation method needs to modify the field. + // If grouping, check to see if the aggregation method needs to modify the + // field. if ($this->view->display_handler->useGroupBy()) { $this->view->initQuery(); if ($this->query) { @@ -265,10 +266,10 @@ abstract class HandlerBase extends PluginBase implements ViewsHandlerInterface { * {@inheritdoc} */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { - // Some form elements belong in a fieldset for presentation, but can't - // be moved into one because of the $form_state->getValues() hierarchy. Those - // elements can add a #fieldset => 'fieldset_name' property, and they'll - // be moved to their fieldset during pre_render. + // Some form elements belong in a fieldset for presentation, but can't be + // moved into one because of the $form_state->getValues() hierarchy. Those + // elements can add a #fieldset => 'fieldset_name' property, and they'll be + // moved to their fieldset during pre_render. $form['#pre_render'][] = [static::class, 'preRenderAddFieldsetMarkup']; parent::buildOptionsForm($form, $form_state); @@ -943,8 +944,8 @@ abstract class HandlerBase extends PluginBase implements ViewsHandlerInterface { // @todo Decide if \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm() is // perhaps the better place to fix the issue. // \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm() drops the current - // form from the stack, even if it's an #ajax. So add the item back to the top - // of the stack. + // form from the stack, even if it's an #ajax. So add the item back to the + // top of the stack. $view->addFormToStack($form_state->get('form_key'), $form_state->get('display_id'), $type, $item['id'], TRUE); $form_state->get('rerender', TRUE); diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php index bc9e9c9ff51..ca589809b23 100644 --- a/core/modules/views/src/Plugin/views/PluginBase.php +++ b/core/modules/views/src/Plugin/views/PluginBase.php @@ -269,9 +269,9 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // Some form elements belong in a fieldset for presentation, but can't - // be moved into one because of the $form_state->getValues() hierarchy. Those - // elements can add a #fieldset => 'fieldset_name' property, and they'll - // be moved to their fieldset during pre_render. + // be moved into one because of the $form_state->getValues() hierarchy. + // Those elements can add a #fieldset => 'fieldset_name' property, and + // they'll be moved to their fieldset during pre_render. $form['#pre_render'][] = [static::class, 'preRenderAddFieldsetMarkup']; } diff --git a/core/modules/views/src/Plugin/views/area/View.php b/core/modules/views/src/Plugin/views/area/View.php index 1f1b28ebce6..b15e72c0864 100644 --- a/core/modules/views/src/Plugin/views/area/View.php +++ b/core/modules/views/src/Plugin/views/area/View.php @@ -153,7 +153,8 @@ class View extends AreaPluginBase { $dependencies = parent::calculateDependencies(); [$view_id] = explode(':', $this->options['view_to_insert'], 2); - // Don't call the current view, as it would result into an infinite recursion. + // 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); $dependencies[$view->getConfigDependencyKey()][] = $view->getConfigDependencyName(); diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php index 4fb166b4871..1caeead7b39 100644 --- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php +++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php @@ -421,8 +421,8 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend '#prefix' => '<div id="edit-options-validate-options-' . $sanitized_id . '-wrapper">', '#suffix' => '</div>', '#type' => 'item', - // Even if the plugin has no options add the key to the form_state. - // trick it into checking input to make #process run. + // Even if the plugin has no options add the key to the + // form_state. trick it into checking input to make #process run. '#input' => TRUE, '#states' => [ 'visible' => [ @@ -543,7 +543,8 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend if ($plugin) { $options = &$option_values['argument_default'][$default_id]; $plugin->submitOptionsForm($form['argument_default'][$default_id], $form_state, $options); - // Copy the now submitted options to their final resting place so they get saved. + // Copy the now submitted options to their final resting place so they get + // saved. $option_values['default_argument_options'] = $options; } @@ -553,7 +554,8 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend if ($plugin) { $options = &$option_values['summary']['options'][$summary_id]; $plugin->submitOptionsForm($form['summary']['options'][$summary_id], $form_state, $options); - // Copy the now submitted options to their final resting place so they get saved. + // Copy the now submitted options to their final resting place so they get + // saved. $option_values['summary_options'] = $options; } @@ -574,7 +576,8 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend if ($plugin) { $options = &$option_values['validate']['options'][$sanitized_id]; $plugin->submitOptionsForm($form['validate']['options'][$sanitized_id], $form_state, $options); - // Copy the now submitted options to their final resting place so they get saved. + // Copy the now submitted options to their final resting place so they get + // saved. $option_values['validate_options'] = $options; } @@ -1215,7 +1218,8 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend $plugin->init($this->view, $this->displayHandler, $options); if ($type !== 'style') { - // It's an argument_default/argument_validate plugin, so set the argument. + // It's an argument_default/argument_validate plugin, so set the + // argument. $plugin->setArgument($this); } return $plugin; diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 4d9e2d65048..237cdd9dcfc 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -2030,8 +2030,8 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte case 'pager_options': case 'row_options': case 'style_options': - // Submit plugin options. Every section with "_options" in it, belongs to - // a plugin type, like "style_options". + // Submit plugin options. Every section with "_options" in it, belongs + // to a plugin type, like "style_options". $plugin_type = str_replace('_options', '', $section); if ($plugin = $this->getPlugin($plugin_type)) { $plugin_options = $this->getOption($plugin_type); @@ -2281,7 +2281,8 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte $element['#attachment_after'] = $view->attachment_after; } - // If form fields were found in the view, reformat the view output as a form. + // If form fields were found in the view, reformat the view output as a + // form. if ($view->hasFormElements()) { // Only render row output if there are rows. Otherwise, render the empty // region. diff --git a/core/modules/views/src/Plugin/views/field/BulkForm.php b/core/modules/views/src/Plugin/views/field/BulkForm.php index e0973053efe..2fcf8588bb7 100644 --- a/core/modules/views/src/Plugin/views/field/BulkForm.php +++ b/core/modules/views/src/Plugin/views/field/BulkForm.php @@ -328,7 +328,8 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface, // Replace the form submit button label. $form['actions']['submit']['#value'] = $this->t('Apply to selected items'); - // Ensure a consistent container for filters/operations in the view header. + // Ensure a consistent container for filters/operations in the view + // header. $form['header'] = [ '#type' => 'container', '#weight' => -100, diff --git a/core/modules/views/src/Plugin/views/field/Date.php b/core/modules/views/src/Plugin/views/field/Date.php index 16ab35075df..106bd6131f6 100644 --- a/core/modules/views/src/Plugin/views/field/Date.php +++ b/core/modules/views/src/Plugin/views/field/Date.php @@ -121,7 +121,8 @@ class Date extends FieldPluginBase { '#description' => $this->t('If "Custom", see <a href="https://www.php.net/manual/datetime.format.php#refsect1-datetime.format-parameters" target="_blank">the PHP docs</a> for date formats. Otherwise, enter the number of different time units to display, which defaults to 2.'), '#default_value' => $this->options['custom_date_format'] ?? '', ]; - // Setup #states for all possible date_formats on the custom_date_format form element. + // Setup #states for all possible date_formats on the custom_date_format + // form element. foreach (['custom', 'raw time ago', 'time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span'] as $custom_date_possible) { $form['custom_date_format']['#states']['visible'][] = [ ':input[name="options[date_format]"]' => ['value' => $custom_date_possible], diff --git a/core/modules/views/src/Plugin/views/field/EntityField.php b/core/modules/views/src/Plugin/views/field/EntityField.php index a9e6db29cae..3d1db5c8b46 100644 --- a/core/modules/views/src/Plugin/views/field/EntityField.php +++ b/core/modules/views/src/Plugin/views/field/EntityField.php @@ -232,8 +232,8 @@ class EntityField extends FieldPluginBase implements CacheableDependencyInterfac $this->limit_values = TRUE; } - // Otherwise, we only limit values if the user hasn't selected "all", 0, or - // the value matching field cardinality. + // Otherwise, we only limit values if the user hasn't selected "all", 0, + // or the value matching field cardinality. if ((($this->options['delta_limit'] > 0) && ($this->options['delta_limit'] != $cardinality)) || intval($this->options['delta_offset'])) { $this->limit_values = TRUE; } @@ -270,7 +270,8 @@ class EntityField extends FieldPluginBase implements CacheableDependencyInterfac } $options += is_array($this->options['group_columns']) ? $this->options['group_columns'] : []; - // Go through the list and determine the actual column name from field api. + // Go through the list and determine the actual column name from field + // api. $fields = []; $table_mapping = $this->getTableMapping(); $field_definition = $this->getFieldStorageDefinition(); diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index 352222235f0..b60cfbf199d 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -1319,9 +1319,10 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf // Check if there should be no further rewrite for empty values. $no_rewrite_for_empty = $this->options['hide_alter_empty'] && $this->isValueEmpty($this->original_value, $this->options['empty_zero']); - // Check whether the value is empty and return nothing, so the field isn't rendered. - // First check whether the field should be hidden if the value(hide_alter_empty = TRUE) /the rewrite is empty (hide_alter_empty = FALSE). - // For numeric values you can specify whether "0"/0 should be empty. + // Check whether the value is empty and return nothing, so the field isn't + // rendered. First check whether the field should be hidden if the + // value(hide_alter_empty = TRUE) /the rewrite is empty (hide_alter_empty = + // FALSE). For numeric values you can specify whether "0"/0 should be empty. if ((($this->options['hide_empty'] && empty($value)) || ($alter['phase'] != static::RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty)) && $this->isValueEmpty($value, $this->options['empty_zero'], FALSE)) { @@ -1526,7 +1527,8 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf // If the path is empty do not build a link around the given text and return // it as is. - // http://www.example.com URLs will not have a $url['path'], so check host as well. + // http://www.example.com URLs will not have a $url['path'], so check host + // as well. if (empty($url['path']) && empty($url['host']) && empty($url['fragment']) && empty($url['url'])) { return $text; } @@ -1582,8 +1584,9 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf $options['attributes']['target'] = $target; } - // Allow the addition of arbitrary attributes to links. Additional attributes - // currently can only be altered in preprocessors and not within the UI. + // Allow the addition of arbitrary attributes to links. Additional + // attributes currently can only be altered in preprocessors and not within + // the UI. if (isset($alter['link_attributes']) && is_array($alter['link_attributes'])) { foreach ($alter['link_attributes'] as $key => $attribute) { if (!isset($options['attributes'][$key])) { diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php index 7da1d6bef71..ffb13966844 100644 --- a/core/modules/views/src/Plugin/views/filter/Combine.php +++ b/core/modules/views/src/Plugin/views/filter/Combine.php @@ -78,7 +78,8 @@ class Combine extends StringFilter { continue; } $field = $this->view->field[$id]; - // Always add the table of the selected fields to be sure a table alias exists. + // Always add the table of the selected fields to be sure a table alias + // exists. $field->ensureMyTable(); if (!empty($field->tableAlias) && !empty($field->realField)) { $fields[] = "$field->tableAlias.$field->realField"; diff --git a/core/modules/views/src/Plugin/views/filter/Date.php b/core/modules/views/src/Plugin/views/filter/Date.php index 60b90b37c4e..3725281cad2 100644 --- a/core/modules/views/src/Plugin/views/filter/Date.php +++ b/core/modules/views/src/Plugin/views/filter/Date.php @@ -190,8 +190,9 @@ class Date extends NumericFilter { // Keep sign. $b = '***CURRENT_TIME***' . sprintf('%+d', $b); } - // This is safe because we are manually scrubbing the values. - // It is necessary to do it this way because $a and $b are formulas when using an offset. + // This is safe because we are manually scrubbing the values. It is + // necessary to do it this way because $a and $b are formulas when using an + // offset. $operator = strtoupper($this->operator); $this->query->addWhereExpression($this->options['group'], "$field $operator $a AND $b"); } @@ -205,8 +206,8 @@ class Date extends NumericFilter { // Keep sign. $value = '***CURRENT_TIME***' . sprintf('%+d', $value); } - // This is safe because we are manually scrubbing the value. - // It is necessary to do it this way because $value is a formula when using an offset. + // This is safe because we are manually scrubbing the value. It is necessary + // to do it this way because $value is a formula when using an offset. $this->query->addWhereExpression($this->options['group'], "$field $this->operator $value"); } diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php index d9d16967e7d..5cc928d04e3 100644 --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -1145,10 +1145,10 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen } $form['#theme'] = 'views_ui_build_group_filter_form'; - // #flatten will move everything from $form['group_info'][$key] to $form[$key] - // prior to rendering. That's why the preRender for it needs to run first, - // so that when the next preRender (the one for fieldsets) runs, it gets - // the flattened data. + // #flatten will move everything from $form['group_info'][$key] to + // $form[$key] prior to rendering. That's why the preRender for it needs to + // run first, so that when the next preRender (the one for fieldsets) runs, + // it gets the flattened data. array_unshift($form['#pre_render'], [static::class, 'preRenderFlattenData']); $form['group_info']['#flatten'] = TRUE; @@ -1401,7 +1401,8 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen $form['#size'] = NULL; } - // Cleanup in case the translated element's (radios or checkboxes) display value contains html. + // Cleanup in case the translated element's (radios or checkboxes) display + // value contains html. if ($form['#type'] == 'select') { $this->prepareFilterSelectOptions($form['#options']); } @@ -1511,7 +1512,8 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen $this->options['expose']['operator_id'] = $operator_id; $this->options['expose']['use_operator'] = TRUE; - // Value can be optional, For example for 'empty' and 'not empty' filters. + // Value can be optional, For example for 'empty' and 'not empty' + // filters. if (isset($selected_group_options['value']) && $selected_group_options['value'] !== '') { $input[$this->options['group_info']['identifier']] = $selected_group_options['value']; } diff --git a/core/modules/views/src/Plugin/views/filter/InOperator.php b/core/modules/views/src/Plugin/views/filter/InOperator.php index 6d2a7c56e41..9750f084d2a 100644 --- a/core/modules/views/src/Plugin/views/filter/InOperator.php +++ b/core/modules/views/src/Plugin/views/filter/InOperator.php @@ -471,11 +471,13 @@ class InOperator extends FilterPluginBase implements FilterOperatorsInterface { } if (is_array($this->value)) { if (!isset($this->valueOptions)) { - // Don't validate if there are none value options provided, for example for special handlers. + // Don't validate if there are none value options provided, for example + // for special handlers. return $errors; } if ($this->options['exposed'] && !$this->options['expose']['required'] && empty($this->value)) { - // Don't validate if the field is exposed and no default value is provided. + // Don't validate if the field is exposed and no default value is + // provided. return $errors; } diff --git a/core/modules/views/src/Plugin/views/join/JoinPluginBase.php b/core/modules/views/src/Plugin/views/join/JoinPluginBase.php index f2b61f306c0..db329710cb7 100644 --- a/core/modules/views/src/Plugin/views/join/JoinPluginBase.php +++ b/core/modules/views/src/Plugin/views/join/JoinPluginBase.php @@ -306,7 +306,8 @@ class JoinPluginBase extends PluginBase implements JoinPluginInterface { $left_field = $this->leftFormula ?: "$left_table[alias].$this->leftField"; } else { - // This can be used if left_field is a formula or something. It should be used only *very* rarely. + // This can be used if left_field is a formula or something. It should be + // used only *very* rarely. $left_field = $this->leftField; $left_table = NULL; } diff --git a/core/modules/views/src/Plugin/views/pager/None.php b/core/modules/views/src/Plugin/views/pager/None.php index 3b9cd80954c..d593c6a47d7 100644 --- a/core/modules/views/src/Plugin/views/pager/None.php +++ b/core/modules/views/src/Plugin/views/pager/None.php @@ -90,7 +90,8 @@ class None extends PagerPluginBase { * {@inheritdoc} */ public function executeCountQuery(&$count_query) { - // If we are displaying all items, never count. But we can update the count in post_execute. + // If we are displaying all items, never count. But we can update the count + // in post_execute. } /** diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php index 9e6d548c68e..20e19439ffc 100644 --- a/core/modules/views/src/Plugin/views/query/Sql.php +++ b/core/modules/views/src/Plugin/views/query/Sql.php @@ -536,8 +536,8 @@ class Sql extends QueryPluginBase { } } - // Check this again to make sure we don't blow up existing aliases for already - // adjusted joins. + // Check this again to make sure we don't blow up existing aliases for + // already adjusted joins. if (isset($this->tableQueue[$alias])) { return $alias; } @@ -630,9 +630,9 @@ class Sql extends QueryPluginBase { } // If the relationship is the primary table, this actually be a relationship - // link back from an alias. We store all aliases along with the primary table - // to detect this state, because eventually it'll hit a table we already - // have and that's when we want to stop. + // link back from an alias. We store all aliases along with the primary + // table to detect this state, because eventually it'll hit a table we + // already have and that's when we want to stop. if ($relationship == $this->view->storage->get('base_table') && !empty($this->tables[$relationship][$table])) { return $this->tables[$relationship][$table]['alias']; } @@ -780,7 +780,8 @@ class Sql extends QueryPluginBase { $this->ensureTable($join->leftTable, $relationship); } - // First, if this is our link point/anchor table, just use the relationship + // First, if this is our link point/anchor table, just use the + // relationship if ($join->leftTable == $this->relationships[$relationship]['table']) { $join->leftTable = $relationship; } @@ -1337,10 +1338,9 @@ class Sql extends QueryPluginBase { $distinct = TRUE; } - /** - * An optimized count query includes just the base field instead of all the fields. - * Determine of this query qualifies by checking for a groupby or distinct. - */ + // An optimized count query includes just the base field instead of all the + // fields. Determine of this query qualifies by checking for a groupby or + // distinct. if ($get_count && !$this->groupby) { foreach ($this->fields as $field) { if (!empty($field['distinct']) || !empty($field['function'])) { @@ -1563,7 +1563,8 @@ class Sql extends QueryPluginBase { $view->pager->preExecute($query); if (!empty($this->limit) || !empty($this->offset)) { - // We can't have an offset without a limit, so provide a very large limit instead. + // We can't have an offset without a limit, so provide a very large + // limit instead. $limit = intval(!empty($this->limit) ? $this->limit : 999999); $offset = intval(!empty($this->offset) ? $this->offset : 0); $query->range($offset, $limit); diff --git a/core/modules/views/src/Plugin/views/style/StylePluginBase.php b/core/modules/views/src/Plugin/views/style/StylePluginBase.php index 623dd773999..a6a37013c1b 100644 --- a/core/modules/views/src/Plugin/views/style/StylePluginBase.php +++ b/core/modules/views/src/Plugin/views/style/StylePluginBase.php @@ -288,9 +288,9 @@ abstract class StylePluginBase extends PluginBase { */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); - // Only fields-based views can handle grouping. Style plugins can also exclude - // themselves from being groupable by setting their "usesGrouping" property - // to FALSE. + // Only fields-based views can handle grouping. Style plugins can also + // exclude themselves from being groupable by setting their "usesGrouping" + // property to FALSE. // @todo Document "usesGrouping" in docs.php when docs.php is written. if ($this->usesFields() && $this->usesGrouping()) { $options = ['' => $this->t('- None -')]; @@ -622,10 +622,12 @@ abstract class StylePluginBase extends PluginBase { $set[$grouping]['rows'] = []; } - // Move the set reference into the row set of the group we just determined. + // Move the set reference into the row set of the group we just + // determined. $set = &$set[$grouping]['rows']; } - // Add the row to the hierarchically positioned row set we just determined. + // Add the row to the hierarchically positioned row set we just + // determined. $set[$index] = $row; } } diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php index 048d6c8fb13..f3e529e0957 100644 --- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php @@ -547,15 +547,15 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface { if (!empty($user_input)) { $key_exists = NULL; $submitted = NestedArray::getValue($user_input, $parents, $key_exists); - // Check that the user-submitted value is one of the allowed options before - // returning it. This is not a substitute for actual form validation; - // rather it is necessary because, for example, the same select element - // might have #options A, B, and C under one set of conditions but #options - // D, E, F under a different set of conditions. So the form submission - // might have occurred with option A selected, but when the form is rebuilt - // option A is no longer one of the choices. In that case, we don't want to - // use the value that was submitted anymore but rather fall back to the - // default value. + // Check that the user-submitted value is one of the allowed options + // before returning it. This is not a substitute for actual form + // validation; rather it is necessary because, for example, the same + // select element might have #options A, B, and C under one set of + // conditions but #options D, E, F under a different set of conditions. So + // the form submission might have occurred with option A selected, but + // when the form is rebuilt option A is no longer one of the choices. In + // that case, we don't want to use the value that was submitted anymore + // but rather fall back to the default value. if ($key_exists && in_array($submitted, array_keys($element['#options']))) { return $submitted; } @@ -628,7 +628,8 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface { \Drupal::moduleHandler()->loadInclude('views_ui', 'inc', 'admin'); $bundles = $this->bundleInfoService->getBundleInfo($this->entityTypeId); - // If the current base table support bundles and has more than one (like user). + // If the current base table support bundles and has more than one (like + // user). if (!empty($bundles) && $this->entityType && $this->entityType->hasKey('bundle')) { // Get all bundles and their human readable names. $options = ['all' => $this->t('All')]; diff --git a/core/modules/views/src/Tests/ViewResultAssertionTrait.php b/core/modules/views/src/Tests/ViewResultAssertionTrait.php index 1aeabc447c8..a826742e289 100644 --- a/core/modules/views/src/Tests/ViewResultAssertionTrait.php +++ b/core/modules/views/src/Tests/ViewResultAssertionTrait.php @@ -101,7 +101,8 @@ trait ViewResultAssertionTrait { foreach ($expected_result as $key => $value) { $row = []; foreach ($column_map as $expected_column) { - // The comparison will be done on the string representation of the value. + // The comparison will be done on the string representation of the + // value. if (is_object($value)) { $row[$expected_column] = (string) $value->$expected_column; } diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index 87739a90c96..55e3a8d9145 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -1298,7 +1298,8 @@ class ViewExecutable { $this->exposed_widgets = $exposed_form->renderExposedForm(); if (!empty($this->build_info['abort'])) { $this->built = TRUE; - // Don't execute the query, $form_state, but rendering will still be executed to display the empty text. + // Don't execute the query, $form_state, but rendering will still be + // executed to display the empty text. $this->executed = TRUE; return empty($this->build_info['fail']); } @@ -1457,7 +1458,8 @@ class ViewExecutable { return TRUE; } - // Don't allow to use deactivated displays, but display them on the live preview. + // Don't allow to use deactivated displays, but display them on the live + // preview. if (!$this->display_handler->isEnabled() && empty($this->live_preview)) { $this->build_info['fail'] = TRUE; return FALSE; diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php index f8e096a57c7..deab0ca46fa 100644 --- a/core/modules/views/src/Views.php +++ b/core/modules/views/src/Views.php @@ -331,8 +331,8 @@ class Views { $exclude_view_display = $exclude_view->current_display; } else { - // Append a ':' to the $exclude_view string so we always have more than one - // item to explode. + // Append a ':' to the $exclude_view string so we always have more than + // one item to explode. [$exclude_view_name, $exclude_view_display] = explode(':', "$exclude_view:"); } diff --git a/core/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php b/core/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php index b47dfc716bd..c0287106b84 100644 --- a/core/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php +++ b/core/modules/views/tests/modules/views_test_config/src/Hook/ViewsTestConfigHooks.php @@ -34,8 +34,9 @@ class ViewsTestConfigHooks { public function viewsPostRender(ViewExecutable $view, &$output, CachePluginBase $cache): void { if (\Drupal::state()->get('views_test_config.views_post_render_cache_tag')) { \Drupal::state()->set('views_test_config.views_post_render_called', TRUE); - // Set a cache key on output to ensure ViewsSelection::stripAdminAndAnchorTagsFromResults - // correctly handles elements that aren't result rows. + // Set a cache key on output to ensure + // ViewsSelection::stripAdminAndAnchorTagsFromResults correctly handles + // elements that aren't result rows. $output['#cache']['tags'][] = 'foo'; } } diff --git a/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php b/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php index fc1477bf937..08db9d9c7f8 100644 --- a/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php +++ b/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php @@ -90,8 +90,9 @@ class FieldEntityOperationsTest extends ViewTestBase { // test would by default point to the frontpage. $operation['url']->setOption('query', ['destination' => $expected_destination]); $this->assertSession()->elementsCount('xpath', "//ul[contains(@class, dropbutton)]/li/a[@href='{$operation['url']->toString()}' and text()='{$operation['title']}']", 1); - // Entities which were created in Hungarian should link to the Hungarian - // edit form, others to the English one (which has no path prefix here). + // Entities which were created in Hungarian should link to the + // Hungarian edit form, others to the English one (which has no path + // prefix here). $base_path = \Drupal::request()->getBasePath(); $parts = explode('/', str_replace($base_path, '', $operation['url']->toString())); $expected_prefix = ($language->getId() != 'en' ? $language->getId() : 'node'); diff --git a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php index 015d46a20a9..72fd5a0cd29 100644 --- a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php +++ b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php @@ -437,7 +437,8 @@ class FieldWebTest extends ViewTestBase { // Tests the element wrapper classes/element. $random_class = $this->randomMachineName(); - // Set some common wrapper element types and see whether they appear with and without a custom class set. + // Set some common wrapper element types and see whether they appear with + // and without a custom class set. foreach (['h1', 'span', 'p', 'div'] as $element_type) { $id_field->options['element_wrapper_type'] = $element_type; @@ -457,7 +458,8 @@ class FieldWebTest extends ViewTestBase { // Tests the label class/element. - // Set some common label element types and see whether they appear with and without a custom class set. + // Set some common label element types and see whether they appear with and + // without a custom class set. foreach (['h1', 'span', 'p', 'div'] as $element_type) { $id_field->options['element_label_type'] = $element_type; @@ -477,7 +479,8 @@ class FieldWebTest extends ViewTestBase { // Tests the element classes/element. - // Set some common element types and see whether they appear with and without a custom class set. + // Set some common element types and see whether they appear with and + // without a custom class set. foreach (['h1', 'span', 'p', 'div'] as $element_type) { $id_field->options['element_type'] = $element_type; diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php index 4a142e2ded9..7b5b1a8fd7b 100644 --- a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php @@ -197,7 +197,8 @@ class DisplayTest extends ViewTestBase { $errors = $view->validate(); $this->assertEmpty($errors, 'More link validation has no errors.'); - // Confirm that the view does not validate when the page display is disabled. + // Confirm that the view does not validate when the page display is + // disabled. $view->setDisplay('page_1'); $view->display_handler->setOption('enabled', FALSE); $view->setDisplay('default'); @@ -205,7 +206,8 @@ class DisplayTest extends ViewTestBase { $this->assertNotEmpty($errors, 'More link validation has some errors.'); $this->assertEquals('Display "Default" uses a "more" link but there are no displays it can link to. You need to specify a custom URL.', $errors['default'][0], 'More link validation has the right error.'); - // Confirm that the view does not validate when the page display does not exist. + // Confirm that the view does not validate when the page display does not + // exist. $view = Views::getView('test_view'); $view->setDisplay('default'); $view->display_handler->setOption('use_more', 1); diff --git a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php index 17b7436ff32..8852c9e7be4 100644 --- a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php @@ -173,7 +173,8 @@ class MiniPagerTest extends ViewTestBase { $this->assertEquals('h3', $this->assertSession()->elementExists('css', ".pager .visually-hidden")->getTagName()); } - // The core views template and Stable9 use a different class structure than other core themes. + // The core views template and Stable9 use a different class structure than + // other core themes. $themes = ['stark', 'stable9']; $this->container->get('theme_installer')->install($themes); foreach ($themes as $theme) { diff --git a/core/modules/views/tests/src/Functional/Plugin/PagerTest.php b/core/modules/views/tests/src/Functional/Plugin/PagerTest.php index bfa91aade6b..cbdc4e5b992 100644 --- a/core/modules/views/tests/src/Functional/Plugin/PagerTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/PagerTest.php @@ -190,7 +190,8 @@ class PagerTest extends ViewTestBase { $this->drupalGet('admin/structure/views/view/test_store_pager_settings/edit/page_1'); $this->assertSession()->pageTextContains('20 items'); - // Test that the override element is only displayed on pager plugin selection form. + // Test that the override element is only displayed on pager plugin + // selection form. $this->drupalGet('admin/structure/views/nojs/display/test_store_pager_settings/page_1/pager'); $this->assertSession()->fieldValueEquals('override[dropdown]', 'page_1'); $this->drupalGet('admin/structure/views/nojs/display/test_store_pager_settings/page_1/pager_options'); @@ -222,7 +223,8 @@ class PagerTest extends ViewTestBase { */ public function testNoLimit(): void { // Create 11 nodes and make sure that everyone is returned. - // We create 11 nodes, because the default pager plugin had 10 items per page. + // We create 11 nodes, because the default pager plugin had 10 items per + // page. $this->drupalCreateContentType(['type' => 'page']); for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); @@ -269,7 +271,8 @@ class PagerTest extends ViewTestBase { */ public function testLimit(): void { // Create 11 nodes and make sure that everyone is returned. - // We create 11 nodes, because the default pager plugin had 10 items per page. + // We create 11 nodes, because the default pager plugin had 10 items per + // page. $this->drupalCreateContentType(['type' => 'page']); for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); @@ -303,7 +306,8 @@ class PagerTest extends ViewTestBase { */ public function testNormalPager(): void { // Create 11 nodes and make sure that everyone is returned. - // We create 11 nodes, because the default pager plugin had 10 items per page. + // We create 11 nodes, because the default pager plugin had 10 items per + // page. $this->drupalCreateContentType(['type' => 'page']); for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); @@ -415,7 +419,8 @@ class PagerTest extends ViewTestBase { */ public function testRenderNullPager(): void { // Create 11 nodes and make sure that everyone is returned. - // We create 11 nodes, because the default pager plugin had 10 items per page. + // We create 11 nodes, because the default pager plugin had 10 items per + // page. $this->drupalCreateContentType(['type' => 'page']); for ($i = 0; $i < 11; $i++) { $this->drupalCreateNode(); diff --git a/core/modules/views/tests/src/Functional/ViewTestBase.php b/core/modules/views/tests/src/Functional/ViewTestBase.php index 000f2e345c6..b2946116727 100644 --- a/core/modules/views/tests/src/Functional/ViewTestBase.php +++ b/core/modules/views/tests/src/Functional/ViewTestBase.php @@ -53,7 +53,8 @@ abstract class ViewTestBase extends BrowserTestBase { * using it, it cannot be enabled normally. */ protected function enableViewsTestModule() { - // Define the schema and views data variable before enabling the test module. + // Define the schema and views data variable before enabling the test + // module. \Drupal::state()->set('views_test_data_schema', $this->schemaDefinition()); \Drupal::state()->set('views_test_data_views_data', $this->viewsData()); diff --git a/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php b/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php index b3efccbcae7..c9b2b6063c2 100644 --- a/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php +++ b/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php @@ -575,7 +575,8 @@ class EntityViewsDataTest extends KernelTestBase { // table. $this->assertFalse(isset($data['entity_test_mulrev_revision']['revision_id'])); - // Also ensure that field_data only fields don't appear on the revision table. + // Also ensure that field_data only fields don't appear on the revision + // table. $this->assertFalse(isset($data['entity_test_mulrev_revision']['id'])); $this->assertFalse(isset($data['entity_test_mulrev_revision']['name'])); $this->assertFalse(isset($data['entity_test_mulrev_revision']['description'])); diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php index 423b01625c6..b8a0d79bee5 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php @@ -532,7 +532,8 @@ class FieldKernelTest extends ViewsKernelTestBase { }); $this->assertSame($random_name, (string) $render, 'If the rewritten string is not empty, "0" should not be treated as empty.'); - // Test when results are rewritten to an empty string and non-zero empty results are hidden. + // Test when results are rewritten to an empty string and non-zero empty + // results are hidden. $view->field['name']->options['hide_alter_empty'] = TRUE; $view->field['name']->options['hide_empty'] = TRUE; $view->field['name']->options['empty_zero'] = FALSE; diff --git a/core/modules/views/tests/src/Kernel/Handler/SortRandomTest.php b/core/modules/views/tests/src/Kernel/Handler/SortRandomTest.php index 11456d921bf..a1bf2c730b3 100644 --- a/core/modules/views/tests/src/Kernel/Handler/SortRandomTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/SortRandomTest.php @@ -92,7 +92,8 @@ class SortRandomTest extends ViewsKernelTestBase { 'views_test_data_age' => 'views_test_data_name', ]); - // Execute a second random view, we expect the result set to be different again. + // Execute a second random view, we expect the result set to be different + // again. $view_random_2 = $this->getBasicRandomView(); $this->executeView($view_random_2); $this->assertSameSize($this->dataSet(), $view_random_2->result, 'The number of returned rows match.'); diff --git a/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php b/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php index c00afd1de52..146c39206ee 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php @@ -263,8 +263,8 @@ class CacheTest extends ViewsKernelTestBase { */ public function testHeaderStorage(): void { // Create a view with output caching enabled. - // Some hook_views_pre_render in views_test_data.module adds the test css/js file. - // so they should be added to the css/js storage. + // Some hook_views_pre_render in views_test_data.module adds the test css/js + // file. so they should be added to the css/js storage. $view = Views::getView('test_view'); $view->setDisplay(); $view->storage->set('id', 'test_cache_header_storage'); diff --git a/core/modules/views/tests/src/Kernel/ViewStorageTest.php b/core/modules/views/tests/src/Kernel/ViewStorageTest.php index ef1db569f0e..4f7eed048a8 100644 --- a/core/modules/views/tests/src/Kernel/ViewStorageTest.php +++ b/core/modules/views/tests/src/Kernel/ViewStorageTest.php @@ -311,8 +311,8 @@ class ViewStorageTest extends ViewsKernelTestBase { // Check that the original view and the copy have different UUIDs. $this->assertNotSame($view->storage->uuid(), $copy->uuid(), 'The copied view has a new UUID.'); - // Check the 'name' (ID) is using the View objects default value (NULL) as it - // gets unset. + // Check the 'name' (ID) is using the View objects default value (NULL) as + // it gets unset. $this->assertNull($copy->id(), 'The ID has been reset.'); // Check the other properties. diff --git a/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php b/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php index bcbc2d63f9b..5fef2e3e045 100644 --- a/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php +++ b/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php @@ -68,7 +68,8 @@ abstract class ViewsKernelTestBase extends KernelTestBase { /** @var \Drupal\Core\State\StateInterface $state */ $state = $this->container->get('state'); - // Define the schema and views data variable before enabling the test module. + // Define the schema and views data variable before enabling the test + // module. $state->set('views_test_data_schema', $this->schemaDefinition()); $state->set('views_test_data_views_data', $this->viewsData()); $this->container->get('views.views_data')->clear(); diff --git a/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php b/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php index d2791fabad1..60fe57f69a3 100644 --- a/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php @@ -198,8 +198,8 @@ class EntityTest extends UnitTestCase { * @covers ::calculateDependencies */ public function testCalculateDependencies(): void { - // Create an entity type manager, storage, entity type, and entity to mock the - // loading of entities providing bundles. + // Create an entity type manager, storage, entity type, and entity to mock + // the loading of entities providing bundles. $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class); $storage = $this->createMock('Drupal\Core\Entity\EntityStorageInterface'); $entity_type = $this->createMock('Drupal\Core\Entity\EntityTypeInterface'); diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php index 33c72113420..cb62e66c32a 100644 --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -726,7 +726,8 @@ function hook_views_form_substitutions() { */ function hook_views_pre_view(ViewExecutable $view, $display_id, array &$args) { - // Modify contextual filters for my_special_view if user has 'my special permission'. + // Modify contextual filters for my_special_view if user has + // 'my special permission'. $account = \Drupal::currentUser(); if ($view->id() == 'my_special_view' && $account->hasPermission('my special permission') && $display_id == 'public_display') { diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 72014e80392..8336a5123c3 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -419,7 +419,8 @@ function template_preprocess_views_view_table(&$variables): void { // We need the raw data for this grouping, which is passed in // as $variables['rows']. // However, the template also needs to use for the rendered fields. We - // therefore swap the raw data out to a new variable and reset $variables['rows'] + // therefore swap the raw data out to a new variable and reset + // $variables['rows'] // so that it can get rebuilt. // Store rows so that they may be used by further preprocess functions. $result = $variables['result'] = $variables['rows']; diff --git a/core/modules/views_ui/src/Form/Ajax/AddHandler.php b/core/modules/views_ui/src/Form/Ajax/AddHandler.php index 8b53772e8c0..2f5c9590bc2 100644 --- a/core/modules/views_ui/src/Form/Ajax/AddHandler.php +++ b/core/modules/views_ui/src/Form/Ajax/AddHandler.php @@ -79,7 +79,8 @@ class AddHandler extends ViewsFormBase { // Add the display override dropdown. views_ui_standard_display_dropdown($form, $form_state, $section); - // Figure out all the base tables allowed based upon what the relationships provide. + // Figure out all the base tables allowed based upon what the relationships + // provide. $base_tables = $executable->getBaseTables(); $options = Views::viewsDataHelper()->fetchFields(array_keys($base_tables), $type, $display->useGroupBy(), $form_state->get('type')); diff --git a/core/modules/views_ui/src/Form/Ajax/Display.php b/core/modules/views_ui/src/Form/Ajax/Display.php index 3f75a306b1f..0ef3e962d78 100644 --- a/core/modules/views_ui/src/Form/Ajax/Display.php +++ b/core/modules/views_ui/src/Form/Ajax/Display.php @@ -73,8 +73,8 @@ class Display extends ViewsFormBase { ]; $executable->display_handler->buildOptionsForm($form['options'], $form_state); - // The handler options form sets $form['#title'], which we need on the entire - // $form instead of just the ['options'] section. + // The handler options form sets $form['#title'], which we need on the + // entire $form instead of just the ['options'] section. $form['#title'] = $form['options']['#title']; unset($form['options']['#title']); diff --git a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php index 2ed4682f686..92d06d87621 100644 --- a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php +++ b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php @@ -103,8 +103,8 @@ abstract class ViewsFormBase extends FormBase implements ViewsFormInterface { // now irrelevant. if (!empty($view->stack)) { $identifier = implode('-', array_filter([$form_key, $view->id(), $display_id, $form_state->get('type'), $form_state->get('id')])); - // Retrieve the first form from the stack without changing the integer keys, - // as they're being used for the "2 of 3" progress indicator. + // Retrieve the first form from the stack without changing the integer + // keys, as they're being used for the "2 of 3" progress indicator. reset($view->stack); $stack_key = key($view->stack); $top = current($view->stack); @@ -150,7 +150,8 @@ abstract class ViewsFormBase extends FormBase implements ViewsFormInterface { $response = $this->ajaxFormWrapper($form_class, $form_state); } elseif (!$form_state->get('ajax')) { - // If nothing on the stack, non-js forms just go back to the main view editor. + // If nothing on the stack, non-js forms just go back to the main view + // editor. $display_id = $form_state->get('display_id'); return new RedirectResponse(Url::fromRoute('entity.view.edit_display_form', ['view' => $view->id(), 'display_id' => $display_id], ['absolute' => TRUE])->toString()); } diff --git a/core/modules/views_ui/src/Hook/ViewsUiHooks.php b/core/modules/views_ui/src/Hook/ViewsUiHooks.php index 99e925364b2..88a3e363c16 100644 --- a/core/modules/views_ui/src/Hook/ViewsUiHooks.php +++ b/core/modules/views_ui/src/Hook/ViewsUiHooks.php @@ -138,8 +138,8 @@ class ViewsUiHooks { ], 'file' => 'views_ui.theme.inc', ], - // Generic container wrapper, to use instead of theme_container when an id - // is not desired. + // Generic container wrapper, to use instead of theme_container when an id + // is not desired. 'views_ui_container' => [ 'variables' => [ 'children' => NULL, diff --git a/core/modules/views_ui/src/ViewAddForm.php b/core/modules/views_ui/src/ViewAddForm.php index 2d9cdf34ce1..fac72308558 100644 --- a/core/modules/views_ui/src/ViewAddForm.php +++ b/core/modules/views_ui/src/ViewAddForm.php @@ -140,8 +140,8 @@ class ViewAddForm extends ViewFormBase { $show_form = &$form['displays']['show']; $default_value = $this->moduleHandler->moduleExists('node') ? 'node' : 'users'; $show_form['wizard_key']['#default_value'] = WizardPluginBase::getSelected($form_state, ['show', 'wizard_key'], $default_value, $show_form['wizard_key']); - // Changing this dropdown updates the entire content of $form['displays'] via - // AJAX. + // Changing this dropdown updates the entire content of $form['displays'] + // via AJAX. views_ui_add_ajax_trigger($show_form, 'wizard_key', ['displays']); // Build the rest of the form based on the currently selected wizard plugin. diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php index 0ce218d6b5c..e112480de1d 100644 --- a/core/modules/views_ui/src/ViewEditForm.php +++ b/core/modules/views_ui/src/ViewEditForm.php @@ -116,8 +116,8 @@ class ViewEditForm extends ViewFormBase { /** @var \Drupal\views_ui\ViewUI $view */ $view = $this->entity; $display_id = $this->displayID; - // Do not allow the form to be cached, because $form_state->get('view') can become - // stale between page requests. + // Do not allow the form to be cached, because $form_state->get('view') can + // become stale between page requests. // See views_ui_ajax_get_form() for how this affects #ajax. // @todo To remove this and allow the form to be cacheable: // - Change $form_state->get('view') to @@ -311,13 +311,15 @@ class ViewEditForm extends ViewFormBase { $displays[$new_id] = $displays[$id]; unset($displays[$id]); - // Redirect the user to the renamed display to be sure that the page itself exists and doesn't throw errors. + // Redirect the user to the renamed display to be sure that the page + // itself exists and doesn't throw errors. $form_state->setRedirect('entity.view.edit_display_form', [ 'view' => $view->id(), 'display_id' => $new_id, ]); - // Find attachments attached to old display id and attach them with new id. + // Find attachments attached to old display id and attach them with new + // id. if ($attachments) { foreach ($attachments as $attachment) { $attached_options = $executable->displayHandlers->get($attachment)->getOption('displays'); @@ -338,7 +340,8 @@ class ViewEditForm extends ViewFormBase { $destination = $query->get('destination'); if (!empty($destination)) { - // Find out the first display which has a changed path and redirect to this URL. + // Find out the first display which has a changed path and redirect to + // this URL. $old_view = Views::getView($view->id()); $old_view->initDisplay(); foreach ($old_view->displayHandlers as $id => $display) { @@ -588,11 +591,12 @@ class ViewEditForm extends ViewFormBase { // Collapse the details by default. $build['columns']['third']['#open'] = \Drupal::config('views.settings')->get('ui.show.advanced_column'); - // Each option (e.g. title, access, display as grid/table/list) fits into one - // of several "buckets," or boxes (Format, Fields, Sort, and so on). + // Each option (e.g. title, access, display as grid/table/list) fits into + // one of several "buckets," or boxes (Format, Fields, Sort, and so on). $buckets = []; - // Fetch options from the display plugin, with a list of buckets they go into. + // Fetch options from the display plugin, with a list of buckets they go + // into. $options = []; $view->getExecutable()->displayHandlers->get($display['id'])->optionsSummary($buckets, $options); @@ -608,8 +612,8 @@ class ViewEditForm extends ViewFormBase { if (isset($bucket['column']) && isset($build['columns'][$bucket['column']])) { $column = $bucket['column']; } - // If a bucket doesn't pick one of our predefined columns to belong to, put - // it in the last one. + // If a bucket doesn't pick one of our predefined columns to belong to, + // put it in the last one. else { $column = 'third'; } @@ -734,7 +738,8 @@ class ViewEditForm extends ViewFormBase { $build = $this->getDisplayTab($view); $response->addCommand(new HtmlCommand('#views-tab-' . $display_id, $build)); - // Regenerate the top area so changes to display names and order will appear. + // Regenerate the top area so changes to display names and order will + // appear. $build = $this->renderDisplayTop($view); $response->addCommand(new ReplaceCommand('#views-display-top', $build)); } @@ -824,8 +829,8 @@ class ViewEditForm extends ViewFormBase { 'class' => ['add-display'], 'data-drupal-dropdown-label' => $label, ], - // Allow JavaScript to remove the 'Add ' prefix from the button label when - // placing the button in an "Add" dropdown menu. + // Allow JavaScript to remove the 'Add ' prefix from the button label + // when placing the button in an "Add" dropdown menu. '#process' => array_merge(['views_ui_form_button_was_clicked'], $this->elementInfo->getInfoProperty('submit', '#process', [])), '#values' => [$this->t('Add @display', ['@display' => $label]), $label], ]; @@ -1194,7 +1199,8 @@ class ViewEditForm extends ViewFormBase { } } - // If using grouping, re-order fields so that they show up properly in the list. + // If using grouping, re-order fields so that they show up properly in the + // list. if ($type == 'filter' && $grouping) { $store = $build['fields']; $build['fields'] = []; diff --git a/core/modules/views_ui/src/ViewFormBase.php b/core/modules/views_ui/src/ViewFormBase.php index ae94c023d08..e76e76804aa 100644 --- a/core/modules/views_ui/src/ViewFormBase.php +++ b/core/modules/views_ui/src/ViewFormBase.php @@ -120,7 +120,8 @@ abstract class ViewFormBase extends EntityForm { } } - // If the default display isn't supposed to be shown, don't display its tab, unless it's the only display. + // If the default display isn't supposed to be shown, don't display its tab, + // unless it's the only display. if ((!$this->isDefaultDisplayShown($view) && $display_id != 'default') && count($tabs) > 1) { $tabs['default']['#access'] = FALSE; } @@ -146,8 +147,8 @@ abstract class ViewFormBase extends EntityForm { public function isDefaultDisplayShown(ViewUI $view) { // Always show the default display for advanced users who prefer that mode. $advanced_mode = \Drupal::config('views.settings')->get('ui.show.default_display'); - // For other users, show the default display only if there are no others, and - // hide it if there's at least one "real" display. + // For other users, show the default display only if there are no others, + // and hide it if there's at least one "real" display. $additional_displays = (count($view->getExecutable()->displayHandlers) == 1); return $advanced_mode || $additional_displays; diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 46842e0a85f..c8606eb098f 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -231,15 +231,16 @@ class ViewUI implements ViewEntityInterface { [$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. + // Based on the user's choice in the display dropdown, determine which + // display these changes apply to. $display_id = $form_state->get('display_id'); if ($revert) { // If it's revert just change the override and return. $display = &$this->getExecutable()->displayHandlers->get($display_id); $display->optionsOverride($form, $form_state); - // Don't execute the normal submit handling but still store the changed view into cache. + // Don't execute the normal submit handling but still store the changed + // view into cache. $this->cacheSet(); return; } @@ -347,7 +348,8 @@ class ViewUI implements ViewEntityInterface { ]; // Compatibility, to be removed later: // TODO: When is "later"? - // We used to set these items on the form, but now we want them on the $form_state: + // We used to set these items on the form, but now we want them on the + // $form_state: if (isset($form['#title'])) { $form_state->set('title', $form['#title']); } @@ -364,8 +366,9 @@ class ViewUI implements ViewEntityInterface { public function getOverrideValues($form, FormStateInterface $form_state) { // Make sure the dropdown exists in the first place. if ($form_state->hasValue(['override', 'dropdown'])) { - // #default_value is used to determine whether it was the default value or not. - // So the available options are: $display, 'default' and 'default_revert', not 'defaults'. + // #default_value is used to determine whether it was the default value or + // not. So the available options are: $display, 'default' and + // 'default_revert', not 'defaults'. $was_defaulted = ($form['override']['dropdown']['#default_value'] === 'defaults'); $dropdown = $form_state->getValue(['override', 'dropdown']); $is_defaulted = ($dropdown === 'default'); @@ -404,8 +407,8 @@ class ViewUI implements ViewEntityInterface { $stack = [implode('-', array_filter([$key, $this->id(), $display_id, $type, $id])), $key, $display_id, $type, $id]; // If we're being asked to add this form to the bottom of the stack, no - // special logic is required. Our work is equally easy if we were asked to add - // to the top of the stack, but there's nothing in it yet. + // special logic is required. Our work is equally easy if we were asked to + // add to the top of the stack, but there's nothing in it yet. if (!$top || empty($this->stack)) { $this->stack[] = $stack; } @@ -464,7 +467,8 @@ class ViewUI implements ViewEntityInterface { } 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. + // 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) { [$table, $field] = explode('.', $field, 2); @@ -475,7 +479,8 @@ class ViewUI implements ViewEntityInterface { // Check to see if we have group by settings $key = $type; - // Footer,header and empty text have a different internal handler type(area). + // Footer,header and empty text have a different internal handler + // type(area). if (isset($types[$type]['type'])) { $key = $types[$type]['type']; } @@ -488,7 +493,8 @@ class ViewUI implements ViewEntityInterface { $this->addFormToStack('handler-group', $display_id, $type, $id); } - // Check to see if this type has settings, if so add the settings form first + // Check to see if this type has settings, if so add the settings form + // first if ($handler && $handler->hasExtraOptions()) { $this->addFormToStack('handler-extra', $display_id, $type, $id); } @@ -529,7 +535,8 @@ class ViewUI implements ViewEntityInterface { } public function renderPreview($display_id, $args = []) { - // Save the current path so it can be restored before returning from this function. + // Save the current path so it can be restored before returning from this + // function. $request_stack = \Drupal::requestStack(); $current_request = $request_stack->getCurrentRequest(); $executable = $this->getExecutable(); diff --git a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php index 60a6837b1f9..46e8668282a 100644 --- a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php +++ b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php @@ -96,7 +96,8 @@ class DefaultViewsTest extends UITestBase { // $this->drupalGet('glossary'); // $this->assertSession()->pageTextNotContains($new_title); - // Duplicate the view and check that the normal schema of duplicated views is used. + // Duplicate the view and check that the normal schema of duplicated views + // is used. $this->drupalGet('admin/structure/views'); $this->clickViewsOperationLink('Duplicate', '/glossary'); $edit = [ diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php index 0c1db384547..93d3a3006d4 100644 --- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php +++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php @@ -139,7 +139,8 @@ class HandlerTest extends UITestBase { // Test that the handler edit link has the right label. $this->assertSession()->elementExists('xpath', "//a[starts-with(normalize-space(text()), '{$random_label}')]"); - // Save the view and have a look whether the handler was added as expected. + // Save the view and have a look whether the handler was added as + // expected. $this->submitForm([], 'Save'); $view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view_empty'); $display = $view->getDisplay('default'); diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php index b759976d714..c1b53b9765e 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php @@ -67,7 +67,8 @@ class PreviewTest extends WebDriverTestBase { * using it, it cannot be enabled normally. */ protected function enableViewsTestModule(): void { - // Define the schema and views data variable before enabling the test module. + // Define the schema and views data variable before enabling the test + // module. \Drupal::state()->set('views_test_data_schema', $this->schemaDefinition()); \Drupal::state()->set('views_test_data_views_data', $this->viewsData()); diff --git a/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php b/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php index d5fea2ab2cd..788d5ad1c15 100644 --- a/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php +++ b/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php @@ -32,11 +32,11 @@ class ViewUIObjectTest extends UnitTestCase { foreach ($reflection->getMethods() as $reflection_method) { $interface_methods[] = $reflection_method->getName(); - // EntityInterface::isNew() is missing from the list of methods, because it - // calls id(), which breaks the ->expect($this->once()) call. Call it later. - // EntityInterface::isSyncing() is only called during syncing process. - // EntityInterface::isUninstalling() is only called during uninstallation - // process. EntityInterface::getConfigDependencyName() and + // EntityInterface::isNew() is missing from the list of methods, because + // it calls id(), which breaks the ->expect($this->once()) call. Call it + // later. EntityInterface::isSyncing() is only called during syncing + // process. EntityInterface::isUninstalling() is only called during + // uninstallation process. EntityInterface::getConfigDependencyName() and // ConfigEntityInterface::calculateDependencies() are only used for // dependency management. if (!in_array($reflection_method->getName(), ['isNew', 'isSyncing', 'isUninstalling', 'getConfigDependencyKey', 'getConfigDependencyName', 'calculateDependencies'])) { diff --git a/core/modules/workspaces/src/Entity/Workspace.php b/core/modules/workspaces/src/Entity/Workspace.php index edf75c94f56..0bf89c96460 100644 --- a/core/modules/workspaces/src/Entity/Workspace.php +++ b/core/modules/workspaces/src/Entity/Workspace.php @@ -194,8 +194,8 @@ class Workspace extends ContentEntityBase implements WorkspaceInterface { // Ensure that workspace batch purging does not happen inside a workspace. $workspace_manager->executeOutsideWorkspace(function () use ($workspace_manager, $entities) { - // Add the IDs of the deleted workspaces to the list of workspaces that will - // be purged on cron. + // Add the IDs of the deleted workspaces to the list of workspaces that + // will be purged on cron. $state = \Drupal::state(); $deleted_workspace_ids = $state->get('workspace.deleted', []); $deleted_workspace_ids += array_combine(array_keys($entities), array_keys($entities)); diff --git a/core/modules/workspaces/src/Hook/ViewsOperations.php b/core/modules/workspaces/src/Hook/ViewsOperations.php index dcf86d7bf60..7937d272769 100644 --- a/core/modules/workspaces/src/Hook/ViewsOperations.php +++ b/core/modules/workspaces/src/Hook/ViewsOperations.php @@ -289,8 +289,8 @@ class ViewsOperations { // first. if (!$this->adjustedTables->offsetExists($table_queue[$alias]['join'])) { $table_queue[$alias]['join'] = $this->getRevisionTableJoin($relationship, $base_revision_table, $revision_field, $workspace_association_table, $entity_type); - // We also have to ensure that our 'workspace_association' comes before - // this. + // We also have to ensure that our 'workspace_association' comes + // before this. $this->moveEntityTable($query, $workspace_association_table, $alias); } diff --git a/core/modules/workspaces/tests/src/Kernel/WorkspaceContentTranslationTest.php b/core/modules/workspaces/tests/src/Kernel/WorkspaceContentTranslationTest.php index 3aa8b9a5bab..70351c96318 100644 --- a/core/modules/workspaces/tests/src/Kernel/WorkspaceContentTranslationTest.php +++ b/core/modules/workspaces/tests/src/Kernel/WorkspaceContentTranslationTest.php @@ -70,7 +70,8 @@ class WorkspaceContentTranslationTest extends KernelTestBase { public function testTranslations(): void { $storage = $this->entityTypeManager->getStorage('entity_test_mulrevpub'); - // Create two untranslated nodes in Live, a published and an unpublished one. + // Create two untranslated nodes in Live, a published and an unpublished + // one. $entity_published = $storage->create(['name' => 'live - 1 - published', 'status' => TRUE]); $entity_published->save(); $entity_unpublished = $storage->create(['name' => 'live - 2 - unpublished', 'status' => FALSE]); diff --git a/core/modules/workspaces_ui/src/Hook/WorkspacesUiHooks.php b/core/modules/workspaces_ui/src/Hook/WorkspacesUiHooks.php index d68d4ceda67..e1c19eb1759 100644 --- a/core/modules/workspaces_ui/src/Hook/WorkspacesUiHooks.php +++ b/core/modules/workspaces_ui/src/Hook/WorkspacesUiHooks.php @@ -71,17 +71,17 @@ class WorkspacesUiHooks { '#weight' => 500, ]; - // Add a special class to the wrapper if we don't have an active workspace so - // we can highlight it with a different color. + // Add a special class to the wrapper if we don't have an active workspace + // so we can highlight it with a different color. if (!$active_workspace) { $items['workspace']['#wrapper_attributes']['class'][] = 'workspaces-toolbar-tab--is-default'; } // \Drupal\toolbar\Element\ToolbarItem::preRenderToolbarItem adds an - // #attributes property to each toolbar item's tab child automatically. - // Lazy builders don't support an #attributes property so we need to - // add another render callback to remove the #attributes property. We start by - // adding the defaults, and then we append our own pre render callback. + // #attributes property to each toolbar item's tab child automatically. Lazy + // builders don't support an #attributes property so we need to add another + // render callback to remove the #attributes property. We start by adding + // the defaults, and then we append our own pre render callback. $items['workspace'] += \Drupal::service('plugin.manager.element_info')->getInfo('toolbar_item'); $items['workspace']['#pre_render'][] = 'workspaces.lazy_builders:removeTabAttributes'; 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 ca8f2c687ed..fa29b9544f7 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 @@ -193,8 +193,8 @@ class InstallHelper implements ContainerInjectionInterface { fclose($handle); } else { - // Language directory exists, but the file in this language was not found, - // remove that language from list of languages to be translated. + // Language directory exists, but the file in this language was not + // found, remove that language from list of languages to be translated. $key = array_search($language, $translated_languages); unset($translated_languages[$key]); } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php index 8818cfa8933..ecaa0a97532 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php @@ -138,7 +138,8 @@ class JavascriptStatesTest extends WebDriverTestBase { $radios_checked_element = $page->findField('radios_checked_when_checkbox_trigger_checked'); $this->assertNotEmpty($radios_checked_element); - // We want to select the specific radio buttons, not the whole radios field itself. + // We want to select the specific radio buttons, not the whole radios field + // itself. $radios_all_disabled_value1 = $this->xpath('//input[@name=:name][@value=:value]', [':name' => 'radios_all_disabled_when_checkbox_trigger_checked', ':value' => 'value1']); $this->assertCount(1, $radios_all_disabled_value1); // We want to access the radio button directly for the rest of the test, so diff --git a/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php b/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php index fcaf4d70d06..4bf46e8d491 100644 --- a/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php +++ b/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php @@ -115,6 +115,7 @@ class StandardRecipeTest extends StandardTest { // Ensure we have truly rebuilt the standard profile using recipes. // Uncomment the code below to see the differences in a single file. + // phpcs:ignore Drupal.Files.LineLength // $this->assertSame($sync->read('node.settings'), $active->read('node.settings')); $comparer = $this->configImporter()->getStorageComparer(); $expected_list = $comparer->getEmptyChangelist(); diff --git a/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php b/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php index ff6ad464d9b..09ce9544c30 100644 --- a/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php +++ b/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php @@ -171,7 +171,8 @@ class TimestampTest extends BrowserTestBase { $this->drupalGet('entity_test/add'); $date_format = DateFormat::load('html_date')->getPattern(); $time_format = DateFormat::load('html_time')->getPattern(); - // Make sure the default field value is set as the default value in the widget. + // Make sure the default field value is set as the default value in the + // widget. $this->assertSession()->fieldExists('field_timestamp[0][value][date]'); $this->assertSession()->fieldValueEquals('field_timestamp[0][value][date]', $date->format($date_format)); $this->assertSession()->fieldExists('field_timestamp[0][value][time]'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectoryTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectoryTestBase.php index dfd526fd434..597f0f5b1b1 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectoryTestBase.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectoryTestBase.php @@ -67,8 +67,9 @@ abstract class InstallerConfigDirectoryTestBase extends InstallerTestBase { } if ($this->profile !== FALSE) { - // Create a profile for testing. We set core_version_requirement to '*' for - // the test so that it does not need to be updated between major versions. + // Create a profile for testing. We set core_version_requirement to '*' + // for the test so that it does not need to be updated between major + // versions. $info = [ 'type' => 'profile', 'core_version_requirement' => '*', diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php index fc820e53ab3..2ac3ae778a4 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php @@ -51,8 +51,9 @@ abstract class InstallerExistingConfigTestBase extends InstallerTestBase { } if ($this->profile !== FALSE) { - // Create a profile for testing. We set core_version_requirement to '*' for - // the test so that it does not need to be updated between major versions. + // Create a profile for testing. We set core_version_requirement to '*' + // for the test so that it does not need to be updated between major + // versions. $info = [ 'type' => 'profile', 'core_version_requirement' => '*', diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php index cf8fb43c43f..2f90be519ff 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php @@ -42,7 +42,8 @@ class InstallerNonDefaultDatabaseDriverTest extends InstallerTestBase { $this->testDriverName = 'DriverTest' . ucfirst($driver); $testDriverNamespace = "Drupal\\driver_test\\Driver\\Database\\{$this->testDriverName}"; - // Assert that we are using the database drivers from the driver_test module. + // Assert that we are using the database drivers from the driver_test + // module. $this->assertSession()->elementTextEquals('xpath', '//label[@for="edit-driver-drupaldriver-testdriverdatabasedrivertestmysql"]', 'MySQL by the driver_test module'); $this->assertSession()->elementTextEquals('xpath', '//label[@for="edit-driver-drupaldriver-testdriverdatabasedrivertestpgsql"]', 'PostgreSQL by the driver_test module'); diff --git a/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php b/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php index cd0f2473bdc..3ca62dcced5 100644 --- a/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php +++ b/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php @@ -228,7 +228,8 @@ class MappingTest extends KernelTestBase { // @see core/config/schema/core.data_types.schema.yml '_core', 'langcode', - // Keys defined locally, in `type: config_schema_deprecated_test.settings`. + // Keys defined locally, in `type: + // config_schema_deprecated_test.settings`. // @see core/modules/config/tests/config_schema_deprecated_test/config/schema/config_schema_deprecated_test.schema.yml 'complex_structure_deprecated', ], @@ -239,7 +240,8 @@ class MappingTest extends KernelTestBase { 'config_schema_deprecated_test.settings', 'complex_structure_deprecated', [ - // Keys defined locally, in `type: config_schema_deprecated_test.settings`. + // Keys defined locally, in `type: + // config_schema_deprecated_test.settings`. // @see core/modules/config/tests/config_schema_deprecated_test/config/schema/config_schema_deprecated_test.schema.yml 'type', 'products', @@ -317,7 +319,8 @@ class MappingTest extends KernelTestBase { 'label_display', 'provider', 'context_mapping', - // Keys defined locally, in `type: block.settings.system_branding_block`. + // Keys defined locally, in `type: + // block.settings.system_branding_block`. // @see core/modules/block/config/schema/block.schema.yml ...$available_block_settings_types['block.settings.system_branding_block'], ], diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php index 41ceb1fcfae..a7a5f8ad070 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php @@ -410,8 +410,9 @@ class ConfigImporterTest extends KernelTestBase { $entity_storage = \Drupal::entityTypeManager()->getStorage('config_test'); // Both entities are deleted. ConfigTest::postSave() causes updates of the - // dependency entity to delete the dependent entity. Since the dependency depends on - // the dependent, removing the dependent causes the dependency to be removed. + // dependency entity to delete the dependent entity. Since the dependency + // depends on the dependent, removing the dependent causes the dependency to + // be removed. $this->assertNull($entity_storage->load('dependency')); $this->assertNull($entity_storage->load('dependent')); $logs = $config_importer->getErrors(); @@ -433,7 +434,8 @@ class ConfigImporterTest extends KernelTestBase { 'label' => 'Dependency', 'weight' => 0, 'uuid' => $uuid->generate(), - // Add a dependency on dependent, to make sure this delete is synced first. + // Add a dependency on dependent, to make sure this delete is synced + // first. 'dependencies' => [ 'config' => [$name_dependent], ], diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php index c5da22450c0..58ceaa954de 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php @@ -38,8 +38,8 @@ class ConfigLanguageOverrideTest extends KernelTestBase { */ public function testConfigLanguageOverride(): void { // The language module implements a config factory override object that - // overrides configuration when the Language module is enabled. This test ensures that - // English overrides work. + // overrides configuration when the Language module is enabled. This test + // ensures that English overrides work. \Drupal::languageManager()->setConfigOverrideLanguage(\Drupal::languageManager()->getLanguage('en')); $config = \Drupal::config('config_test.system'); $this->assertSame('en bar', $config->get('foo')); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php index fe47ba596de..b8ab095c032 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php @@ -261,7 +261,8 @@ class ConfigSchemaTest extends KernelTestBase { // Most complex case, get metadata for actual configuration element. $effects = \Drupal::service('config.typed')->get('image.style.medium')->get('effects'); $definition = $effects->get('bddf0d06-42f9-4c75-a700-a33cafa25ea0')->get('data')->getDataDefinition()->toArray(); - // This should be the schema for image.effect.image_scale, reuse previous one. + // This should be the schema for image.effect.image_scale, reuse previous + // one. $expected['type'] = 'image.effect.image_scale'; $expected['mapping']['width']['requiredKey'] = TRUE; $expected['mapping']['height']['requiredKey'] = TRUE; @@ -288,7 +289,8 @@ class ConfigSchemaTest extends KernelTestBase { // More complex, several level deep test. $definition = \Drupal::service('config.typed')->getDefinition('config_schema_test.some_schema.some_module.section_one.subsection'); - // This should be the schema of config_schema_test.some_schema.some_module.*.*. + // This should be the schema of + // config_schema_test.some_schema.some_module.*.*. $expected = []; $expected['label'] = 'Schema multiple filesystem marker test'; $expected['class'] = Mapping::class; diff --git a/core/tests/Drupal/KernelTests/Core/Config/MailerDsnConfigValidationTest.php b/core/tests/Drupal/KernelTests/Core/Config/MailerDsnConfigValidationTest.php index 7158eda3e45..cc8cb497fe4 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/MailerDsnConfigValidationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/MailerDsnConfigValidationTest.php @@ -309,7 +309,8 @@ class MailerDsnConfigValidationTest extends KernelTestBase { // Set scheme to smtps. $data['mailer_dsn']['scheme'] = 'smtps'; - // If the options contain an invalid peer_fingerprint, it should be an error. + // If the options contain an invalid peer_fingerprint, it should be an + // error. $data['mailer_dsn']['options'] = [ 'verify_peer' => FALSE, 'peer_fingerprint' => 'BE:F7:B9:CA:0F:6E:0F:29:9B:E9:B4:64:99:35:D6:27', @@ -338,7 +339,8 @@ class MailerDsnConfigValidationTest extends KernelTestBase { ->validate(); $this->assertCount(0, $violations); - // If the options contain a local_domain with a newline, it should be an error. + // If the options contain a local_domain with a newline, it should be an + // error. $data['mailer_dsn']['options'] = ['local_domain' => "host\nwith\nnewline"]; $violations = $this->configManager->createFromNameAndData($config->getName(), $data) ->validate(); @@ -346,7 +348,8 @@ class MailerDsnConfigValidationTest extends KernelTestBase { $this->assertSame('mailer_dsn.options.local_domain', $violations[0]->getPropertyPath()); $this->assertSame('The local_domain is not allowed to span multiple lines or contain control characters.', (string) $violations[0]->getMessage()); - // If the options contain a local_domain with unexpected characters, it should be an error. + // If the options contain a local_domain with unexpected characters, it + // should be an error. $data['mailer_dsn']['options'] = ['local_domain' => "host\rwith\tcontrol-chars"]; $violations = $this->configManager->createFromNameAndData($config->getName(), $data) ->validate(); diff --git a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php index 80a04707573..2799dd9a740 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php @@ -31,7 +31,8 @@ class ConnectionTest extends DatabaseTestBase { $this->assertNotNull($db2, 'replica connection is a real connection object.'); $this->assertNotSame($db1, $db2, 'Each target refers to a different connection.'); - // Try to open those targets another time, that should return the same objects. + // Try to open those targets another time, that should return the same + // objects. $db1b = Database::getConnection('default', 'default'); $db2b = Database::getConnection('replica', 'default'); $this->assertSame($db1, $db1b, 'A second call to getConnection() returns the same object.'); @@ -43,7 +44,8 @@ class ConnectionTest extends DatabaseTestBase { $this->assertNotNull($db3, 'Opening an unknown target returns a real connection object.'); $this->assertSame($db1, $db3, 'An unknown target opens the default connection.'); - // Try to open that unknown target another time, that should return the same object. + // Try to open that unknown target another time, that should return the same + // object. $db3b = Database::getConnection($unknown_target, 'default'); $this->assertSame($db3, $db3b, 'A second call to getConnection() returns the same object.'); } @@ -77,7 +79,8 @@ class ConnectionTest extends DatabaseTestBase { Database::closeConnection('default', 'default'); $db2 = Database::getConnection('default', 'default'); - // Opening a connection after closing it should yield an object different than the original. + // Opening a connection after closing it should yield an object different + // than the original. $this->assertNotSame($db1, $db2, 'Opening the default connection after it is closed returns a new object.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php index c6687669c33..ca5fb32936b 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php @@ -509,7 +509,8 @@ abstract class DriverSpecificSchemaTestBase extends DriverSpecificKernelTestBase protected function assertFieldCharacteristics(string $table_name, string $field_name, array $field_spec): void { // Check that the initial value has been registered. if (isset($field_spec['initial'])) { - // There should be no row with a value different then $field_spec['initial']. + // There should be no row with a value different then + // $field_spec['initial']. $count = $this->connection ->select($table_name) ->fields($table_name, ['serial_column']) diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php index d51a7c1c424..76e6d2d9532 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php @@ -50,8 +50,8 @@ class ServiceDestructionTest extends KernelTestBase { // The service has not been destructed yet. $this->assertNull(\Drupal::state()->get('service_provider_test.destructed')); - // Terminate the kernel. The test class has not been called, so it should not - // be destructed. + // Terminate the kernel. The test class has not been called, so it should + // not be destructed. $response = new Response(); $kernel->terminate($request, $response); $this->assertNull(\Drupal::state()->get('service_provider_test.destructed')); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php index f26280096eb..fcf08b85d6e 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php @@ -177,8 +177,8 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase { // The implementation requires that the global user id can be loaded. \Drupal::currentUser()->setAccount($this->createUser([], NULL, FALSE, ['uid' => 2])); - // Check that the default access control handler is used for entities that don't - // have a specific access control handler defined. + // Check that the default access control handler is used for entities that + // don't have a specific access control handler defined. $handler = $this->container->get('entity_type.manager')->getAccessControlHandler('entity_test_default_access'); $this->assertInstanceOf(EntityAccessControlHandler::class, $handler); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php index 15664e8efbe..78deee5a98a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php @@ -165,7 +165,8 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { // Set the field value. $entity->{$this->fieldName}->setValue($reference_field); - // Load the target entities using EntityReferenceField::referencedEntities(). + // Load the target entities using + // EntityReferenceField::referencedEntities(). $entities = $entity->{$this->fieldName}->referencedEntities(); // Test returned entities: @@ -223,7 +224,8 @@ class EntityReferenceFieldTest extends EntityKernelTestBase { // Set the field value. $entity->{$field_name}->setValue([['target_id' => $target_entity->id()]]); - // Load the target entities using EntityReferenceField::referencedEntities(). + // Load the target entities using + // EntityReferenceField::referencedEntities(). $entities = $entity->{$field_name}->referencedEntities(); $this->assertEquals($target_entity->id(), $entities[0]->id()); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php index ee678282296..efdccca4690 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php @@ -160,7 +160,8 @@ class EntityRevisionsTest extends EntityKernelTestBase { * Tests re-saving the entity in entity_test_entity_insert(). */ public function testSaveInHookEntityInsert(): void { - // Create an entity which will be saved again in entity_test_entity_insert(). + // Create an entity which will be saved again in + // entity_test_entity_insert(). $entity = EntityTestMulRev::create(['name' => 'EntityLoadedRevisionTest']); $entity->save(); $loadedRevisionId = \Drupal::state()->get('entity_test.loadedRevisionId'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php index 2713761dd2f..a22bc77a36b 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php @@ -81,7 +81,8 @@ class EntityUUIDTest extends EntityKernelTestBase { $entity_loaded = $storage->load($entity->id()); $this->assertSame($uuid, $entity_loaded->uuid()); - // Verify that \Drupal::service('entity.repository')->loadEntityByUuid() loads the same entity. + // Verify that \Drupal::service('entity.repository')->loadEntityByUuid() + // loads the same entity. $entity_loaded_by_uuid = \Drupal::service('entity.repository')->loadEntityByUuid($entity_type, $uuid, TRUE); $this->assertSame($uuid, $entity_loaded_by_uuid->uuid()); $this->assertEquals($entity_loaded->id(), $entity_loaded_by_uuid->id()); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php index 77ffe920d8f..db858e1d516 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php @@ -468,7 +468,8 @@ class FieldSqlStorageTest extends EntityKernelTestBase { $this->assertEquals($foreign_key_name, $schema['foreign keys'][$foreign_key_name]['table'], 'Foreign key table name preserved through CRUD'); $this->assertEquals('id', $schema['foreign keys'][$foreign_key_name]['columns'][$foreign_key_name], 'Foreign key column name preserved through CRUD'); - // Update the field settings, it should update the foreign key definition too. + // Update the field settings, it should update the foreign key definition + // too. $foreign_key_name = 'color'; $field_storage->setSetting('foreign_key_name', $foreign_key_name); $field_storage->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php index d0fdbf930f0..31c38b4699c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php @@ -566,8 +566,8 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { $new_entity_type = $this->lastInstalledSchemaRepository->getLastInstalledDefinition('entity_test_update'); $this->assertFalse($new_entity_type->isRevisionable(), 'The entity type is kept unchanged.'); - // Check that the last installed field storage definitions did not change by - // looking at the 'langcode' field, which is updated automatically. + // Check that the last installed field storage definitions did not change + // by looking at the 'langcode' field, which is updated automatically. $new_storage_definitions = $this->lastInstalledSchemaRepository->getLastInstalledFieldStorageDefinitions('entity_test_update'); $langcode_key = $original_entity_type->getKey('langcode'); $this->assertEquals($original_storage_definitions[$langcode_key]->isRevisionable(), $new_storage_definitions[$langcode_key]->isRevisionable(), "The 'langcode' field is kept unchanged."); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php index f815bf33f4d..7ab8514026c 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php @@ -197,8 +197,8 @@ class ValidReferenceConstraintValidatorTest extends EntityKernelTestBase { $violations = $referencing_entity->field_test->validate(); $this->assertCount(0, $violations); - // Remove one of the referenceable bundles and check that a pre-existing node - // of that bundle can not be referenced anymore. + // Remove one of the referenceable bundles and check that a pre-existing + // node of that bundle can not be referenced anymore. $field = FieldConfig::loadByName('entity_test', 'entity_test', 'field_test'); $field->setSetting('handler_settings', ['target_bundles' => ['article']]); $field->save(); diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php index 290d94b229b..ef0022b1bfa 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleImplementsAlterTest.php @@ -60,7 +60,8 @@ class ModuleImplementsAlterTest extends KernelTestBase { $this->assertTrue(\Drupal::moduleHandler()->hasImplementations('altered_test_hook', 'module_test'), 'module_test implements hook_altered_test_hook().'); - // Assert that module_test.implementations.inc was included as part of the process. + // Assert that module_test.implementations.inc was included as part of the + // process. $this->assertTrue(function_exists('module_test_altered_test_hook'), 'The file module_test.implementations.inc was included.'); } diff --git a/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php b/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php index c68e69ca89a..9314f1c578b 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php @@ -56,8 +56,9 @@ class FileSystemTest extends KernelTestBase { $this->expectException(DirectoryNotReadyException::class); $this->expectExceptionMessage("The specified file 'public://test.txt' could not be copied because the destination directory 'public://subdirectory' is not properly configured. This may be caused by a problem with file or directory permissions."); touch('public://test.txt'); - // public://subdirectory has not been created, so \Drupal::service('file_system')->prepareDirectory() - // will fail, causing copy() to throw DirectoryNotReadyException. + // public://subdirectory has not been created, so + // \Drupal::service('file_system')->prepareDirectory() will fail, causing + // copy() to throw DirectoryNotReadyException. $this->fileSystem->copy('public://test.txt', 'public://subdirectory/test.txt'); } diff --git a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php index 3752b396994..54f01270198 100644 --- a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php @@ -77,7 +77,8 @@ class ReadOnlyStreamWrapperTest extends FileTestBase { $this->assertEquals(0, @fwrite($handle, $this->randomMachineName()), 'Unable to write to file using the read-only stream wrapper.'); // Attempt to flush output to the file $this->assertFalse(@fflush($handle), 'Unable to flush output to file using the read-only stream wrapper.'); - // Attempt to close the stream. (Suppress errors, as fclose triggers fflush.) + // Attempt to close the stream. (Suppress errors, as fclose triggers + // fflush.) $this->assertTrue(fclose($handle), 'Able to close file using the read_only stream wrapper.'); // Test the rename() function $this->assertFalse(@rename($uri, $this->scheme . '://new_name.txt'), 'Unable to rename files using the read-only stream wrapper.'); diff --git a/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php index c9fbc793d1e..e446a426f96 100644 --- a/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php +++ b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php @@ -242,9 +242,9 @@ class ToolkitGdTest extends KernelTestBase { 'arguments' => [], 'height' => 20, 'width' => 40, - // Grayscale corners are a bit funky. Each of the corners are a shade of - // gray. The values of these were determined simply by looking at the - // final image to see what desaturated colors end up being. + // Grayscale corners are a bit funky. Each of the corners are a shade + // of gray. The values of these were determined simply by looking at + // the final image to see what desaturated colors end up being. 'corners' => [ array_fill(0, 3, 76) + [3 => 0], array_fill(0, 3, 149) + [3 => 0], diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php index 3f2d0ff2d85..91af498b01c 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php @@ -147,7 +147,8 @@ abstract class StorageTestBase extends KernelTestBase { $stores[0]->delete('foo'); $this->assertNull($stores[0]->get('foo')); - // Verify that a non-existing key is not returned when getting multiple keys. + // Verify that a non-existing key is not returned when getting multiple + // keys. $stores[0]->set('bar', 'baz'); $values = $stores[0]->getMultiple(['foo', 'bar']); $this->assertFalse(isset($values['foo']), "Key 'foo' not found."); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php index 2a0e45a36a0..df218fabbed 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php @@ -52,7 +52,8 @@ abstract class DiscoveryTestBase extends KernelTestBase { $this->assertDefinitionIdentical($this->discovery->getDefinition($id), $definition); } - // Ensure that an empty array is returned if no plugin definitions are found. + // Ensure that an empty array is returned if no plugin definitions are + // found. $this->assertSame([], $this->emptyDiscovery->getDefinitions(), 'Empty array returned if no plugin definitions are found.'); // Ensure that NULL is returned as the definition of a non-existing plugin. diff --git a/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php b/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php index adf4d58e9ae..8180bed11f0 100644 --- a/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php +++ b/core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php @@ -50,11 +50,13 @@ class ServiceProviderTest extends KernelTestBase { * Tests that the DIC keeps up with module enable/disable in the same request. */ public function testServiceProviderRegistrationDynamic(): void { - // Uninstall the module and ensure the service provider's service is not registered. + // Uninstall the module and ensure the service provider's service is not + // registered. \Drupal::service('module_installer')->uninstall(['service_provider_test']); $this->assertFalse(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service does not exist in the DIC.'); - // Install the module and ensure the service provider's service is registered. + // Install the module and ensure the service provider's service is + // registered. \Drupal::service('module_installer')->install(['service_provider_test']); $this->assertTrue(\Drupal::hasService('service_provider_test_class'), 'The service_provider_test_class service exists in the DIC.'); } diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/ValidKeysConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/ValidKeysConstraintValidatorTest.php index 6847d8b2716..5026321001a 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/ValidKeysConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/ValidKeysConstraintValidatorTest.php @@ -79,7 +79,8 @@ class ValidKeysConstraintValidatorTest extends KernelTestBase { $data = $this->config->toArray(); $data['settings']['foobar'] = TRUE; $this->assertValidationErrors('block.block.branding', $data, - // Now 1 validation error should be triggered: one for the unsupported key. + // Now 1 validation error should be triggered: one for the unsupported + // key. // @see \Drupal\system\Plugin\Block\SystemBrandingBlock::defaultConfiguration() // @see \Drupal\system\Plugin\Block\SystemPoweredByBlock::defaultConfiguration() [ diff --git a/core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php index 97e1c7876ac..1171baf7650 100644 --- a/core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php @@ -274,7 +274,8 @@ class UniqueValuesConstraintValidatorTest extends KernelTestBase { $this->assertEquals('field_test_text.2', $violations[1]->getPropertyPath()); $this->assertEquals(sprintf('A unique field entity with unique_field_test %s already exists.', $definition['field_test_text'][2]), $violations[1]->getMessage()); - // Create new entity with two identical values and one existing value in unique field. + // Create new entity with two identical values and one existing value in + // unique field. $definition = [ 'user_id' => 0, 'field_test_text' => [ @@ -316,8 +317,9 @@ class UniqueValuesConstraintValidatorTest extends KernelTestBase { $entity = EntityTestUniqueConstraint::create($definition); $entity->save(); - // Create another entity with two values for the testing field, one identical - // to other value, but with different capitalization which should still trigger a validation error. + // Create another entity with two values for the testing field, one + // identical to other value, but with different capitalization which should + // still trigger a validation error. $definition = [ 'id' => (int) rand(0, getrandmax()), 'user_id' => 0, diff --git a/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php b/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php index 88a49066957..26cc8a29033 100644 --- a/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php +++ b/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php @@ -47,7 +47,8 @@ class TestSiteClaroInstallTestScript implements TestSetupInterface { $article_with_comments->save(); $values = [ - // These values are for the entity that you're creating the comment for, not the comment itself. + // These values are for the entity that you're creating the comment for, + // not the comment itself. 'entity_type' => 'node', 'entity_id' => 2, 'field_name' => 'comment', diff --git a/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php b/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php index 9b6c36d1bad..02e945b7e2d 100644 --- a/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php +++ b/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php @@ -47,7 +47,8 @@ class TestSiteOliveroInstallTestScript implements TestSetupInterface { $article_with_comments->save(); $values = [ - // These values are for the entity that you're creating the comment for, not the comment itself. + // These values are for the entity that you're creating the comment for, + // not the comment itself. 'entity_type' => 'node', 'entity_id' => 2, 'field_name' => 'comment', diff --git a/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php index c0241d053c1..816def560ed 100644 --- a/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php @@ -82,7 +82,8 @@ class YamlDirectoryDiscoveryTest extends TestCase { $discovery = new YamlDirectoryDiscovery($directories, 'test'); $data = $discovery->findAll(); - // The file path is dependent on the operating system, so we adjust the directory separator. + // The file path is dependent on the operating system, so we adjust the + // directory separator. $this->assertSame(['id' => 'item1', 'name' => 'test1 item 1', YamlDirectoryDiscovery::FILE_KEY => 'vfs://modules/test_1/subdir1' . DIRECTORY_SEPARATOR . 'item_1.test.yml'], $data['test_1']['item1']); $this->assertSame(['id' => 'item2', 'name' => 'test1 item 2', YamlDirectoryDiscovery::FILE_KEY => 'vfs://modules/test_1/subdir2' . DIRECTORY_SEPARATOR . 'item_2.test.yml'], $data['test_1']['item2']); $this->assertCount(2, $data['test_1']); diff --git a/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php b/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php index 869733a54b2..5dffb2be1e3 100644 --- a/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php +++ b/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php @@ -33,7 +33,8 @@ class SecuredRedirectResponseTest extends TestCase { $secureRedirect = SecuredRedirectStub::createFromRedirectResponse($redirect); $this->assertEquals('/magic_redirect_url', $secureRedirect->getTargetUrl()); $this->assertEquals(301, $secureRedirect->getStatusCode()); - // We pull the headers from the original redirect because there are default headers applied. + // We pull the headers from the original redirect because there are default + // headers applied. $headers1 = $redirect->headers->all(); $headers2 = $secureRedirect->headers->all(); $this->assertEquals($headers1, $headers2); diff --git a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php index 5120d0e78c0..5e82b2daaef 100644 --- a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php +++ b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php @@ -76,7 +76,8 @@ class FormattableMarkupTest extends TestCase { * @dataProvider providerTestUnexpectedPlaceholder */ public function testUnexpectedPlaceholder($string, $arguments, $error_number, $error_message): void { - // We set a custom error handler because of https://github.com/sebastianbergmann/phpunit/issues/487 + // We set a custom error handler because of + // https://github.com/sebastianbergmann/phpunit/issues/487 set_error_handler([$this, 'errorHandler']); // We want this to trigger an error. $markup = new FormattableMarkup($string, $arguments); diff --git a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php index 5a543db9d15..b2c459e06a7 100644 --- a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php @@ -68,7 +68,8 @@ class HtmlTest extends TestCase { return [ // Verify that no valid ASCII characters are stripped from the identifier. [$id1, $id1, []], - // Verify that valid UTF-8 characters are not stripped from the identifier. + // Verify that valid UTF-8 characters are not stripped from the + // identifier. [$id2, $id2, []], // Verify that double underscores are not stripped from the identifier. [$id3, $id3], diff --git a/core/tests/Drupal/Tests/Component/Utility/XssTest.php b/core/tests/Drupal/Tests/Component/Utility/XssTest.php index 8c4419f4557..5c58e99bc76 100644 --- a/core/tests/Drupal/Tests/Component/Utility/XssTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/XssTest.php @@ -214,8 +214,8 @@ class XssTest extends TestCase { 'script', 'HTML tag stripping evasion -- no closing tag.', ], - // DRUPAL-SA-2008-047: This doesn't seem exploitable, but the filter should - // work consistently. + // DRUPAL-SA-2008-047: This doesn't seem exploitable, but the filter + // should work consistently. [ '<script>>', 'script', @@ -426,8 +426,8 @@ class XssTest extends TestCase { 'Netscape 4.x javascript entities.', ['br'], ], - // DRUPAL-SA-2008-006: Invalid UTF-8, these only work as reflected XSS with - // Internet Explorer 6. + // DRUPAL-SA-2008-006: Invalid UTF-8, these only work as reflected XSS + // with Internet Explorer 6. [ "<p arg=\"\xe0\">\" style=\"background-image: url(javascript:alert(0));\"\xe0<p>", 'style', diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php index 7d06831a40b..785392e6f07 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -541,7 +541,8 @@ class AccessResultTest extends UnitTestCase { $this->assertSame(['node:20011988'], $access->getCacheTags()); $this->assertSame(1500, $access->getCacheMaxAge()); - // andIf(); 1st has custom tags, max-age, 2nd has custom contexts and max-age. + // andIf(); 1st has custom tags, max-age, 2nd has custom contexts and + // max-age. $access = AccessResult::allowed()->cachePerUser()->setCacheMaxAge(43200); $other = AccessResult::forbidden()->addCacheTags(['node:14031991'])->setCacheMaxAge(86400); $this->assertInstanceOf(AccessResult::class, $access->inheritCacheability($other)); diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/UserRolesCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/UserRolesCacheContextTest.php index 6b889c07105..8c6d2b2641a 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/UserRolesCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/UserRolesCacheContextTest.php @@ -19,7 +19,8 @@ class UserRolesCacheContextTest extends UnitTestCase { */ public function testCalculatedRole(): void { $current_user = $this->prophesize(AccountInterface::class); - // Ensure the ID is not 1. This cache context gives user 1 a special superuser value. + // Ensure the ID is not 1. This cache context gives user 1 a special + // superuser value. $current_user->id()->willReturn(2); $current_user->getRoles()->willReturn(['role1', 'role2']); $cache_context = new UserRolesCacheContext($current_user->reveal()); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php index 243069049c7..9a54ddc7105 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php @@ -193,8 +193,8 @@ class EntityFieldManagerTest extends UnitTestCase { protected function setUpEntityTypeDefinitions($definitions = []): void { foreach ($definitions as $key => $entity_type) { // \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called - // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it must - // always be mocked. + // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it + // must always be mocked. $entity_type->getLinkTemplates()->willReturn([]); $definitions[$key] = $entity_type->reveal(); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php index 7ece81b20ab..cb7adae1051 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php @@ -99,8 +99,8 @@ class EntityTypeManagerTest extends UnitTestCase { $class = get_class($this->createMock(EntityInterface::class)); foreach ($definitions as $key => $entity_type) { // \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called - // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it must - // always be mocked. + // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it + // must always be mocked. $entity_type->getLinkTemplates()->willReturn([]); // Give the entity type a legitimate class to return. diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php index 9d410bd17da..39ebc2cf179 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php @@ -64,8 +64,8 @@ class EntityTypeRepositoryTest extends UnitTestCase { protected function setUpEntityTypeDefinitions($definitions = []): void { foreach ($definitions as $key => $entity_type) { // \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called - // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it must - // always be mocked. + // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it + // must always be mocked. $entity_type->getLinkTemplates()->willReturn([]); // Give the entity type a legitimate class to return. diff --git a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php index 8b54cdc470f..ef3f980d6a2 100644 --- a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php +++ b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php @@ -81,8 +81,8 @@ class FieldDefinitionListenerTest extends UnitTestCase { protected function setUpEntityTypeManager($definitions = []): void { foreach ($definitions as $key => $entity_type) { // \Drupal\Core\Entity\EntityTypeInterface::getLinkTemplates() is called - // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it must - // always be mocked. + // by \Drupal\Core\Entity\EntityTypeManager::processDefinition() so it + // must always be mocked. $entity_type->getLinkTemplates()->willReturn([]); $definitions[$key] = $entity_type->reveal(); diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php index a1b8d4c9c4c..2a44d24c87d 100644 --- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php +++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php @@ -90,8 +90,8 @@ class PathProcessorTest extends UnitTestCase { ->method('getPathByAlias') ->willReturnMap($system_path_map); - // Create a stub config factory with all config settings that will be checked - // during this test. + // Create a stub config factory with all config settings that will be + // checked during this test. $config_factory_stub = $this->getConfigFactoryStub( [ 'system.site' => [ @@ -140,8 +140,8 @@ class PathProcessorTest extends UnitTestCase { $language_processor = new PathProcessorLanguage($config_factory_stub, $this->languageManager, $negotiator, $current_user, $config_subscriber); // First, test the processor manager with the processors in the incorrect - // order. The alias processor will run before the language processor, meaning - // aliases will not be found. + // order. The alias processor will run before the language processor, + // meaning aliases will not be found. $priorities = [ 1000 => $alias_processor, 500 => $decode_processor, diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php index 14c56887280..cc9fbd796e4 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php @@ -46,7 +46,8 @@ class ContainerDerivativeDiscoveryDecoratorTest extends UnitTestCase { $discovery = new ContainerDerivativeDiscoveryDecorator($discovery_main); $definitions = $discovery->getDefinitions(); - // Ensure that both the instances from container and non-container test derivatives got added. + // Ensure that both the instances from container and non-container test + // derivatives got added. $this->assertCount(4, $definitions); } diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php index 2a6f20bb6cd..bb904e0394f 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php @@ -272,8 +272,9 @@ class RendererBubblingTest extends RendererTestBase { $data[] = [$test_element, ['bar', 'foo'], $expected_cache_item]; // Ensure that bubbleable metadata has been collected from children and set - // correctly to the main level of the render array. That ensures that correct - // bubbleable metadata exists if render array gets rendered multiple times. + // correctly to the main level of the render array. That ensures that + // correct bubbleable metadata exists if render array gets rendered multiple + // times. $test_element = [ '#cache' => [ 'keys' => ['parent'], diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php index 14aafbc8ada..bed9e365e44 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php @@ -204,7 +204,8 @@ class RendererPlaceholdersTest extends RendererTestBase { $cases = []; // Case one: render array that has a placeholder that is: - // - automatically created, but manually triggered (#create_placeholder = TRUE) + // - automatically created, but manually triggered (#create_placeholder = + // TRUE) // - uncacheable $element_without_cache_keys = $base_element_a1; $expected_placeholder_render_array = $extract_placeholder_render_array($base_element_a1['placeholder']); @@ -219,7 +220,8 @@ class RendererPlaceholdersTest extends RendererTestBase { ]; // Case two: render array that has a placeholder that is: - // - automatically created, but manually triggered (#create_placeholder = TRUE) + // - automatically created, but manually triggered (#create_placeholder = + // TRUE) // - cacheable $element_with_cache_keys = $base_element_a1; $element_with_cache_keys['placeholder']['#cache']['keys'] = $keys; diff --git a/core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php b/core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php index abb0bda7994..c85156e9745 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php +++ b/core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php @@ -55,8 +55,8 @@ abstract class RouteMatchTestBase extends UnitTestCase { // Parameters should be filtered to only those defined by the route. // Specifically: // - Path parameters, regardless of name. - // - Defaults that are not path parameters only if they do not start with - // an underscore. + // - Defaults that are not path parameters only if they do not start + // with an underscore. [ 'param_without_leading_underscore' => 'value', '_param_with_leading_underscore' => 'value', diff --git a/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php b/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php index ef5d674f605..f6c7c962f38 100644 --- a/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php @@ -62,7 +62,8 @@ class TrustedRedirectResponseTest extends UnitTestCase { public function testCreateFromRedirectResponse($redirect_response): void { $trusted_redirect_response = TrustedRedirectResponse::createFromRedirectResponse($redirect_response); - // The trusted redirect response is always a CacheableResponseInterface instance. + // The trusted redirect response is always a CacheableResponseInterface + // instance. $this->assertInstanceOf(CacheableResponseInterface::class, $trusted_redirect_response); // But it is only actually cacheable (non-zero max-age) if the redirect diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php index 9b614d9e801..24014e0fda9 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php @@ -73,7 +73,8 @@ class TranslatableMarkupTest extends UnitTestCase { throw new \Exception('Yes you may.'); }); - // We set a custom error handler because of https://github.com/sebastianbergmann/phpunit/issues/487 + // We set a custom error handler because of + // https://github.com/sebastianbergmann/phpunit/issues/487 set_error_handler([$this, 'errorHandler']); // We want this to trigger an error. (string) $text; diff --git a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php index 3d2b2ae641a..c68981da4cd 100644 --- a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php +++ b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php @@ -44,7 +44,8 @@ class PhpTransliterationTest extends UnitTestCase { ->method('alter') ->willReturnCallback(function ($hook, &$overrides, $langcode) { if ($langcode == 'zz') { - // The default transliteration of Ä is A, but change it to Z for testing. + // The default transliteration of Ä is A, but change it to Z for + // testing. $overrides[0xC4] = 'Z'; // Also provide transliterations of two 5-byte characters from // http://wikipedia.org/wiki/Gothic_alphabet. diff --git a/core/tests/Drupal/Tests/EntityViewTrait.php b/core/tests/Drupal/Tests/EntityViewTrait.php index b4952249db8..95fb08ac964 100644 --- a/core/tests/Drupal/Tests/EntityViewTrait.php +++ b/core/tests/Drupal/Tests/EntityViewTrait.php @@ -38,15 +38,15 @@ trait EntityViewTrait { */ protected function buildEntityView(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) { $ensure_fully_built = function (&$elements) use (&$ensure_fully_built) { - // If the default values for this element have not been loaded yet, populate - // them. + // If the default values for this element have not been loaded yet, + // populate them. if (isset($elements['#type']) && empty($elements['#defaults_loaded'])) { $elements += \Drupal::service('element_info')->getInfo($elements['#type']); } // Make any final changes to the element before it is rendered. This means - // that the $element or the children can be altered or corrected before the - // element is rendered into the final text. + // that the $element or the children can be altered or corrected before + // the element is rendered into the final text. if (isset($elements['#pre_render'])) { foreach ($elements['#pre_render'] as $callable) { $elements = call_user_func($callable, $elements); diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index d8a5a65dc55..bcf68499adf 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -83,7 +83,8 @@ function twig_render_template($template_file, array $variables) { $invalid_suggestions = []; $base_hook = $base_hook ?? $variables['theme_hook_original']; foreach ($suggestions as $key => &$suggestion) { - // Valid suggestions are $base_hook, $base_hook__*, and contain no hyphens. + // Valid suggestions are $base_hook, $base_hook__*, and contain no + // hyphens. if (($suggestion !== $base_hook && !str_starts_with($suggestion, $base_hook . '__')) || str_contains($suggestion, '-')) { $invalid_suggestions[] = $suggestion; unset($suggestions[$key]); diff --git a/core/themes/olivero/olivero.theme b/core/themes/olivero/olivero.theme index b47c57a2c5e..517865ff9b2 100644 --- a/core/themes/olivero/olivero.theme +++ b/core/themes/olivero/olivero.theme @@ -28,7 +28,8 @@ function olivero_preprocess_html(&$variables): void { $variables['html_attributes']->setAttribute('style', "--color--primary-hue:$h;--color--primary-saturation:$s%;--color--primary-lightness:$l"); - // So fonts can be preloaded from base theme in the event Olivero is used as a subtheme. + // So fonts can be preloaded from base theme in the event Olivero is used as a + // subtheme. $variables['olivero_path'] = \Drupal::request()->getBasePath() . '/' . \Drupal::service('extension.list.theme')->getPath('olivero'); $query_string = \Drupal::service('asset.query_string')->get(); @@ -309,8 +310,9 @@ function olivero_preprocess_input(&$variables): void { $variables['attributes']['class'][] = Html::getClass('form-element--type-' . $type_html); $variables['attributes']['class'][] = Html::getClass('form-element--api-' . $type_api); - // This logic is functioning as expected, but there is nothing in the theme that renders the result. - // As a result it can't currently be covered by a functional test. + // This logic is functioning as expected, but there is nothing in the theme + // that renders the result. As a result it can't currently be covered by a + // functional test. if (!empty($variables['element']['#autocomplete_route_name'])) { $variables['autocomplete_message'] = t('Loading…'); } |