Commit a1d3a681 authored by alexpott's avatar alexpott
Browse files

Issue #2572693 by Mile23, andriyun, andypost, attiks: Fix...

Issue #2572693 by Mile23, andriyun, andypost, attiks: Fix 'Drupal.ControlStructures.ControlSignature' coding standard
parent e46929c5
......@@ -1595,7 +1595,7 @@ function install_download_additional_translations_operations(&$install_state) {
// should download/import translations.
$languages = \Drupal::languageManager()->getLanguages();
$operations = array();
foreach($languages as $langcode => $language) {
foreach ($languages as $langcode => $language) {
// The installer language was already downloaded. Check downloads for the
// other languages if any. Ignore any download errors here, since we
// are in the middle of an install process and there is no way back. We
......
......@@ -181,7 +181,7 @@ public function setFromArray(array $values = array()) {
if (isset($values['translation'])) {
$this->setTranslation($values['translation']);
}
if (isset($values['comment'])){
if (isset($values['comment'])) {
$this->setComment($values['comment']);
}
if (isset($this->_source) &&
......
......@@ -92,7 +92,6 @@ public function build($class_name, $proxy_class_name = '') {
// class.
if ($parent_interfaces = $interface->getInterfaceNames()) {
foreach ($parent_interfaces as $parent_interface) {
if (isset($interfaces[$parent_interface])) {}
unset($interfaces[$parent_interface]);
}
}
......
......@@ -90,7 +90,7 @@ public function removeDiacritics($string) {
$replacement = $character;
if (($range1 && !in_array($code, $exclusions_range1)) || ($range2 && !in_array($code, $exclusions_range2))) {
$to_add = $this->lookupReplacement($code, 'xyz');
if(strlen($to_add) === 1) {
if (strlen($to_add) === 1) {
$replacement = $to_add;
}
}
......
......@@ -149,7 +149,7 @@ public function word($length) {
$num_cons = count($cons);
$word = '';
while(strlen($word) < $length){
while (strlen($word) < $length) {
$word .= $cons[mt_rand(0, $num_cons - 1)] . $vowels[mt_rand(0, $num_vowels - 1)];
}
......
......@@ -122,8 +122,7 @@ public static function getBestMatchingLangcode($http_accept_language, $langcodes
$qvalue = $ua_langcodes[$prefix];
break;
}
}
while ($prefix = substr($prefix, 0, strrpos($prefix, '-')));
} while ($prefix = substr($prefix, 0, strrpos($prefix, '-')));
// Find the best match.
if ($qvalue > $max_qvalue) {
......
......@@ -76,10 +76,10 @@ public static function mergeTags(array $a = [], array $b = []) {
*/
public static function mergeMaxAges($a = Cache::PERMANENT, $b = Cache::PERMANENT) {
// If one of the values is Cache::PERMANENT, return the other value.
if ($a === Cache::PERMANENT){
if ($a === Cache::PERMANENT) {
return $b;
}
if ($b === Cache::PERMANENT){
if ($b === Cache::PERMANENT) {
return $a;
}
......
......@@ -195,7 +195,7 @@ public function optimizeTokens(array $context_tokens) {
$ancestor_found = TRUE;
}
} while(!$ancestor_found && strpos($ancestor, '.') !== FALSE);
} while (!$ancestor_found && strpos($ancestor, '.') !== FALSE);
if (!$ancestor_found) {
$optimized_content_tokens[] = $context_token;
}
......
......@@ -211,7 +211,7 @@ public function invalidateMultiple(array $cids) {
* {@inheritdoc}
*/
public function invalidateAll() {
foreach($this->storage()->listAll() as $cidhash) {
foreach ($this->storage()->listAll() as $cidhash) {
$this->invalidatebyHash($cidhash);
}
}
......
......@@ -271,7 +271,7 @@ public function getCacheKeys() {
// Because get() adds overrides both from $GLOBALS and from
// $this->configFactoryOverrides, add cache keys for each.
$keys[] = 'global_overrides';
foreach($this->configFactoryOverrides as $override) {
foreach ($this->configFactoryOverrides as $override) {
$keys[] = $override->getCacheSuffix();
}
return $keys;
......
......@@ -228,7 +228,7 @@ protected function createGraphConfigEntityDependencies($entities_to_check) {
$graph = $this->getGraph();
foreach ($entities_to_check as $entity) {
if (isset($graph[$entity]) && !empty($graph[$entity]['reverse_paths'])){
if (isset($graph[$entity]) && !empty($graph[$entity]['reverse_paths'])) {
foreach ($graph[$entity]['reverse_paths'] as $dependency => $value) {
$dependent_entities[$dependency] = $this->data[$dependency];
}
......
......@@ -79,7 +79,8 @@ public function __construct(\PDO $connection, array $connection_options = array(
public function query($query, array $args = array(), $options = array()) {
try {
return parent::query($query, $args, $options);
} catch (DatabaseException $e) {
}
catch (DatabaseException $e) {
if ($e->getPrevious()->errorInfo[1] == 1153) {
// If a max_allowed_packet error occurs the message length is truncated.
// This should prevent the error from recurring if the exception is
......
......@@ -313,7 +313,7 @@ public static function validateDatelist(&$element, FormStateInterface $form_stat
$form_state->setError($element, t('The %field date is required.'));
}
elseif (!empty($all_empty)) {
foreach ($all_empty as $value){
foreach ($all_empty as $value) {
$form_state->setError($element[$value], t('A value must be selected for %part.', array('%part' => $value)));
}
}
......
......@@ -118,7 +118,7 @@ protected function addGroupBy() {
* Returns the called object.
*/
protected function addSortAggregate() {
if(!$this->count) {
if (!$this->count) {
foreach ($this->sortAggregate as $alias => $sort) {
$this->sqlQuery->orderBy($alias, $sort['direction']);
}
......
......@@ -218,7 +218,7 @@ public function getLocalTasksForRoute($route_name) {
$definitions[$plugin_id]['base_route'] = $definitions[$task_info['parent_id']]['base_route'];
}
if ($route_name == $task_info['route_name']) {
if(!empty($task_info['base_route'])) {
if (!empty($task_info['base_route'])) {
$base_routes[$task_info['base_route']] = $task_info['base_route'];
}
// Tabs that link to the current route are viable parents
......
......@@ -125,7 +125,7 @@ public static function processVerticalTabs(&$element, FormStateInterface $form_s
// form is rendered, e.g. on preview pages or when form validation
// fails.
$name = implode('__', $element['#parents']);
if ($form_state->hasValue($name . '__active_tab')){
if ($form_state->hasValue($name . '__active_tab')) {
$element['#default_tab'] = $form_state->getValue($name . '__active_tab');
}
$element[$name . '__active_tab'] = array(
......
......@@ -442,7 +442,7 @@ protected function processHtmlHeadLink(array $html_head_link) {
*/
protected function processFeed($attached_feed) {
$html_head_link = [];
foreach($attached_feed as $item) {
foreach ($attached_feed as $item) {
$feed_link = [
'href' => $item[0],
'rel' => 'alternate',
......
......@@ -142,7 +142,8 @@ public function dump(array $options = array()) {
}
} catch (\Exception $e) {
}
catch (\Exception $e) {
$transaction->rollback();
watchdog_exception('Routing', $e);
throw $e;
......
......@@ -358,7 +358,8 @@ public function generateFromRoute($name, $parameters = array(), $options = array
$port = '';
if ('http' === $scheme && 80 != $this->context->getHttpPort()) {
$port = ':' . $this->context->getHttpPort();
} elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) {
}
elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) {
$port = ':' . $this->context->getHttpsPort();
}
if ($collect_bubbleable_metadata) {
......
......@@ -40,7 +40,7 @@ public function __invoke() {
// Call \Drupal\simpletest\WebTestBase::error() with the parameters from
// the header.
$parameters = unserialize(urldecode($header_value));
if (count($parameters) === 3) {
if (count($parameters) === 3) {
throw new \Exception($parameters[1] . ': ' . $parameters[0] . "\n" . Error::formatBacktrace([$parameters[2]]));
}
else {
......
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