diff --git a/core/lib/Drupal/Component/Utility/Unicode.php b/core/lib/Drupal/Component/Utility/Unicode.php
index 6590704ab5f..4fb90676214 100644
--- a/core/lib/Drupal/Component/Utility/Unicode.php
+++ b/core/lib/Drupal/Component/Utility/Unicode.php
@@ -264,7 +264,9 @@ EOD;
return substr($string, 0, $len);
}
// Scan backwards to beginning of the byte sequence.
- while (--$len >= 0 && ord($string[$len]) >= 0x80 && ord($string[$len]) < 0xC0);
+ // @todo Make the code more readable in https://www.drupal.org/node/2911497.
+ while (--$len >= 0 && ord($string[$len]) >= 0x80 && ord($string[$len]) < 0xC0) {
+ }
return substr($string, 0, $len);
}
diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php
index 3bc7447a6dd..100ef6869ca 100644
--- a/core/lib/Drupal/Core/Database/Connection.php
+++ b/core/lib/Drupal/Core/Database/Connection.php
@@ -503,8 +503,9 @@ abstract class Connection {
* A sanitized comment string.
*/
public function makeComment($comments) {
- if (empty($comments))
+ if (empty($comments)) {
return '';
+ }
// Flatten the array of comments.
$comment = implode('. ', $comments);
diff --git a/core/lib/Drupal/Core/Database/StatementPrefetch.php b/core/lib/Drupal/Core/Database/StatementPrefetch.php
index 80252209e69..4e940ea372e 100644
--- a/core/lib/Drupal/Core/Database/StatementPrefetch.php
+++ b/core/lib/Drupal/Core/Database/StatementPrefetch.php
@@ -497,8 +497,9 @@ class StatementPrefetch implements \Iterator, StatementInterface {
* {@inheritdoc}
*/
public function fetchAllKeyed($key_index = 0, $value_index = 1) {
- if (!isset($this->columnNames[$key_index]) || !isset($this->columnNames[$value_index]))
+ if (!isset($this->columnNames[$key_index]) || !isset($this->columnNames[$value_index])) {
return [];
+ }
$key = $this->columnNames[$key_index];
$value = $this->columnNames[$value_index];
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index 2de53f5c17c..b6ffa7c79e8 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -796,9 +796,15 @@ function _color_hsl2rgb($hsl) {
*/
function _color_hue2rgb($m1, $m2, $h) {
$h = ($h < 0) ? $h + 1 : (($h > 1) ? $h - 1 : $h);
- if ($h * 6 < 1) return $m1 + ($m2 - $m1) * $h * 6;
- if ($h * 2 < 1) return $m2;
- if ($h * 3 < 2) return $m1 + ($m2 - $m1) * (0.66666 - $h) * 6;
+ if ($h * 6 < 1) {
+ return $m1 + ($m2 - $m1) * $h * 6;
+ }
+ if ($h * 2 < 1) {
+ return $m2;
+ }
+ if ($h * 3 < 2) {
+ return $m1 + ($m2 - $m1) * (0.66666 - $h) * 6;
+ }
return $m1;
}
@@ -822,9 +828,15 @@ function _color_rgb2hsl($rgb) {
$h = 0;
if ($delta > 0) {
- if ($max == $r && $max != $g) $h += ($g - $b) / $delta;
- if ($max == $g && $max != $b) $h += (2 + ($b - $r) / $delta);
- if ($max == $b && $max != $r) $h += (4 + ($r - $g) / $delta);
+ if ($max == $r && $max != $g) {
+ $h += ($g - $b) / $delta;
+ }
+ if ($max == $g && $max != $b) {
+ $h += (2 + ($b - $r) / $delta);
+ }
+ if ($max == $b && $max != $r) {
+ $h += (4 + ($r - $g) / $delta);
+ }
$h /= 6;
}
diff --git a/core/modules/simpletest/src/TestServiceProvider.php b/core/modules/simpletest/src/TestServiceProvider.php
index de3117fd2aa..0097803deec 100644
--- a/core/modules/simpletest/src/TestServiceProvider.php
+++ b/core/modules/simpletest/src/TestServiceProvider.php
@@ -41,7 +41,10 @@ class TestServiceProvider implements ServiceProviderInterface, ServiceModifierIn
foreach (['router.route_provider' => 'RouteProvider'] as $original_id => $class) {
// While $container->get() does a recursive resolve, getDefinition() does
// not, so do it ourselves.
- for ($id = $original_id; $container->hasAlias($id); $id = (string) $container->getAlias($id));
+ // @todo Make the code more readable in
+ // https://www.drupal.org/node/2911498.
+ for ($id = $original_id; $container->hasAlias($id); $id = (string) $container->getAlias($id)) {
+ }
$definition = $container->getDefinition($id);
$definition->clearTag('needs_destruction');
$container->setDefinition("simpletest.$original_id", $definition);
diff --git a/core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php b/core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php
index a2df0993455..894232344b7 100644
--- a/core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php
+++ b/core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php
@@ -25,7 +25,9 @@ class TaxonomyLocalTasksTest extends LocalTaskIntegrationTestBase {
$tasks = [
0 => ['entity.taxonomy_term.canonical', 'entity.taxonomy_term.edit_form'],
];
- if ($subtask) $tasks[] = $subtask;
+ if ($subtask) {
+ $tasks[] = $subtask;
+ }
$this->assertLocalTasks($route, $tasks);
}
diff --git a/core/modules/user/tests/src/Unit/Menu/UserLocalTasksTest.php b/core/modules/user/tests/src/Unit/Menu/UserLocalTasksTest.php
index b9986c9b4c3..97cf5931f36 100644
--- a/core/modules/user/tests/src/Unit/Menu/UserLocalTasksTest.php
+++ b/core/modules/user/tests/src/Unit/Menu/UserLocalTasksTest.php
@@ -69,7 +69,9 @@ class UserLocalTasksTest extends LocalTaskIntegrationTestBase {
$tasks = [
0 => ['entity.user.canonical', 'entity.user.edit_form'],
];
- if ($subtask) $tasks[] = $subtask;
+ if ($subtask) {
+ $tasks[] = $subtask;
+ }
$this->assertLocalTasks($route, $tasks);
}
diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist
index 160e5a587f5..3d487e6f2a8 100644
--- a/core/phpcs.xml.dist
+++ b/core/phpcs.xml.dist
@@ -74,6 +74,7 @@
+
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php
index 259647167c8..d4e0442010f 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php
@@ -136,7 +136,9 @@ class EntityTypeBundleInfoTest extends UnitTestCase {
elseif (!$exception_on_invalid) {
return NULL;
}
- else throw new PluginNotFoundException($entity_type_id);
+ else {
+ throw new PluginNotFoundException($entity_type_id);
+ }
});
$this->entityTypeManager->getDefinitions()->willReturn($definitions);
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php
index 4e2a79f19d5..4c2d0893d47 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php
@@ -115,7 +115,9 @@ class EntityTypeManagerTest extends UnitTestCase {
elseif (!$exception_on_invalid) {
return NULL;
}
- else throw new PluginNotFoundException($entity_type_id);
+ else {
+ throw new PluginNotFoundException($entity_type_id);
+ }
});
$this->discovery->getDefinitions()->willReturn($definitions);
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php
index 5b372912199..915ecd68181 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php
@@ -73,7 +73,9 @@ class EntityTypeRepositoryTest extends UnitTestCase {
elseif (!$exception_on_invalid) {
return NULL;
}
- else throw new PluginNotFoundException($entity_type_id);
+ else {
+ throw new PluginNotFoundException($entity_type_id);
+ }
});
$this->entityTypeManager->getDefinitions()->willReturn($definitions);
}
diff --git a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php
index 01d0bb2686c..8bedf0750f0 100644
--- a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php
+++ b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php
@@ -101,7 +101,9 @@ class FieldDefinitionListenerTest extends UnitTestCase {
elseif (!$exception_on_invalid) {
return NULL;
}
- else throw new PluginNotFoundException($entity_type_id);
+ else {
+ throw new PluginNotFoundException($entity_type_id);
+ }
});
$this->entityTypeManager->getDefinitions()->willReturn($definitions);
}