From d278688cead456c68f86603be7d856e9f82c92a3 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Thu, 27 Sep 2018 14:26:12 +0800 Subject: [PATCH] Fix CS/WS issues --- src/TextUI/TestRunner.php | 4 ++-- ...erator.php => XdebugFilterScriptGenerator.php} | 15 +++++++++++---- .../unit/Util/XDebugFilterScriptGeneratorTest.php | 4 ++-- 3 files changed, 15 insertions(+), 8 deletions(-) rename src/Util/{XDebugFilterScriptGenerator.php => XdebugFilterScriptGenerator.php} (82%) diff --git a/src/TextUI/TestRunner.php b/src/TextUI/TestRunner.php index b551072ec73..6aa2b9fe119 100644 --- a/src/TextUI/TestRunner.php +++ b/src/TextUI/TestRunner.php @@ -41,7 +41,7 @@ use PHPUnit\Util\TestDox\HtmlResultPrinter; use PHPUnit\Util\TestDox\TextResultPrinter; use PHPUnit\Util\TestDox\XmlResultPrinter; -use PHPUnit\Util\XDebugFilterScriptGenerator; +use PHPUnit\Util\XdebugFilterScriptGenerator; use ReflectionClass; use SebastianBergmann\CodeCoverage\CodeCoverage; use SebastianBergmann\CodeCoverage\Exception as CodeCoverageException; @@ -543,7 +543,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te } if (isset($arguments['xdebugFilterFile'], $filterConfiguration)) { - $filterScriptGenerator = new XDebugFilterScriptGenerator(); + $filterScriptGenerator = new XdebugFilterScriptGenerator; $script = $filterScriptGenerator->generate($filterConfiguration['whitelist']); \file_put_contents($arguments['xdebugFilterFile'], $script); diff --git a/src/Util/XDebugFilterScriptGenerator.php b/src/Util/XdebugFilterScriptGenerator.php similarity index 82% rename from src/Util/XDebugFilterScriptGenerator.php rename to src/Util/XdebugFilterScriptGenerator.php index 2ec631f76af..d2dff2a8a18 100644 --- a/src/Util/XDebugFilterScriptGenerator.php +++ b/src/Util/XdebugFilterScriptGenerator.php @@ -9,15 +9,22 @@ */ namespace PHPUnit\Util; -class XDebugFilterScriptGenerator +final class XdebugFilterScriptGenerator { public function generate(array $filterData): string { $items = $this->getWhitelistItems($filterData); - $files = \array_map(function ($item) { - return \sprintf(" '%s'", $item); - }, $items); + $files = \array_map( + function ($item) { + return \sprintf( + " '%s'", + $item + ); + }, + $items + ); + $files = \implode(",\n", $files); return <<generate($filterConfiguration); $this->assertStringEqualsFile(__DIR__ . '/_files/expectedXDebugFilterScript.txt', $actual);