From fdef8041f898d1ba0c44e71ed9ec6c7c6920f422 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 20 Jun 2016 18:23:25 +0200 Subject: [PATCH 1/2] tweaked default CS fixer config --- .php_cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.php_cs b/.php_cs index 290e9bf5fbcb..604361481949 100644 --- a/.php_cs +++ b/.php_cs @@ -3,6 +3,10 @@ return Symfony\CS\Config\Config::create() ->setUsingLinter(false) ->setUsingCache(true) + ->fixers(array( + 'long_array_syntax', + 'php_unit_construct', + )) ->finder( Symfony\CS\Finder\DefaultFinder::create() ->in(__DIR__) @@ -12,6 +16,7 @@ return Symfony\CS\Config\Config::create() 'src/Symfony/Component/Routing/Tests/Fixtures/dumper', // fixture templates 'src/Symfony/Component/Templating/Tests/Fixtures/templates', + 'src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom', // resource templates 'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form', )) From 7cc3ca59d0a3f829a0a7c40e120e8f371ac207f4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 20 Jun 2016 18:47:20 +0200 Subject: [PATCH 2/2] fixed CS --- .../FrameworkBundle/Command/AbstractConfigCommand.php | 2 +- .../Compiler/ReplaceAliasByActualDefinitionPass.php | 1 - .../Core/DataTransformer/ChoicesToValuesTransformerTest.php | 2 +- .../Session/Storage/Handler/PdoSessionHandler.php | 3 +-- src/Symfony/Component/Process/Tests/ProcessTest.php | 6 ++++-- .../Component/Routing/Loader/AnnotationDirectoryLoader.php | 2 +- .../Component/Serializer/Tests/Encoder/XmlEncoderTest.php | 4 ++-- .../Tests/Normalizer/GetSetMethodNormalizerTest.php | 2 +- src/Symfony/Component/Translation/Tests/TranslatorTest.php | 6 +++--- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index d1e0f9c77130..aceaa0cbdc6d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -32,7 +32,7 @@ protected function listBundles(OutputInterface $output) $rows = array(); $bundles = $this->getContainer()->get('kernel')->getBundles(); - usort($bundles, function($bundleA, $bundleB) { + usort($bundles, function ($bundleA, $bundleB) { return strcmp($bundleA->getName(), $bundleB->getName()); }); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php index e80d3ccbf7b5..5c58656a520c 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -139,7 +139,6 @@ private function updateFactoryReference(array $replacements, $factory) $factory[0] = new Reference($replacements[$referenceId], $factory[0]->getInvalidBehavior()); } - return $factory; } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php index d6fe4edd31f0..5eb01a2ccb63 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php @@ -68,7 +68,7 @@ public function testReverseTransform() $this->assertSame($out, $this->transformer->reverseTransform($in)); // values are expected to be valid choices and stay the same - $inWithNull = array('0','1','2','3'); + $inWithNull = array('0', '1', '2', '3'); $out[] = null; $this->assertSame($out, $this->transformerWithNull->reverseTransform($inWithNull)); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 3e542f5c8727..8909a5f401fd 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -694,8 +694,7 @@ private function getMergeStatement($sessionId, $data, $maxlifetime) $mergeStmt->bindParam(6, $data, \PDO::PARAM_LOB); $mergeStmt->bindParam(7, $maxlifetime, \PDO::PARAM_INT); $mergeStmt->bindValue(8, time(), \PDO::PARAM_INT); - } - else { + } else { $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); $mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB); $mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index bb7914603eba..ce06f1c338eb 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -1180,7 +1180,8 @@ public function pipesCodeProvider() /** * @dataProvider provideVariousIncrementals */ - public function testIncrementalOutputDoesNotRequireAnotherCall($stream, $method) { + public function testIncrementalOutputDoesNotRequireAnotherCall($stream, $method) + { $process = $this->getProcess(self::$phpBin.' -r '.escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\''.$stream.'\', $n, 1); $n++; usleep(1000); }'), null, null, null, null); $process->start(); $result = ''; @@ -1195,7 +1196,8 @@ public function testIncrementalOutputDoesNotRequireAnotherCall($stream, $method) $process->stop(); } - public function provideVariousIncrementals() { + public function provideVariousIncrementals() + { return array( array('php://stdout', 'getIncrementalOutput'), array('php://stderr', 'getIncrementalErrorOutput'), diff --git a/src/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php index f6b99a16ae8b..f66b92897198 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php @@ -69,7 +69,7 @@ public function supports($resource, $type = null) if (!is_string($resource)) { return false; } - + try { $path = $this->locator->locate($resource); } catch (\Exception $e) { diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 717004af05c5..5742b0c70acc 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -249,7 +249,8 @@ public function testEncodeSerializerXmlRootNodeNameOption() $this->assertEquals($expected, $serializer->serialize($array, 'xml', $options)); } - public function testEncodeTraversableWhenNormalizable() { + public function testEncodeTraversableWhenNormalizable() + { $this->encoder = new XmlEncoder(); $serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder())); $this->encoder->setSerializer($serializer); @@ -261,7 +262,6 @@ public function testEncodeTraversableWhenNormalizable() { XML; $this->assertEquals($expected, $serializer->serialize(new NormalizableTraversableDummy(), 'xml')); - } public function testDecode() diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index d67c3754308d..9b0f0df1bdaf 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -654,7 +654,7 @@ public static function setStaticObject($object) protected function getPrivate() { - throw new \RuntimeException('Dummy::getPrivate() should not be called'); + throw new \RuntimeException('Dummy::getPrivate() should not be called'); } } diff --git a/src/Symfony/Component/Translation/Tests/TranslatorTest.php b/src/Symfony/Component/Translation/Tests/TranslatorTest.php index d2c8a6561665..ac5aaf9ec12a 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php @@ -285,12 +285,12 @@ public function testFallbackCatalogueResources() $resources = $translator->getCatalogue('en')->getResources(); $this->assertCount(1, $resources); - $this->assertContains( __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); + $this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); $resources = $translator->getCatalogue('en_GB')->getResources(); $this->assertCount(2, $resources); - $this->assertContains( __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources); - $this->assertContains( __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); + $this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources); + $this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); } /**