Commit db5e8289 authored by xjm's avatar xjm
Browse files

Issue #2572787 by alexpott, mfernea, attiks, andriyun, andypost, RoSk0,...

Issue #2572787 by alexpott, mfernea, attiks, andriyun, andypost, RoSk0, hussainweb, klausi, martin107: Fix 'Drupal.WhiteSpace.CloseBracketSpacing' coding standard
parent 2fc85e7f
...@@ -50,7 +50,7 @@ public function compile($configs) { ...@@ -50,7 +50,7 @@ public function compile($configs) {
// matter and this config object does not match. // matter and this config object does not match.
// If OR and it is matching, then the rest of conditions do not // If OR and it is matching, then the rest of conditions do not
// matter and this config object does match. // matter and this config object does match.
if ($and != $match ) { if ($and != $match) {
break; break;
} }
} }
......
...@@ -133,7 +133,7 @@ public function listAll($prefix = '') { ...@@ -133,7 +133,7 @@ public function listAll($prefix = '') {
else { else {
$return = []; $return = [];
foreach ($names as $index => $name) { foreach ($names as $index => $name) {
if (strpos($name, $prefix) === 0 ) { if (strpos($name, $prefix) === 0) {
$return[$index] = $names[$index]; $return[$index] = $names[$index];
} }
} }
......
...@@ -254,7 +254,7 @@ public function initializeDatabase() { ...@@ -254,7 +254,7 @@ public function initializeDatabase() {
\'SELECT random();\' \'SELECT random();\'
LANGUAGE \'sql\'', LANGUAGE \'sql\'',
[], [],
['allow_delimiter_in_query' => TRUE ] ['allow_delimiter_in_query' => TRUE]
); );
} }
...@@ -263,7 +263,7 @@ public function initializeDatabase() { ...@@ -263,7 +263,7 @@ public function initializeDatabase() {
\'SELECT array_to_string((string_to_array($1, $2)) [1:$3], $2);\' \'SELECT array_to_string((string_to_array($1, $2)) [1:$3], $2);\'
LANGUAGE \'sql\'', LANGUAGE \'sql\'',
[], [],
['allow_delimiter_in_query' => TRUE ] ['allow_delimiter_in_query' => TRUE]
); );
} }
$connection->query('SELECT pg_advisory_unlock(1)'); $connection->query('SELECT pg_advisory_unlock(1)');
......
...@@ -192,7 +192,7 @@ protected function _changed($orig, $closing) { ...@@ -192,7 +192,7 @@ protected function _changed($orig, $closing) {
// Notice that WordLevelDiff returns HTML-escaped output. Hence, we will be // Notice that WordLevelDiff returns HTML-escaped output. Hence, we will be
// calling addedLine/deletedLine without HTML-escaping. // calling addedLine/deletedLine without HTML-escaping.
while ($line = array_shift($del)) { while ($line = array_shift($del)) {
$aline = array_shift($add ); $aline = array_shift($add);
$this->rows[] = array_merge($this->deletedLine($line), isset($aline) ? $this->addedLine($aline) : $this->emptyLine()); $this->rows[] = array_merge($this->deletedLine($line), isset($aline) ? $this->addedLine($aline) : $this->emptyLine());
} }
......
...@@ -313,7 +313,7 @@ public function __construct($definition) { ...@@ -313,7 +313,7 @@ public function __construct($definition) {
// Automatically add the EntityChanged constraint if the entity type tracks // Automatically add the EntityChanged constraint if the entity type tracks
// the changed time. // the changed time.
if ($this->entityClassImplements(EntityChangedInterface::class) ) { if ($this->entityClassImplements(EntityChangedInterface::class)) {
$this->addConstraint('EntityChanged'); $this->addConstraint('EntityChanged');
} }
......
...@@ -46,7 +46,7 @@ class EntityAdapter extends TypedData implements \IteratorAggregate, ComplexData ...@@ -46,7 +46,7 @@ class EntityAdapter extends TypedData implements \IteratorAggregate, ComplexData
public static function createFromEntity(EntityInterface $entity) { public static function createFromEntity(EntityInterface $entity) {
$definition = EntityDataDefinition::create() $definition = EntityDataDefinition::create()
->setEntityTypeId($entity->getEntityTypeId()) ->setEntityTypeId($entity->getEntityTypeId())
->setBundles([$entity->bundle() ]); ->setBundles([$entity->bundle()]);
$instance = new static($definition); $instance = new static($definition);
$instance->setValue($entity); $instance->setValue($entity);
return $instance; return $instance;
......
...@@ -226,7 +226,7 @@ public function getModuleUpdateFunctions($module_name) { ...@@ -226,7 +226,7 @@ public function getModuleUpdateFunctions($module_name) {
$all_functions = $this->getAvailableUpdateFunctions(); $all_functions = $this->getAvailableUpdateFunctions();
return array_filter($all_functions, function ($function_name) use ($module_name) { return array_filter($all_functions, function ($function_name) use ($module_name) {
list($function_module_name, ) = explode("_{$this->updateType}_", $function_name); list($function_module_name,) = explode("_{$this->updateType}_", $function_name);
return $function_module_name === $module_name; return $function_module_name === $module_name;
}); });
} }
......
...@@ -27,7 +27,7 @@ public function testActionUninstall() { ...@@ -27,7 +27,7 @@ public function testActionUninstall() {
$storage = $this->container->get('entity_type.manager')->getStorage('action'); $storage = $this->container->get('entity_type.manager')->getStorage('action');
$storage->resetCache(['user_block_user_action']); $storage->resetCache(['user_block_user_action']);
$this->assertTrue($storage->load('user_block_user_action'), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.' ); $this->assertTrue($storage->load('user_block_user_action'), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.');
$admin_user = $this->drupalCreateUser(['administer users']); $admin_user = $this->drupalCreateUser(['administer users']);
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
......
...@@ -61,7 +61,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI ...@@ -61,7 +61,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
* @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface $context_repository * @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface $context_repository
* The lazy context repository service. * The lazy context repository service.
*/ */
public function __construct(EntityTypeInterface $entity_type, ContextHandlerInterface $context_handler, ContextRepositoryInterface $context_repository ) { public function __construct(EntityTypeInterface $entity_type, ContextHandlerInterface $context_handler, ContextRepositoryInterface $context_repository) {
parent::__construct($entity_type); parent::__construct($entity_type);
$this->contextHandler = $context_handler; $this->contextHandler = $context_handler;
$this->contextRepository = $context_repository; $this->contextRepository = $context_repository;
......
...@@ -15,7 +15,7 @@ class Textarea extends FormElementBase { ...@@ -15,7 +15,7 @@ class Textarea extends FormElementBase {
public function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) { public function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
// Estimate a comfortable size of the input textarea. // Estimate a comfortable size of the input textarea.
$rows_words = ceil(str_word_count($translation_config) / 5); $rows_words = ceil(str_word_count($translation_config) / 5);
$rows_newlines = substr_count($translation_config, "\n" ) + 1; $rows_newlines = substr_count($translation_config, "\n") + 1;
$rows = max($rows_words, $rows_newlines); $rows = max($rows_words, $rows_newlines);
return [ return [
......
...@@ -347,7 +347,7 @@ public function testDeleteNoData() { ...@@ -347,7 +347,7 @@ public function testDeleteNoData() {
FieldConfig::create($field_definition)->save(); FieldConfig::create($field_definition)->save();
$field_storage = FieldStorageConfig::load('entity_test.' . $field_storage_definition['field_name']); $field_storage = FieldStorageConfig::load('entity_test.' . $field_storage_definition['field_name']);
$this->assertTrue(!empty($field_storage) && !$field_storage->isDeleted(), 'A new storage with a previously used name is created.'); $this->assertTrue(!empty($field_storage) && !$field_storage->isDeleted(), 'A new storage with a previously used name is created.');
$field = FieldConfig::load('entity_test.' . $field_definition['bundle'] . '.' . $field_definition['field_name'] ); $field = FieldConfig::load('entity_test.' . $field_definition['bundle'] . '.' . $field_definition['field_name']);
$this->assertTrue(!empty($field) && !$field->isDeleted(), 'A new field for a previously used field name is created.'); $this->assertTrue(!empty($field) && !$field->isDeleted(), 'A new field for a previously used field name is created.');
// Save an entity with data for the field // Save an entity with data for the field
......
...@@ -135,7 +135,7 @@ public function testMarkFieldForDeletion() { ...@@ -135,7 +135,7 @@ public function testMarkFieldForDeletion() {
], ],
'field_test_text' => [], 'field_test_text' => [],
]; ];
$entity = $this->serializer->denormalize($data, get_class($entity), $this->format, ['target_instance' => $entity ]); $entity = $this->serializer->denormalize($data, get_class($entity), $this->format, ['target_instance' => $entity]);
$this->assertEqual($entity->field_test_text->count(), 0); $this->assertEqual($entity->field_test_text->count(), 0);
} }
......
...@@ -193,7 +193,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s ...@@ -193,7 +193,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s
$this->drupalGet($generate_url_noaccess); $this->drupalGet($generate_url_noaccess);
$this->assertResponse(403, 'Confirmed that access is denied for the private image style.'); $this->assertResponse(403, 'Confirmed that access is denied for the private image style.');
// Verify that images are not appended to the response. Currently this test only uses PNG images. // Verify that images are not appended to the response. Currently this test only uses PNG images.
if (strpos($generate_url, '.png') === FALSE ) { if (strpos($generate_url, '.png') === FALSE) {
$this->fail('Confirming that private image styles are not appended require PNG file.'); $this->fail('Confirming that private image styles are not appended require PNG file.');
} }
else { else {
......
...@@ -139,7 +139,7 @@ public function testInvalidUpload() { ...@@ -139,7 +139,7 @@ public function testInvalidUpload() {
foreach ($this->drupalGetTestFiles('image') as $image) { foreach ($this->drupalGetTestFiles('image') as $image) {
/** @var \Drupal\Core\Image\ImageInterface $image_file */ /** @var \Drupal\Core\Image\ImageInterface $image_file */
$image_file = $image_factory->get($image->uri); $image_file = $image_factory->get($image->uri);
if ($image_file->getWidth() < 50 || $image_file->getWidth() > 100 ) { if ($image_file->getWidth() < 50 || $image_file->getWidth() > 100) {
$invalid_image = $image; $invalid_image = $image;
break; break;
} }
......
...@@ -26,7 +26,7 @@ class NegotiationBrowserForm extends ConfigFormBase { ...@@ -26,7 +26,7 @@ class NegotiationBrowserForm extends ConfigFormBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function __construct(ConfigFactoryInterface $config_factory, ConfigurableLanguageManagerInterface $language_manager ) { public function __construct(ConfigFactoryInterface $config_factory, ConfigurableLanguageManagerInterface $language_manager) {
parent::__construct($config_factory); parent::__construct($config_factory);
$this->languageManager = $language_manager; $this->languageManager = $language_manager;
} }
......
...@@ -113,7 +113,7 @@ public function testUntranslatable() { ...@@ -113,7 +113,7 @@ public function testUntranslatable() {
$this->storage->getEntityType()->willReturn($entity_type->reveal()); $this->storage->getEntityType()->willReturn($entity_type->reveal());
$destination = new EntityTestDestination( $destination = new EntityTestDestination(
['translations' => TRUE ], ['translations' => TRUE],
'', '',
[], [],
$this->migration->reveal(), $this->migration->reveal(),
......
...@@ -138,7 +138,7 @@ public function checkAll(AccountInterface $account) { ...@@ -138,7 +138,7 @@ public function checkAll(AccountInterface $account) {
$grants = static::buildGrantsQueryCondition(node_access_grants('view', $account)); $grants = static::buildGrantsQueryCondition(node_access_grants('view', $account));
if (count($grants) > 0 ) { if (count($grants) > 0) {
$query->condition($grants); $query->condition($grants);
} }
return $query->execute()->fetchField(); return $query->execute()->fetchField();
......
...@@ -184,7 +184,7 @@ public function testNodeAddWithoutContentTypes() { ...@@ -184,7 +184,7 @@ public function testNodeAddWithoutContentTypes() {
$this->assertNoLinkByHref('/admin/structure/types/add'); $this->assertNoLinkByHref('/admin/structure/types/add');
// Test /node/add page without content types. // Test /node/add page without content types.
foreach (\Drupal::entityManager()->getStorage('node_type')->loadMultiple() as $entity ) { foreach (\Drupal::entityManager()->getStorage('node_type')->loadMultiple() as $entity) {
$entity->delete(); $entity->delete();
} }
......
...@@ -574,7 +574,7 @@ public function execute() { ...@@ -574,7 +574,7 @@ public function execute() {
// Add arguments for the keyword relevance normalization number. // Add arguments for the keyword relevance normalization number.
$normalization = 1.0 / $this->normalize; $normalization = 1.0 / $this->normalize;
for ($i = 0; $i < $this->relevance_count; $i++ ) { for ($i = 0; $i < $this->relevance_count; $i++) {
$this->scoresArguments[':normalization_' . $i] = $normalization; $this->scoresArguments[':normalization_' . $i] = $normalization;
} }
......
...@@ -175,7 +175,7 @@ public function stubTest() { ...@@ -175,7 +175,7 @@ public function stubTest() {
// along by the rethrow. // along by the rethrow.
assert(FALSE, 'Lorem Ipsum'); assert(FALSE, 'Lorem Ipsum');
} }
catch (\AssertionError $e ) { catch (\AssertionError $e) {
$this->assertEqual($e->getMessage(), 'Lorem Ipsum', 'Runtime assertions Enabled and running.'); $this->assertEqual($e->getMessage(), 'Lorem Ipsum', 'Runtime assertions Enabled and running.');
} }
} }
......
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