Commit 4577185c authored by catch's avatar catch

Issue #2572791 by Mile23, andriyun, attiks, RoSk0: Fix...

Issue #2572791 by Mile23, andriyun, attiks, RoSk0: Fix 'Drupal.WhiteSpace.OpenBracketSpacing' coding standard
parent 7bf7cebe
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* An exception class to be thrown for context plugin exceptions. * An exception class to be thrown for context plugin exceptions.
*/ */
class ContextException extends \Exception implements ExceptionInterface { } class ContextException extends \Exception implements ExceptionInterface {}
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Exception interface for all exceptions thrown by the Plugin component. * Exception interface for all exceptions thrown by the Plugin component.
*/ */
interface ExceptionInterface { } interface ExceptionInterface {}
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
* Exception thrown when a decorator's _call() method is triggered, but the * Exception thrown when a decorator's _call() method is triggered, but the
* decorated object does not contain the requested method. * decorated object does not contain the requested method.
*/ */
class InvalidDecoratedMethod extends BadMethodCallException implements ExceptionInterface { } class InvalidDecoratedMethod extends BadMethodCallException implements ExceptionInterface {}
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Exception to be thrown if a plugin tries to use an invalid deriver. * Exception to be thrown if a plugin tries to use an invalid deriver.
*/ */
class InvalidDeriverException extends PluginException { } class InvalidDeriverException extends PluginException {}
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
* Extended interface for exceptions thrown specifically by the Mapper subsystem * Extended interface for exceptions thrown specifically by the Mapper subsystem
* within the Plugin component. * within the Plugin component.
*/ */
interface MapperExceptionInterface extends ExceptionInterface { } interface MapperExceptionInterface extends ExceptionInterface {}
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
* Generic Plugin exception class to be thrown when no more specific class * Generic Plugin exception class to be thrown when no more specific class
* is applicable. * is applicable.
*/ */
class PluginException extends \Exception implements ExceptionInterface { } class PluginException extends \Exception implements ExceptionInterface {}
...@@ -12,4 +12,4 @@ ...@@ -12,4 +12,4 @@
* *
* @ingroup block_api * @ingroup block_api
*/ */
interface MessagesBlockPluginInterface extends BlockPluginInterface { } interface MessagesBlockPluginInterface extends BlockPluginInterface {}
...@@ -452,7 +452,9 @@ protected function callOnDependencyRemoval(ConfigEntityInterface $entity, array ...@@ -452,7 +452,9 @@ protected function callOnDependencyRemoval(ConfigEntityInterface $entity, array
// Key the entity arrays by config dependency name to make searching easy. // Key the entity arrays by config dependency name to make searching easy.
foreach (['config', 'content'] as $dependency_type) { foreach (['config', 'content'] as $dependency_type) {
$affected_dependencies[$dependency_type] = array_combine( $affected_dependencies[$dependency_type] = array_combine(
array_map(function ($entity) { return $entity->getConfigDependencyName(); }, $affected_dependencies[$dependency_type]), array_map(function ($entity) {
return $entity->getConfigDependencyName();
}, $affected_dependencies[$dependency_type]),
$affected_dependencies[$dependency_type] $affected_dependencies[$dependency_type]
); );
} }
......
...@@ -187,7 +187,7 @@ public function __construct(\PDO $connection, array $connection_options) { ...@@ -187,7 +187,7 @@ public function __construct(\PDO $connection, array $connection_options) {
* @return \PDO * @return \PDO
* A \PDO object. * A \PDO object.
*/ */
public static function open(array &$connection_options = []) { } public static function open(array &$connection_options = []) {}
/** /**
* Destroys this Connection object. * Destroys this Connection object.
......
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* MySQL implementation of \Drupal\Core\Database\Query\Delete. * MySQL implementation of \Drupal\Core\Database\Query\Delete.
*/ */
class Delete extends QueryDelete { } class Delete extends QueryDelete {}
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* MySQL implementation of \Drupal\Core\Database\Query\Merge. * MySQL implementation of \Drupal\Core\Database\Query\Merge.
*/ */
class Merge extends QueryMerge { } class Merge extends QueryMerge {}
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* MySQL implementation of \Drupal\Core\Database\Query\Select. * MySQL implementation of \Drupal\Core\Database\Query\Select.
*/ */
class Select extends QuerySelect { } class Select extends QuerySelect {}
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* MySQL implementation of \Drupal\Core\Database\Transaction. * MySQL implementation of \Drupal\Core\Database\Transaction.
*/ */
class Transaction extends DatabaseTransaction { } class Transaction extends DatabaseTransaction {}
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* MySQL implementation of \Drupal\Core\Database\Query\Truncate. * MySQL implementation of \Drupal\Core\Database\Query\Truncate.
*/ */
class Truncate extends QueryTruncate { } class Truncate extends QueryTruncate {}
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* MySQL implementation of \Drupal\Core\Database\Query\Update. * MySQL implementation of \Drupal\Core\Database\Query\Update.
*/ */
class Update extends QueryUpdate { } class Update extends QueryUpdate {}
...@@ -128,7 +128,9 @@ public function __toString() { ...@@ -128,7 +128,9 @@ public function __toString() {
// Default fields are always placed first for consistency. // Default fields are always placed first for consistency.
$insert_fields = array_merge($this->defaultFields, $this->insertFields); $insert_fields = array_merge($this->defaultFields, $this->insertFields);
$insert_fields = array_map(function($f) { return $this->connection->escapeField($f); }, $insert_fields); $insert_fields = array_map(function($f) {
return $this->connection->escapeField($f);
}, $insert_fields);
// If we're selecting from a SelectQuery, finish building the query and // If we're selecting from a SelectQuery, finish building the query and
// pass it back, as any remaining options are irrelevant. // pass it back, as any remaining options are irrelevant.
......
...@@ -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)');
......
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* PostgreSQL implementation of \Drupal\Core\Database\Query\Merge. * PostgreSQL implementation of \Drupal\Core\Database\Query\Merge.
*/ */
class Merge extends QueryMerge { } class Merge extends QueryMerge {}
...@@ -100,7 +100,9 @@ public function __toString() { ...@@ -100,7 +100,9 @@ public function __toString() {
// Default fields are always placed first for consistency. // Default fields are always placed first for consistency.
$insert_fields = array_merge($this->defaultFields, $this->insertFields); $insert_fields = array_merge($this->defaultFields, $this->insertFields);
$insert_fields = array_map(function($f) { return $this->connection->escapeField($f); }, $insert_fields); $insert_fields = array_map(function($f) {
return $this->connection->escapeField($f);
}, $insert_fields);
$query = $comments . 'INSERT INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES '; $query = $comments . 'INSERT INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES ';
......
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* PostgreSQL implementation of \Drupal\Core\Database\Transaction. * PostgreSQL implementation of \Drupal\Core\Database\Transaction.
*/ */
class Transaction extends DatabaseTransaction { } class Transaction extends DatabaseTransaction {}
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* SQLite implementation of \Drupal\Core\Database\Query\Delete. * SQLite implementation of \Drupal\Core\Database\Query\Delete.
*/ */
class Delete extends QueryDelete { } class Delete extends QueryDelete {}
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* SQLite implementation of \Drupal\Core\Database\Query\Merge. * SQLite implementation of \Drupal\Core\Database\Query\Merge.
*/ */
class Merge extends QueryMerge { } class Merge extends QueryMerge {}
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* SQLite implementation of \Drupal\Core\Database\Transaction. * SQLite implementation of \Drupal\Core\Database\Transaction.
*/ */
class Transaction extends DatabaseTransaction { } class Transaction extends DatabaseTransaction {}
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
/** /**
* SQLite implementation of \Drupal\Core\Database\Query\Update. * SQLite implementation of \Drupal\Core\Database\Query\Update.
*/ */
class Update extends QueryUpdate { } class Update extends QueryUpdate {}
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
* This exception is thrown e.g. when trying to insert a row that would violate * This exception is thrown e.g. when trying to insert a row that would violate
* a unique key constraint. * a unique key constraint.
*/ */
class IntegrityConstraintViolationException extends \RuntimeException implements DatabaseException { } class IntegrityConstraintViolationException extends \RuntimeException implements DatabaseException {}
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
* This exception is thrown e.g. when trying to have an IN condition with an * This exception is thrown e.g. when trying to have an IN condition with an
* empty array. * empty array.
*/ */
class InvalidQueryException extends \InvalidArgumentException implements DatabaseException { } class InvalidQueryException extends \InvalidArgumentException implements DatabaseException {}
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Base exception for Schema-related errors. * Base exception for Schema-related errors.
*/ */
class SchemaException extends \RuntimeException implements DatabaseException { } class SchemaException extends \RuntimeException implements DatabaseException {}
...@@ -9,4 +9,4 @@ ...@@ -9,4 +9,4 @@
* modify a database table, field, or index that does not currently exist in * modify a database table, field, or index that does not currently exist in
* the database schema. * the database schema.
*/ */
class SchemaObjectDoesNotExistException extends SchemaException implements DatabaseException { } class SchemaObjectDoesNotExistException extends SchemaException implements DatabaseException {}
...@@ -9,4 +9,4 @@ ...@@ -9,4 +9,4 @@
* create a new database table, field, or index that already exists in the * create a new database table, field, or index that already exists in the
* database schema. * database schema.
*/ */
class SchemaObjectExistsException extends SchemaException implements DatabaseException { } class SchemaObjectExistsException extends SchemaException implements DatabaseException {}
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Exception thrown when a commit() function fails. * Exception thrown when a commit() function fails.
*/ */
class TransactionCommitFailedException extends TransactionException implements DatabaseException { } class TransactionCommitFailedException extends TransactionException implements DatabaseException {}
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Exception thrown by an error in a database transaction. * Exception thrown by an error in a database transaction.
*/ */
class TransactionException extends \RuntimeException implements DatabaseException { } class TransactionException extends \RuntimeException implements DatabaseException {}
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
* This exception will be thrown when the PDO connection commit() is called. * This exception will be thrown when the PDO connection commit() is called.
* Code should never call this method directly. * Code should never call this method directly.
*/ */
class TransactionExplicitCommitNotAllowedException extends TransactionException implements DatabaseException { } class TransactionExplicitCommitNotAllowedException extends TransactionException implements DatabaseException {}
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Exception thrown when a savepoint or transaction name occurs twice. * Exception thrown when a savepoint or transaction name occurs twice.
*/ */
class TransactionNameNonUniqueException extends TransactionException implements DatabaseException { } class TransactionNameNonUniqueException extends TransactionException implements DatabaseException {}
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Exception for when popTransaction() is called with no active transaction. * Exception for when popTransaction() is called with no active transaction.
*/ */
class TransactionNoActiveException extends TransactionException implements DatabaseException { } class TransactionNoActiveException extends TransactionException implements DatabaseException {}
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Exception thrown when a rollBack() resulted in other active transactions being rolled-back. * Exception thrown when a rollBack() resulted in other active transactions being rolled-back.
*/ */
class TransactionOutOfOrderException extends TransactionException implements DatabaseException { } class TransactionOutOfOrderException extends TransactionException implements DatabaseException {}
...@@ -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());
} }
......
...@@ -916,7 +916,9 @@ public function getTranslationStatus($langcode) { ...@@ -916,7 +916,9 @@ public function getTranslationStatus($langcode) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getTranslationLanguages($include_default = TRUE) { public function getTranslationLanguages($include_default = TRUE) {
$translations = array_filter($this->translations, function($translation) { return $translation['status']; }); $translations = array_filter($this->translations, function($translation) {
return $translation['status'];
});
unset($translations[LanguageInterface::LANGCODE_DEFAULT]); unset($translations[LanguageInterface::LANGCODE_DEFAULT]);
if ($include_default) { if ($include_default) {
......
...@@ -153,8 +153,12 @@ protected function initFieldValues(ContentEntityInterface $entity, array $values ...@@ -153,8 +153,12 @@ protected function initFieldValues(ContentEntityInterface $entity, array $values
*/ */
public function createTranslation(ContentEntityInterface $entity, $langcode, array $values = []) { public function createTranslation(ContentEntityInterface $entity, $langcode, array $values = []) {
$translation = $entity->getTranslation($langcode); $translation = $entity->getTranslation($langcode);
$definitions = array_filter($translation->getFieldDefinitions(), function(FieldDefinitionInterface $definition) { return $definition->isTranslatable(); }); $definitions = array_filter($translation->getFieldDefinitions(), function(FieldDefinitionInterface $definition) {
$field_names = array_map(function(FieldDefinitionInterface $definition) { return $definition->getName(); }, $definitions); return $definition->isTranslatable();
});
$field_names = array_map(function(FieldDefinitionInterface $definition) {
return $definition->getName();
}, $definitions);
$values[$this->langcodeKey] = $langcode; $values[$this->langcodeKey] = $langcode;
$values[$this->getEntityType()->getKey('default_langcode')] = FALSE; $values[$this->getEntityType()->getKey('default_langcode')] = FALSE;
$this->initFieldValues($translation, $values, $field_names); $this->initFieldValues($translation, $values, $field_names);
...@@ -165,32 +169,32 @@ public function createTranslation(ContentEntityInterface $entity, $langcode, arr ...@@ -165,32 +169,32 @@ public function createTranslation(ContentEntityInterface $entity, $langcode, arr
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition) { } public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) { } public function onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) { } public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldDefinitionCreate(FieldDefinitionInterface $field_definition) { } public function onFieldDefinitionCreate(FieldDefinitionInterface $field_definition) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original) { } public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition) { } public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
...@@ -234,7 +238,7 @@ public function purgeFieldData(FieldDefinitionInterface $field_definition, $batc ...@@ -234,7 +238,7 @@ public function purgeFieldData(FieldDefinitionInterface $field_definition, $batc
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function finalizePurge(FieldStorageDefinitionInterface $storage_definition) { } public function finalizePurge(FieldStorageDefinitionInterface $storage_definition) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Defines an exception thrown when a malformed entity is passed. * Defines an exception thrown when a malformed entity is passed.
*/ */
class EntityMalformedException extends \Exception { } class EntityMalformedException extends \Exception {}
...@@ -81,17 +81,17 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta ...@@ -81,17 +81,17 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { } public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { } public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function entityQueryAlter(SelectInterface $query) { } public function entityQueryAlter(SelectInterface $query) {}
/** /**
* Moves the backward compatibility level configurations in the right place. * Moves the backward compatibility level configurations in the right place.
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
/** /**
* Defines an exception thrown when storage operations fail. * Defines an exception thrown when storage operations fail.
*/ */
class EntityStorageException extends \Exception { } class EntityStorageException extends \Exception {}
...@@ -337,7 +337,7 @@ public function buildComponents(array &$build, array $entities, array $displays, ...@@ -337,7 +337,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
* @param string $view_mode * @param string $view_mode
* The view mode that should be used to prepare the entity. * The view mode that should be used to prepare the entity.
*/ */
protected function alterBuild(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) { } protected function alterBuild(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {}
/** /**
* {@inheritdoc} * {@inheritdoc}
......