Commit 33ba4582 authored by catch's avatar catch
Browse files

Issue #2719649 by Spokje, harsha012, jofitz, vprocessor, nikitagupta,...

Issue #2719649 by Spokje, harsha012, jofitz, vprocessor, nikitagupta, cburschka, rasikap, hitesh-jain, quietone, longwave, mfernea, andypost, klausi, Malevi4, crazyrohila: Fix 'Drupal.Commenting.InlineComment.SpacingBefore' coding standard
parent 6a533564
......@@ -40,9 +40,11 @@ public static function getBestMatchingLangcode($http_accept_language, $langcodes
// The Accept-Language header contains information about the language
// preferences configured in the user's user agent / operating system.
// RFC 2616 (section 14.4) defines the Accept-Language header as follows:
// @code
// Accept-Language = "Accept-Language" ":"
// 1#( language-range [ ";" "q" "=" qvalue ] )
// language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
// @endcode
// Samples: "hu, en-us;q=0.66, en;q=0.33", "hu,en-us;q=0.5"
$ua_langcodes = [];
if (preg_match_all('@(?<=[, ]|^)([a-zA-Z-]+|\*)(?:;q=([0-9.]+))?(?:$|\s*,\s*)@', trim($http_accept_language), $matches, PREG_SET_ORDER)) {
......
......@@ -393,17 +393,19 @@ protected function createExtensionChangelist() {
// dependencies are uninstalled last. Extensions of the same weight are
// sorted in reverse alphabetical order, to ensure the order is exactly
// opposite from installation. For example, this module list:
// @code
// array(
// 'actions' => 0,
// 'ban' => 0,
// 'options' => -2,
// 'text' => -1,
// );
// @endcode
// will result in the following sort order:
// -2 options
// -1 text
// 0 0 ban
// 0 1 actions
// 1. -2 options
// 2. -1 text
// 3. 0 0 ban
// 4. 0 1 actions
// @todo Move this sorting functionality to the extension system.
array_multisort(array_values($module_list), SORT_ASC, array_keys($module_list), SORT_DESC, $module_list);
$this->extensionChangelist['module']['uninstall'] = array_intersect(array_keys($module_list), $uninstall);
......
......@@ -459,7 +459,7 @@ public function boot() {
// Provide a default configuration, if not set.
if (!isset($configuration['default'])) {
// @todo Use extension_loaded('apcu') for non-testbot
// https://www.drupal.org/node/2447753.
// https://www.drupal.org/node/2447753.
if (function_exists('apcu_fetch')) {
$configuration['default']['cache_backend_class'] = '\Drupal\Component\FileCache\ApcuFileCacheBackend';
}
......
......@@ -1434,7 +1434,7 @@ public function hasTranslationChanges() {
foreach ($this->getFieldDefinitions() as $field_name => $definition) {
// @todo Avoid special-casing the following fields. See
// https://www.drupal.org/node/2329253.
// https://www.drupal.org/node/2329253.
if (in_array($field_name, $skip_fields, TRUE) || ($skip_untranslatable_fields && !$definition->isTranslatable())) {
continue;
}
......
......@@ -275,7 +275,7 @@ protected function buildBaseFieldDefinitions($entity_type_id) {
$provider = $entity_type->getProvider();
foreach ($base_field_definitions as $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a proper
// provider setter. See https://www.drupal.org/node/2225961.
// provider setter. See https://www.drupal.org/node/2225961.
if ($definition instanceof BaseFieldDefinition) {
$definition->setProvider($provider);
}
......@@ -289,7 +289,7 @@ protected function buildBaseFieldDefinitions($entity_type_id) {
// defining the field.
foreach ($module_definitions as $field_name => $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a
// proper provider setter. See https://www.drupal.org/node/2225961.
// proper provider setter. See https://www.drupal.org/node/2225961.
if ($definition instanceof BaseFieldDefinition && $definition->getProvider() == NULL) {
$definition->setProvider($module);
}
......@@ -397,7 +397,7 @@ protected function buildBundleFieldDefinitions($entity_type_id, $bundle, array $
$provider = $entity_type->getProvider();
foreach ($bundle_field_definitions as $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a proper
// provider setter. See https://www.drupal.org/node/2225961.
// provider setter. See https://www.drupal.org/node/2225961.
if ($definition instanceof BaseFieldDefinition) {
$definition->setProvider($provider);
}
......@@ -411,7 +411,7 @@ protected function buildBundleFieldDefinitions($entity_type_id, $bundle, array $
// defining the field.
foreach ($module_definitions as $field_name => $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a
// proper provider setter. See https://www.drupal.org/node/2225961.
// proper provider setter. See https://www.drupal.org/node/2225961.
if ($definition instanceof BaseFieldDefinition) {
$definition->setProvider($module);
}
......@@ -587,7 +587,7 @@ protected function buildFieldStorageDefinitions($entity_type_id) {
// defining the field.
foreach ($module_definitions as $field_name => $definition) {
// @todo Remove this check once FieldDefinitionInterface exposes a
// proper provider setter. See https://www.drupal.org/node/2225961.
// proper provider setter. See https://www.drupal.org/node/2225961.
if ($definition instanceof BaseFieldDefinition) {
$definition->setProvider($module);
$definition->setName($field_name);
......
......@@ -324,7 +324,7 @@ protected function copyFormValuesToEntity(EntityInterface $entity, array $form,
$values = array_diff_key($values, $this->entity->getPluginCollections());
}
// @todo: This relies on a method that only exists for config and content
// @todo This relies on a method that only exists for config and content
// entities, in a different way. Consider moving this logic to a config
// entity specific implementation.
foreach ($values as $key => $value) {
......
......@@ -292,7 +292,7 @@ public function buildMultiple(array $build_list) {
$this->alterBuild($build_list[$key], $entity, $display, $view_mode);
// Assign the weights configured in the display.
// @todo: Once https://www.drupal.org/node/1875974 provides the missing
// @todo Once https://www.drupal.org/node/1875974 provides the missing
// API, only do it for 'extra fields', since other components have
// been taken care of in EntityViewDisplay::buildMultiple().
foreach ($display->getComponents() as $name => $options) {
......
......@@ -155,7 +155,7 @@ protected function getAddFormRoute(EntityTypeInterface $entity_type) {
// If the entity has bundles, we can provide a bundle-specific title
// and access requirements.
$expected_parameter = $entity_type->getBundleEntityType() ?: $entity_type->getKey('bundle');
// @todo: We have to check if a route contains a bundle in its path as
// @todo We have to check if a route contains a bundle in its path as
// test entities have inconsistent usage of "add-form" link templates.
// Fix it in https://www.drupal.org/node/2699959.
if (($bundle_key = $entity_type->getKey('bundle')) && strpos($route->getPath(), '{' . $expected_parameter . '}') !== FALSE) {
......
......@@ -180,7 +180,7 @@ public static function setLinkActiveClass($html_markup, $current_path, $is_front
}
// Get the HTML: this will be the opening part of a single tag, e.g.:
// <a href="/" data-drupal-link-system-path="&lt;front&gt;">
// <a href="/" data-drupal-link-system-path="&lt;front&gt;">
$tag = substr($html_markup, $pos_tag_start, $pos_tag_end - $pos_tag_start + 1);
// Parse it into a DOMDocument so we can reliably read and modify
......
......@@ -913,9 +913,9 @@ public function guessMimeType($path): ?string {
// Iterate over the file parts, trying to find a match.
// For my.awesome.image.jpeg, we try:
// - jpeg
// - image.jpeg, and
// - awesome.image.jpeg
// - jpeg
// - image.jpeg, and
// - awesome.image.jpeg
while ($additional_part = array_pop($file_parts)) {
$extension = strtolower($additional_part . ($extension ? '.' . $extension : ''));
if (isset($this->mapping['extensions'][$extension])) {
......
......@@ -1206,8 +1206,11 @@ public function cleanValues() {
// the value corresponding to this button.
// We iterate over the #parents of this button and move a reference to
// each parent in self::getValues(). For example, if #parents is:
// @code
// array('foo', 'bar', 'baz')
// @endcode
// then the corresponding self::getValues() part will look like this:
// @code
// array(
// 'foo' => array(
// 'bar' => array(
......@@ -1215,6 +1218,7 @@ public function cleanValues() {
// ),
// ),
// )
// @endcode
// We start by (re)moving 'baz' to $last_parent, so we are able unset it
// at the end of the iteration. Initially, $values will contain a
// reference to self::getValues(), but in the iteration we move the
......
......@@ -101,7 +101,7 @@ public function executeSubmitHandlers(&$form, FormStateInterface &$form_state) {
// Check if a previous _submit handler has set a batch, but make sure we
// do not react to a batch that is already being processed (for instance
// if a batch operation performs a
// \Drupal\Core\Form\FormBuilderInterface::submitForm()).
// \Drupal\Core\Form\FormBuilderInterface::submitForm()).
if (($batch = &$this->batchGet()) && !isset($batch['id'])) {
// Some previous submit handler has set a batch. To ensure correct
// execution order, store the call in a special 'control' batch set.
......
......@@ -62,7 +62,7 @@ public function get(array $elements) {
// Form submissions rely on the form being built during the POST request,
// and render caching of forms prevents this from happening.
// @todo remove the isMethodCacheable() check when
// https://www.drupal.org/node/2367555 lands.
// https://www.drupal.org/node/2367555 lands.
if (!$this->requestStack->getCurrentRequest()->isMethodCacheable() || !$cid = $this->createCacheID($elements)) {
return FALSE;
}
......@@ -89,7 +89,7 @@ public function set(array &$elements, array $pre_bubbling_elements) {
// Form submissions rely on the form being built during the POST request,
// and render caching of forms prevents this from happening.
// @todo remove the isMethodCacheable() check when
// https://www.drupal.org/node/2367555 lands.
// https://www.drupal.org/node/2367555 lands.
if (!$this->requestStack->getCurrentRequest()->isMethodCacheable() || !$cid = $this->createCacheID($elements)) {
return FALSE;
}
......@@ -120,6 +120,7 @@ public function set(array &$elements, array $pre_bubbling_elements) {
// were specified by all children, so what we need is a way to
// persist that information between the cache write and the next cache
// read. So, what we can do is store the following into 'foo':
// @code
// [
// '#cache_redirect' => TRUE,
// '#cache' => [
......@@ -127,6 +128,7 @@ public function set(array &$elements, array $pre_bubbling_elements) {
// 'contexts' => ['b'],
// ],
// ]
// @endcode
//
// This efficiently lets cacheGet() redirect to a $cid that includes all
// of the required contexts. The strategy is on-demand: in the case where
......@@ -152,6 +154,7 @@ public function set(array &$elements, array $pre_bubbling_elements) {
// following:
// - When a request is processed where context 'b' = 'b1', what would be
// cached for a $pre_bubbling_cid of 'foo' is:
// @code
// [
// '#cache_redirect' => TRUE,
// '#cache' => [
......@@ -159,12 +162,14 @@ public function set(array &$elements, array $pre_bubbling_elements) {
// 'contexts' => ['b', 'c'],
// ],
// ]
// @endcode
// - When a request is processed where context 'b' = 'b2', we would
// retrieve the above from cache, but when following that redirection,
// get a cache miss, since we're processing a 'b' context value that
// has not yet been cached. Given the cache miss, we would continue
// with rendering the structure, perform the required context bubbling
// and then overwrite the above item with:
// @code
// [
// '#cache_redirect' => TRUE,
// '#cache' => [
......@@ -172,11 +177,13 @@ public function set(array &$elements, array $pre_bubbling_elements) {
// 'contexts' => ['b', 'd'],
// ],
// ]
// @endcode
// - Now, if a request comes in where context 'b' = 'b1' again, the above
// would redirect to a cache key that doesn't exist, since we have not
// yet cached an item that includes 'b'='b1' and something for 'd'. So
// we would process this request as a cache miss, at the end of which,
// we would overwrite the above item back to:
// @code
// [
// '#cache_redirect' => TRUE,
// '#cache' => [
......@@ -184,6 +191,7 @@ public function set(array &$elements, array $pre_bubbling_elements) {
// 'contexts' => ['b', 'c'],
// ],
// ]
// @endcode
// - The above would always result in accurate renderings, but would
// result in poor performance as we keep processing requests as cache
// misses even though the target of the redirection is cached, and
......@@ -193,6 +201,7 @@ public function set(array &$elements, array $pre_bubbling_elements) {
// A way to resolve the ping-pong problem is to eventually reach a cache
// state where the redirection element includes all of the contexts used
// throughout all requests:
// @code
// [
// '#cache_redirect' => TRUE,
// '#cache' => [
......@@ -200,6 +209,7 @@ public function set(array &$elements, array $pre_bubbling_elements) {
// 'contexts' => ['b', 'c', 'd'],
// ],
// ]
// @endcode
//
// We can't reach that state right away, since we don't know what the
// result of future requests will be, but we can incrementally move
......
......@@ -344,7 +344,7 @@ protected function doRender(&$elements, $is_root_call = FALSE) {
// present (without such a callback, it would be impossible to replace the
// placeholder), replace the current element with a placeholder.
// @todo remove the isMethodCacheable() check when
// https://www.drupal.org/node/2367555 lands.
// https://www.drupal.org/node/2367555 lands.
if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === TRUE && $this->requestStack->getCurrentRequest()->isMethodCacheable()) {
if (!isset($elements['#lazy_builder'])) {
throw new \LogicException('When #create_placeholder is set, a #lazy_builder callback must be present as well.');
......
......@@ -186,7 +186,7 @@ public function getTestClasses($extension = NULL, array $types = []) {
// unavailable modules. TestDiscovery should not filter out module
// requirements for PHPUnit-based test classes.
// @todo Move this behavior to \Drupal\simpletest\TestBase so tests can be
// marked as skipped, instead.
// marked as skipped, instead.
// @see https://www.drupal.org/node/1273478
if ($info['type'] == 'Simpletest') {
if (!empty($info['requires']['module'])) {
......
......@@ -43,7 +43,7 @@ public function transChoice($id, $number, array $parameters = [], $domain = NULL
}
// Normally, calls to formatPlural() need to use literal strings, like
// formatPlural($count, '1 item', '@count items')
// formatPlural($count, '1 item', '@count items')
// so that the Drupal project POTX string extractor will correctly
// extract the strings for translation and save them in a format that
// formatPlural() can work with. However, this is a special case, because
......
......@@ -187,7 +187,7 @@ public function process(FeedInterface $feed) {
return;
}
foreach ($feed->items as $item) {
// @todo: The default entity view builder always returns an empty
// @todo The default entity view builder always returns an empty
// array, which is ignored in aggregator_save_item() currently. Should
// probably be fixed.
if (empty($item['title'])) {
......
......@@ -70,7 +70,7 @@ public function testBookOrdering() {
$this->assertSession()->pageTextNotContains('You have unsaved changes.');
// Drag and drop the '1st page' row over the '2nd page' row.
// @todo: Test also the reverse, '2nd page' over '1st page', when
// @todo Test also the reverse, '2nd page' over '1st page', when
// https://www.drupal.org/node/2769825 is fixed.
// @see https://www.drupal.org/node/2769825
$dragged = $this->xpath("//tr[@data-drupal-selector='edit-table-book-admin-{$page1->id()}']//a[@class='tabledrag-handle']")[0];
......
......@@ -475,8 +475,8 @@ protected function generateACFSettings(Editor $editor) {
// attributes is allowed. However, that may not be the case: the "*"
// tag may still apply restrictions.
// Since CKEditor's ACF follows the following principle:
// Once validated, an element or its property cannot be
// invalidated by another rule.
// - Once validated, an element or its property cannot be
// invalidated by another rule.
// That means that the most permissive setting wins. Which means that
// it will still be allowed by CKEditor, for instance, to define any
// style, no matter what the "*" tag's restrictions may be. If there
......
......@@ -86,13 +86,13 @@ public function testEnabledPlugins() {
$this->assertSame(['internal' => NULL] + $enabled_plugins, $this->manager->getEnabledPluginFiles($editor, TRUE), 'Only the "internal" plugin is enabled.');
// Case 3: enable each of the newly available plugins, if possible:
// a. Llama: cannot be enabled, since it does not implement
// 1. Llama: cannot be enabled, since it does not implement
// CKEditorPluginContextualInterface nor CKEditorPluginButtonsInterface.
// b. LlamaContextual: enabled by adding the 'Strike' button, which is
// 2. LlamaContextual: enabled by adding the 'Strike' button, which is
// part of another plugin!
// c. LlamaButton: automatically enabled by adding its 'Llama' button.
// d. LlamaContextualAndButton: enabled by either b or c.
// e. LlamaCSS: automatically enabled by add its 'LlamaCSS' button.
// 3. LlamaButton: automatically enabled by adding its 'Llama' button.
// 4. LlamaContextualAndButton: enabled by either 2 or 3.
// 5. LlamaCSS: automatically enabled by add its 'LlamaCSS' button.
// Below, we will first enable the "Llama" button, which will cause the
// LlamaButton and LlamaContextualAndButton plugins to be enabled. Then we
// will remove the "Llama" button and add the "Strike" button, which will
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment