diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index eabef6f..db15e85 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -16,6 +16,9 @@ 'import_constants' => null, 'import_functions' => null, ], + 'concat_space' => [ + 'spacing' => 'one', + ], 'binary_operator_spaces' => [ 'default' => 'align', ], diff --git a/src/Template/Parser/TemplateBlock.php b/src/Template/Parser/TemplateBlock.php index 215a786..a3355c6 100755 --- a/src/Template/Parser/TemplateBlock.php +++ b/src/Template/Parser/TemplateBlock.php @@ -32,7 +32,7 @@ public static function template(array $res): string $arguments = '['; // First the values from '<% arg %>' foreach (static::$arguments as $name => $value) { - $arguments .= "'".$name."' => ".$value.','; + $arguments .= "'" . $name . "' => " . $value . ','; } // Construct 'Content' argument that would hold the content from the body of '<% template %>' diff --git a/tests/ParseSpacelessTest.php b/tests/ParseSpacelessTest.php index 8819dcf..fcb4289 100644 --- a/tests/ParseSpacelessTest.php +++ b/tests/ParseSpacelessTest.php @@ -12,6 +12,11 @@ */ class ParseSpacelessTest extends SapphireTest implements TemplateGlobalProvider { + public static function tearDownAfterClass() + { + // Disable teardown to prevent db access + } + public function testSimpleSpaceCleanUp() { $template = <<<'Template' @@ -78,7 +83,7 @@ public static function get_template_global_variables() public static function Hello(?string $name): string { return html_entity_decode( - '
Hello '.$name.'
', + '
Hello ' . $name . '
', ENT_QUOTES | ENT_XML1, 'UTF-8' ); @@ -88,9 +93,4 @@ public static function Concat(): string { return html_entity_decode(implode('', func_get_args()), ENT_QUOTES | ENT_XML1, 'UTF-8'); } - - public static function tearDownAfterClass() - { - // Disable teardown to prevent db access - } } diff --git a/tests/ParseTemplateTest.php b/tests/ParseTemplateTest.php index a539c6b..a612f04 100644 --- a/tests/ParseTemplateTest.php +++ b/tests/ParseTemplateTest.php @@ -12,6 +12,11 @@ */ class ParseTemplateTest extends SapphireTest { + public static function tearDownAfterClass() + { + // Disable teardown to prevent db access + } + public function testTemplateUsage() { // Template to render @@ -168,7 +173,7 @@ protected function assertTemplate(string $template, string $expected): void // Add path to templates used for testing Config::modify()->set(SSViewer::class, 'themes', [ '$public', - __DIR__.'/support', + __DIR__ . '/support', '$default', ]); @@ -178,9 +183,4 @@ protected function assertTemplate(string $template, string $expected): void // Assert template output matches the expected $this->assertXmlStringEqualsXmlString($expected, $output); } - - public static function tearDownAfterClass() - { - // Disable teardown to prevent db access - } }