diff --git a/core/lib/Drupal/Core/Render/Element/HtmlTag.php b/core/lib/Drupal/Core/Render/Element/HtmlTag.php
index 1da060bd0d..81998caa59 100644
--- a/core/lib/Drupal/Core/Render/Element/HtmlTag.php
+++ b/core/lib/Drupal/Core/Render/Element/HtmlTag.php
@@ -84,16 +84,14 @@ public static function preRenderHtmlTag($element) {
// An HTML tag should not contain any special characters. Escape them to
// ensure this cannot be abused.
$escaped_tag = HtmlUtility::escape($element['#tag']);
- $open_tag = '<' . $escaped_tag . $attributes;
+ $open_tag = '<' . $escaped_tag . $attributes . '>';
$close_tag = '' . $escaped_tag . ">\n";
// Construct a void element.
if (in_array($element['#tag'], self::$voidElements)) {
- $open_tag .= ' />';
$close_tag = "\n";
}
// Construct all other elements.
else {
- $open_tag .= '>';
if ($element['#value'] === NULL) {
$element['#markup'] = '';
}
diff --git a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
index 246cd47a64..e18cd2eed3 100644
--- a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
+++ b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
@@ -90,7 +90,7 @@ public function testNoJsDetection() {
$this->drupalLogin($this->rootUser);
$this->assertSessionCookieExists(TRUE);
$this->assertBigPipeNoJsCookieExists(FALSE);
- $this->assertSession()->responseContains('');
+ $this->assertSession()->responseContains('');
$this->assertSession()->responseNotContains($no_js_to_js_markup);
$this->assertBigPipeNoJsMetaRefreshRedirect();
$this->assertBigPipeNoJsCookieExists(TRUE);
@@ -106,7 +106,7 @@ public function testNoJsDetection() {
$this->drupalGet(Url::fromRoute('user.login'));
$this->assertSessionCookieExists(TRUE);
$this->assertBigPipeNoJsCookieExists(FALSE);
- $this->assertSession()->responseContains('');
+ $this->assertSession()->responseContains('');
$this->assertSession()->responseNotContains($no_js_to_js_markup);
$this->assertBigPipeNoJsMetaRefreshRedirect();
$this->assertBigPipeNoJsCookieExists(TRUE);
diff --git a/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php b/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php
index bcce6148bf..3c4314af92 100644
--- a/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php
+++ b/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php
@@ -21,7 +21,7 @@ class AdminMetaTagTest extends BrowserTestBase {
*/
public function testMetaTag() {
[$version] = explode('.', \Drupal::VERSION);
- $string = '';
+ $string = '';
$this->drupalGet('node');
$this->assertSession()->responseContains($string);
}
diff --git a/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php b/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php
index 5fb7ca2453..c9c2c0e812 100644
--- a/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php
+++ b/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php
@@ -29,7 +29,7 @@ class DefaultMobileMetaTagsTest extends BrowserTestBase {
protected function setUp(): void {
parent::setUp();
$this->defaultMetaTags = [
- 'viewport' => '',
+ 'viewport' => '',
];
}
diff --git a/core/modules/system/tests/src/Kernel/Common/AddFeedTest.php b/core/modules/system/tests/src/Kernel/Common/AddFeedTest.php
index 8c9d8350ac..fb5ee25913 100644
--- a/core/modules/system/tests/src/Kernel/Common/AddFeedTest.php
+++ b/core/modules/system/tests/src/Kernel/Common/AddFeedTest.php
@@ -78,7 +78,7 @@ public function testBasicFeedAddNoTitle() {
public function urlToRSSLinkPattern($url, $title = '') {
// Escape any regular expression characters in the URL ('?' is the worst).
$url = preg_replace('/([+?.*])/', '[$0]', $url);
- $generated_pattern = '%%';
+ $generated_pattern = '%%';
return $generated_pattern;
}
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
index 12a2f0ddcf..db0130b2f6 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
@@ -54,7 +54,7 @@ protected function setUpLanguage() {
// Test that \Drupal\Core\Render\BareHtmlPageRenderer adds assets and
// metatags as expected to the first page of the installer.
$this->assertSession()->responseContains("css/components/button.css");
- $this->assertSession()->responseContains('');
+ $this->assertSession()->responseContains('');
// Assert that the expected title is present.
$this->assertEquals('Choose language', $this->cssSelect('main h2')[0]->getText());
diff --git a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
index b460834948..de96bbe5b7 100644
--- a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
@@ -96,7 +96,7 @@ public function testAddFiles() {
$rendered_css = $this->renderer->renderPlain($css_render_array);
$rendered_js = $this->renderer->renderPlain($js_render_array);
$query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0';
- $this->assertStringContainsString('', $rendered_css, 'Rendering an external CSS file.');
+ $this->assertStringContainsString('', $rendered_css, 'Rendering an external CSS file.');
$this->assertStringContainsString('', $rendered_js, 'Rendering an external JavaScript file.');
}
@@ -135,7 +135,7 @@ public function testAddExternalFiles() {
$js_render_array = \Drupal::service('asset.js.collection_renderer')->render($js);
$rendered_css = $this->renderer->renderPlain($css_render_array);
$rendered_js = $this->renderer->renderPlain($js_render_array);
- $this->assertStringContainsString('', $rendered_css, 'Rendering an external CSS file.');
+ $this->assertStringContainsString('', $rendered_css, 'Rendering an external CSS file.');
$this->assertStringContainsString('', $rendered_js, 'Rendering an external JavaScript file.');
}
@@ -460,7 +460,7 @@ public function testAddJsFileWithQueryString() {
$js_render_array = \Drupal::service('asset.js.collection_renderer')->render($js);
$rendered_js = $this->renderer->renderPlain($js_render_array);
$query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0';
- $this->assertStringContainsString('', $rendered_css, 'CSS file with query string gets version query string correctly appended..');
+ $this->assertStringContainsString('', $rendered_css, 'CSS file with query string gets version query string correctly appended..');
$this->assertStringContainsString('', $rendered_js, 'JavaScript file with query string gets version query string correctly appended.');
}
diff --git a/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php b/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php
index 92ac3cec7a..538f7b515b 100644
--- a/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Layout/IconBuilderTest.php
@@ -51,10 +51,10 @@ public function providerTestBuild() {
$data['two_column'][] = <<<'EOD'
@@ -67,10 +67,10 @@ public function providerTestBuild() {
$data['two_column_no_stroke'][] = [['left', 'right']];
$data['two_column_no_stroke'][] = <<<'EOD'
@@ -84,10 +84,10 @@ public function providerTestBuild() {
$data['two_column_border_collapse'][] = [['left', 'right']];
$data['two_column_border_collapse'][] = <<<'EOD'
@@ -104,28 +104,28 @@ public function providerTestBuild() {
];
$data['stacked'][] = <<<'EOD'
diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php
index d2f36d7b73..fb429dd0b7 100644
--- a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php
@@ -86,7 +86,7 @@ public function testHtmlTag() {
'name' => 'description',
'content' => 'Drupal test',
],
- ], '' . "\n", "#type 'html_tag', void element renders properly");
+ ], '' . "\n", "#type 'html_tag', void element renders properly");
// Test non-void element.
$this->assertElements([
@@ -102,7 +102,7 @@ public function testHtmlTag() {
$this->assertElements([
'#type' => 'html_tag',
'#tag' => 'link',
- ], "\n", "#type 'html_tag' empty void element renders properly");
+ ], "\n", "#type 'html_tag' empty void element renders properly");
// Test empty non-void element tag.
$this->assertElements([
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
index 78da7e4fd7..0f559f40cf 100644
--- a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
@@ -61,7 +61,7 @@ public function providerPreRenderHtmlTag() {
$element = [
'#tag' => 'br',
];
- $tags['void-element'] = [$element, "
\n"];
+ $tags['void-element'] = [$element, "
\n"];
// Attributes.
$element = [
@@ -117,7 +117,7 @@ public function providerPreRenderHtmlTag() {
'y' => 10,
],
];
- $tags['rect'] = [$element, '' . "\n"];
+ $tags['rect'] = [$element, '' . "\n"];
$element = [
'#tag' => 'circle',
@@ -127,7 +127,7 @@ public function providerPreRenderHtmlTag() {
'r' => 100,
],
];
- $tags['circle'] = [$element, '' . "\n"];
+ $tags['circle'] = [$element, '' . "\n"];
$element = [
'#tag' => 'polygon',
@@ -135,7 +135,7 @@ public function providerPreRenderHtmlTag() {
'points' => '60,20 100,40 100,80 60,100 20,80 20,40',
],
];
- $tags['polygon'] = [$element, '' . "\n"];
+ $tags['polygon'] = [$element, '' . "\n"];
$element = [
'#tag' => 'ellipse',
@@ -146,7 +146,7 @@ public function providerPreRenderHtmlTag() {
'ry' => 25,
],
];
- $tags['ellipse'] = [$element, '' . "\n"];
+ $tags['ellipse'] = [$element, '' . "\n"];
$element = [
'#tag' => 'use',
@@ -157,7 +157,7 @@ public function providerPreRenderHtmlTag() {
'height' => 50,
],
];
- $tags['use'] = [$element, '' . "\n"];
+ $tags['use'] = [$element, '