Commit f6ae5852 authored by catch's avatar catch

Issue #2572801 by alexpott, vprocessor, andriyun, andypost, chishah92, Mile23,...

Issue #2572801 by alexpott, vprocessor, andriyun, andypost, chishah92, Mile23, attiks, hussainweb, klausi, dawehner, pfrenssen: Fix 'Drupal.WhiteSpace.ScopeIndent' coding standard
parent b6a64fc0
...@@ -707,7 +707,7 @@ function update_language_list($flags = LanguageInterface::STATE_CONFIGURABLE) { ...@@ -707,7 +707,7 @@ function update_language_list($flags = LanguageInterface::STATE_CONFIGURABLE) {
// Initialize master language list. // Initialize master language list.
if (!isset($languages)) { if (!isset($languages)) {
// Initialize local language list cache. // Initialize local language list cache.
$languages = array(); $languages = array();
// Fill in master language list based on current configuration. // Fill in master language list based on current configuration.
$default = \Drupal::languageManager()->getDefaultLanguage(); $default = \Drupal::languageManager()->getDefaultLanguage();
......
...@@ -81,9 +81,9 @@ public static function sortByTitleElement($a, $b) { ...@@ -81,9 +81,9 @@ public static function sortByTitleElement($a, $b) {
* @return int * @return int
* The comparison result for uasort(). * The comparison result for uasort().
*/ */
public static function sortByTitleProperty($a, $b) { public static function sortByTitleProperty($a, $b) {
return static::sortByKeyString($a, $b, '#title'); return static::sortByKeyString($a, $b, '#title');
} }
/** /**
* Sorts a string array item by an arbitrary key. * Sorts a string array item by an arbitrary key.
......
...@@ -66,8 +66,8 @@ public function get(EntityTypeInterface $entity_type, $conjunction) { ...@@ -66,8 +66,8 @@ public function get(EntityTypeInterface $entity_type, $conjunction) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getAggregate(EntityTypeInterface $entity_type, $conjunction) { public function getAggregate(EntityTypeInterface $entity_type, $conjunction) {
throw new QueryException('Aggregation over configuration entities is not supported'); throw new QueryException('Aggregation over configuration entities is not supported');
} }
/** /**
......
...@@ -65,7 +65,7 @@ protected function connect() { ...@@ -65,7 +65,7 @@ protected function connect() {
$this->pass('Drupal can CONNECT to the database ok.'); $this->pass('Drupal can CONNECT to the database ok.');
} }
catch (\Exception $e) { catch (\Exception $e) {
// Attempt to create the database if it is not found. // Attempt to create the database if it is not found.
if ($e->getCode() == Connection::DATABASE_NOT_FOUND) { if ($e->getCode() == Connection::DATABASE_NOT_FOUND) {
// Remove the database string from connection info. // Remove the database string from connection info.
$connection_info = Database::getConnectionInfo(); $connection_info = Database::getConnectionInfo();
......
...@@ -90,7 +90,7 @@ public function rowCount(); ...@@ -90,7 +90,7 @@ public function rowCount();
* If $mode is PDO::FETCH_CLASS, the optional arguments to pass to the * If $mode is PDO::FETCH_CLASS, the optional arguments to pass to the
* constructor. * constructor.
*/ */
public function setFetchMode($mode, $a1 = NULL, $a2 = array()); public function setFetchMode($mode, $a1 = NULL, $a2 = array());
/** /**
* Fetches the next row from a result set. * Fetches the next row from a result set.
...@@ -109,7 +109,7 @@ public function setFetchMode($mode, $a1 = NULL, $a2 = array()); ...@@ -109,7 +109,7 @@ public function setFetchMode($mode, $a1 = NULL, $a2 = array());
* @return * @return
* A result, formatted according to $mode. * A result, formatted according to $mode.
*/ */
public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL); public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL);
/** /**
* Returns a single field from the next record of a result set. * Returns a single field from the next record of a result set.
...@@ -128,7 +128,7 @@ public function fetchField($index = 0); ...@@ -128,7 +128,7 @@ public function fetchField($index = 0);
* The object will be of the class specified by StatementInterface::setFetchMode() * The object will be of the class specified by StatementInterface::setFetchMode()
* or stdClass if not specified. * or stdClass if not specified.
*/ */
public function fetchObject(); public function fetchObject();
/** /**
* Fetches the next row and returns it as an associative array. * Fetches the next row and returns it as an associative array.
...@@ -155,7 +155,7 @@ public function fetchAssoc(); ...@@ -155,7 +155,7 @@ public function fetchAssoc();
* @return * @return
* An array of results. * An array of results.
*/ */
function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL); function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL);
/** /**
* Returns an entire single column of a result set as an indexed array. * Returns an entire single column of a result set as an indexed array.
......
...@@ -14,7 +14,7 @@ class Container extends DrupalContainer { ...@@ -14,7 +14,7 @@ class Container extends DrupalContainer {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) { public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) {
parent::set($id, $service, $scope); parent::set($id, $service, $scope);
// Ensure that the _serviceId property is set on synthetic services as well. // Ensure that the _serviceId property is set on synthetic services as well.
if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) { if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) {
......
...@@ -33,10 +33,10 @@ public function validate($value, Constraint $constraint) { ...@@ -33,10 +33,10 @@ public function validate($value, Constraint $constraint) {
$referenced_entities = $existing_entity->{$value->getFieldDefinition()->getName()}->referencedEntities(); $referenced_entities = $existing_entity->{$value->getFieldDefinition()->getName()}->referencedEntities();
// Check permission if we are not already referencing the entity. // Check permission if we are not already referencing the entity.
foreach ($referenced_entities as $ref) { foreach ($referenced_entities as $ref) {
if (isset($referenced_entities[$ref->id()])) { if (isset($referenced_entities[$ref->id()])) {
$check_permission = FALSE; $check_permission = FALSE;
break; break;
} }
} }
} }
// We check that the current user had access to view any newly added // We check that the current user had access to view any newly added
......
...@@ -225,7 +225,7 @@ protected function finish() { ...@@ -225,7 +225,7 @@ protected function finish() {
if ($this->range) { if ($this->range) {
$this->sqlQuery->range($this->range['start'], $this->range['length']); $this->sqlQuery->range($this->range['start'], $this->range['length']);
} }
foreach ($this->sqlGroupBy as $field) { foreach ($this->sqlGroupBy as $field) {
$this->sqlQuery->groupBy($field); $this->sqlQuery->groupBy($field);
} }
foreach ($this->sqlFields as $field) { foreach ($this->sqlFields as $field) {
......
...@@ -893,9 +893,9 @@ function hook_ENTITY_TYPE_storage_load(array $entities) { ...@@ -893,9 +893,9 @@ function hook_ENTITY_TYPE_storage_load(array $entities) {
* @see hook_ENTITY_TYPE_presave() * @see hook_ENTITY_TYPE_presave()
*/ */
function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) { function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) { if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) {
$route_match = \Drupal::routeMatch(); $route_match = \Drupal::routeMatch();
\Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->getId(), $route_match->getParameter('source_langcode')); \Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->getId(), $route_match->getParameter('source_langcode'));
} }
} }
......
...@@ -30,7 +30,7 @@ trait AllowedTagsXssTrait { ...@@ -30,7 +30,7 @@ trait AllowedTagsXssTrait {
* valid UTF-8. * valid UTF-8.
*/ */
public function fieldFilterXss($string) { public function fieldFilterXss($string) {
return FieldFilteredMarkup::create($string); return FieldFilteredMarkup::create($string);
} }
/** /**
......
...@@ -257,7 +257,7 @@ public function view($display_options = array()) { ...@@ -257,7 +257,7 @@ public function view($display_options = array()) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function generateSampleItems($count = 1) { public function generateSampleItems($count = 1) {
$field_definition = $this->getFieldDefinition(); $field_definition = $this->getFieldDefinition();
$field_type_class = \Drupal::service('plugin.manager.field.field_type')->getPluginClass($field_definition->getType()); $field_type_class = \Drupal::service('plugin.manager.field.field_type')->getPluginClass($field_definition->getType());
for ($delta = 0; $delta < $count; $delta++) { for ($delta = 0; $delta < $count; $delta++) {
......
...@@ -617,7 +617,7 @@ public static function settingsAjaxSubmit($form, FormStateInterface $form_state) ...@@ -617,7 +617,7 @@ public static function settingsAjaxSubmit($form, FormStateInterface $form_state)
$form_state->setRebuild(); $form_state->setRebuild();
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function getPreconfiguredOptions() { public static function getPreconfiguredOptions() {
......
...@@ -31,7 +31,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface { ...@@ -31,7 +31,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface {
*/ */
protected $sortedGuessers = NULL; protected $sortedGuessers = NULL;
/** /**
* The stream wrapper manager. * The stream wrapper manager.
* *
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
......
...@@ -648,7 +648,7 @@ public function disableRedirect($no_redirect = TRUE) { ...@@ -648,7 +648,7 @@ public function disableRedirect($no_redirect = TRUE) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function isRedirectDisabled() { public function isRedirectDisabled() {
return $this->no_redirect; return $this->no_redirect;
} }
/** /**
......
...@@ -123,7 +123,7 @@ protected function prepareArguments(array $arguments) { ...@@ -123,7 +123,7 @@ protected function prepareArguments(array $arguments) {
// Use the default value if the argument is not passed in. // Use the default value if the argument is not passed in.
if (!array_key_exists($id, $arguments)) { if (!array_key_exists($id, $arguments)) {
$arguments[$id] = $argument['default']; $arguments[$id] = $argument['default'];
} }
} }
} }
......
...@@ -37,7 +37,7 @@ class SiteSettingsForm extends FormBase { ...@@ -37,7 +37,7 @@ class SiteSettingsForm extends FormBase {
public function __construct($site_path, RendererInterface $renderer) { public function __construct($site_path, RendererInterface $renderer) {
$this->sitePath = $site_path; $this->sitePath = $site_path;
$this->renderer = $renderer; $this->renderer = $renderer;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -202,8 +202,7 @@ public static function htmlToText($string, $allowed_tags = NULL) { ...@@ -202,8 +202,7 @@ public static function htmlToText($string, $allowed_tags = NULL) {
// Ensure blank new-line. // Ensure blank new-line.
$chunk = ''; $chunk = '';
} }
// Intentional fall-through to the processing for '/li' and '/dd'.
// Fall-through.
case '/li': case '/li':
case '/dd': case '/dd':
array_pop($indent); array_pop($indent);
...@@ -212,6 +211,7 @@ public static function htmlToText($string, $allowed_tags = NULL) { ...@@ -212,6 +211,7 @@ public static function htmlToText($string, $allowed_tags = NULL) {
case '/h3': case '/h3':
case '/h4': case '/h4':
array_pop($indent); array_pop($indent);
// Intentional fall-through to the processing for '/h5' and '/h6'.
case '/h5': case '/h5':
case '/h6': case '/h6':
// Ensure blank new-line. // Ensure blank new-line.
......
...@@ -30,7 +30,7 @@ interface MailInterface { ...@@ -30,7 +30,7 @@ interface MailInterface {
* *
* @see \Drupal\Core\Mail\MailManagerInterface * @see \Drupal\Core\Mail\MailManagerInterface
*/ */
public function format(array $message); public function format(array $message);
/** /**
* Sends a message composed by \Drupal\Core\Mail\MailManagerInterface->mail(). * Sends a message composed by \Drupal\Core\Mail\MailManagerInterface->mail().
...@@ -60,6 +60,6 @@ public function format(array $message); ...@@ -60,6 +60,6 @@ public function format(array $message);
* @return bool * @return bool
* TRUE if the mail was successfully accepted for delivery, otherwise FALSE. * TRUE if the mail was successfully accepted for delivery, otherwise FALSE.
*/ */
public function mail(array $message); public function mail(array $message);
} }
...@@ -126,11 +126,11 @@ protected function getDiscovery() { ...@@ -126,11 +126,11 @@ protected function getDiscovery() {
public function processDefinition(&$definition, $plugin_id) { public function processDefinition(&$definition, $plugin_id) {
parent::processDefinition($definition, $plugin_id); parent::processDefinition($definition, $plugin_id);
// If there is no route name, this is a broken definition. // If there is no route name, this is a broken definition.
if (empty($definition['route_name'])) { if (empty($definition['route_name'])) {
throw new PluginException(sprintf('Contextual link plugin (%s) definition must include "route_name".', $plugin_id)); throw new PluginException(sprintf('Contextual link plugin (%s) definition must include "route_name".', $plugin_id));
} }
// If there is no group name, this is a broken definition. // If there is no group name, this is a broken definition.
if (empty($definition['group'])) { if (empty($definition['group'])) {
throw new PluginException(sprintf('Contextual link plugin (%s) definition must include "group".', $plugin_id)); throw new PluginException(sprintf('Contextual link plugin (%s) definition must include "group".', $plugin_id));
} }
......
...@@ -37,7 +37,7 @@ class DefaultMenuLinkTreeManipulators { ...@@ -37,7 +37,7 @@ class DefaultMenuLinkTreeManipulators {
* *
* @var \Drupal\Core\Entity\Query\QueryFactory * @var \Drupal\Core\Entity\Query\QueryFactory
*/ */
protected $queryFactory; protected $queryFactory;
/** /**
* Constructs a \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators object. * Constructs a \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators object.
......
...@@ -24,7 +24,7 @@ class LocalActionDefault extends PluginBase implements LocalActionInterface, Con ...@@ -24,7 +24,7 @@ class LocalActionDefault extends PluginBase implements LocalActionInterface, Con
* *
* @var \Drupal\Core\Routing\RouteProviderInterface * @var \Drupal\Core\Routing\RouteProviderInterface
*/ */
protected $routeProvider; protected $routeProvider;
/** /**
* Constructs a LocalActionDefault object. * Constructs a LocalActionDefault object.
......
...@@ -158,7 +158,7 @@ protected function getDiscovery() { ...@@ -158,7 +158,7 @@ protected function getDiscovery() {
*/ */
public function processDefinition(&$definition, $plugin_id) { public function processDefinition(&$definition, $plugin_id) {
parent::processDefinition($definition, $plugin_id); parent::processDefinition($definition, $plugin_id);
// If there is no route name, this is a broken definition. // If there is no route name, this is a broken definition.
if (empty($definition['route_name'])) { if (empty($definition['route_name'])) {
throw new PluginException(sprintf('Plugin (%s) definition must include "route_name"', $plugin_id)); throw new PluginException(sprintf('Plugin (%s) definition must include "route_name"', $plugin_id));
} }
......
...@@ -283,7 +283,7 @@ protected function pathAliasWhitelistRebuild($path = NULL) { ...@@ -283,7 +283,7 @@ protected function pathAliasWhitelistRebuild($path = NULL) {
if (!empty($path)) { if (!empty($path)) {
if ($this->whitelist->get(strtok($path, '/'))) { if ($this->whitelist->get(strtok($path, '/'))) {
return; return;
} }
} }
$this->whitelist->clear(); $this->whitelist->clear();
} }
......
...@@ -85,7 +85,7 @@ public static function create($data_type = 'any') { ...@@ -85,7 +85,7 @@ public static function create($data_type = 'any') {
* *
* @param string $data_type * @param string $data_type
* The required data type. * The required data type.
* @param mixed string|null $label * @param string|null $label
* The label of this context definition for the UI. * The label of this context definition for the UI.
* @param bool $required * @param bool $required
* Whether the context definition is required. * Whether the context definition is required.
...@@ -245,7 +245,7 @@ public function getDataDefinition() { ...@@ -245,7 +245,7 @@ public function getDataDefinition() {
->setDescription($this->getDescription()) ->setDescription($this->getDescription())
->setRequired($this->isRequired()); ->setRequired($this->isRequired());
$constraints = $definition->getConstraints() + $this->getConstraints(); $constraints = $definition->getConstraints() + $this->getConstraints();
$definition->setConstraints($constraints); $definition->setConstraints($constraints);
return $definition; return $definition;
} }
......
...@@ -555,7 +555,7 @@ function hook_form_system_theme_settings_alter(&$form, \Drupal\Core\Form\FormSta ...@@ -555,7 +555,7 @@ function hook_form_system_theme_settings_alter(&$form, \Drupal\Core\Form\FormSta
* The name of the theme hook. * The name of the theme hook.
*/ */
function hook_preprocess(&$variables, $hook) { function hook_preprocess(&$variables, $hook) {
static $hooks; static $hooks;
// Add contextual links to the variables, if the user has permission. // Add contextual links to the variables, if the user has permission.
......
...@@ -66,7 +66,7 @@ public function getExternalUrl() { ...@@ -66,7 +66,7 @@ public function getExternalUrl() {
public static function baseUrl() { public static function baseUrl() {
$settings_base_url = Settings::get('file_public_base_url', ''); $settings_base_url = Settings::get('file_public_base_url', '');
if ($settings_base_url) { if ($settings_base_url) {
return (string) $settings_base_url; return (string) $settings_base_url;
} }
else { else {
return $GLOBALS['base_url'] . '/' . static::basePath(); return $GLOBALS['base_url'] . '/' . static::basePath();
......
...@@ -44,7 +44,7 @@ interface DataDefinitionInterface { ...@@ -44,7 +44,7 @@ interface DataDefinitionInterface {
* If an unsupported data type gets passed to the class; e.g., 'string' to a * If an unsupported data type gets passed to the class; e.g., 'string' to a
* definition class handling 'entity:* data types. * definition class handling 'entity:* data types.
*/ */
public static function createFromDataType($data_type); public static function createFromDataType($data_type);
/** /**
* Returns the data type of the data. * Returns the data type of the data.
......
...@@ -53,7 +53,7 @@ function __construct($cid, CacheBackendInterface $cache, LockBackendInterface $l ...@@ -53,7 +53,7 @@ function __construct($cid, CacheBackendInterface $cache, LockBackendInterface $l
$this->tags = $tags; $this->tags = $tags;
$this->persistable = $modules_loaded && \Drupal::hasRequest() && \Drupal::request()->isMethod('GET'); $this->persistable = $modules_loaded && \Drupal::hasRequest() && \Drupal::request()->isMethod('GET');
// @todo: Implement lazyload. // @todo: Implement lazyload.
$this->cacheLoaded = TRUE; $this->cacheLoaded = TRUE;
if ($this->persistable && $cached = $this->cache->get($this->cid)) { if ($this->persistable && $cached = $this->cache->get($this->cid)) {
......
...@@ -54,7 +54,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ...@@ -54,7 +54,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setDescription(t('The ID of the feed item.')); ->setDescription(t('The ID of the feed item.'));
$fields['langcode']->setLabel(t('Language code')) $fields['langcode']->setLabel(t('Language code'))
->setDescription(t('The feed item language code.')); ->setDescription(t('The feed item language code.'));
$fields['fid'] = BaseFieldDefinition::create('entity_reference') $fields['fid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Source feed')) ->setLabel(t('Source feed'))
......
...@@ -21,11 +21,9 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter ...@@ -21,11 +21,9 @@ protected function checkAccess(EntityInterface $entity, $operation, AccountInter
switch ($operation) { switch ($operation) {
case 'view': case 'view':
return AccessResult::allowedIfHasPermission($account, 'access news feeds'); return AccessResult::allowedIfHasPermission($account, 'access news feeds');
break;
default: default:
return AccessResult::allowedIfHasPermission($account, 'administer news feeds'); return AccessResult::allowedIfHasPermission($account, 'administer news feeds');
break;
} }
} }
......
...@@ -60,17 +60,17 @@ public function viewElements(FieldItemListInterface $items, $langcode) { ...@@ -60,17 +60,17 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
} }
foreach ($items as $delta => $item) { foreach ($items as $delta => $item) {
if ($this->getSetting('display_as_link') && $url_string) { if ($this->getSetting('display_as_link') && $url_string) {
$elements[$delta] = [ $elements[$delta] = [
'#type' => 'link', '#type' => 'link',
'#title' => $item->value, '#title' => $item->value,
'#url' => Url::fromUri($url_string), '#url' => Url::fromUri($url_string),
]; ];
}
else {
$elements[$delta] = ['#markup' => $item->value];
}
} }
else {
$elements[$delta] = ['#markup' => $item->value];
}
}
return $elements; return $elements;
} }
......
...@@ -24,11 +24,11 @@ class BlockTheme extends ProcessPluginBase implements ContainerFactoryPluginInte ...@@ -24,11 +24,11 @@ class BlockTheme extends ProcessPluginBase implements ContainerFactoryPluginInte
*/ */
protected $configFactory; protected $configFactory;
/** /**
* Contains the system.theme configuration object. * Contains the system.theme configuration object.
* *
* @var \Drupal\Core\Config\Config * @var \Drupal\Core\Config\Config
*/ */
protected $themeConfig; protected $themeConfig;
/** /**
......
...@@ -63,7 +63,7 @@ protected function setUp() { ...@@ -63,7 +63,7 @@ protected function setUp() {
$this->normalUserAlt->save(); $this->normalUserAlt->save();
// Enable our test block. // Enable our test block.
$this->block = $this->drupalPlaceBlock('test_cache'); $this->block = $this->drupalPlaceBlock('test_cache');
} }
/** /**
......
...@@ -25,7 +25,7 @@ protected function setUp() { ...@@ -25,7 +25,7 @@ protected function setUp() {
parent::setUp(); parent::setUp();
// Enable our test block. // Enable our test block.
$this->drupalPlaceBlock('test_form_in_block'); $this->drupalPlaceBlock('test_form_in_block');
} }
/** /**
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
*/ */
class MigrateBlockTest extends MigrateDrupal7TestBase { class MigrateBlockTest extends MigrateDrupal7TestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static $modules = [ public static $modules = [
......
...@@ -526,49 +526,49 @@ function testNavigationBlockOnAccessModuleInstalled() { ...@@ -526,49 +526,49 @@ function testNavigationBlockOnAccessModuleInstalled() {
/** /**
* Tests the access for deleting top-level book nodes. * Tests the access for deleting top-level book nodes.
*/ */
function testBookDelete() {