From 7b9addc4f8429d6b5cccbe497f842733d337df70 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 20 Jul 2022 11:29:12 +0200 Subject: [PATCH] Fix CS --- Normalizer/AbstractNormalizer.php | 4 +- Normalizer/AbstractObjectNormalizer.php | 2 +- Tests/Encoder/CsvEncoderTest.php | 74 ++++++++++++------------- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Normalizer/AbstractNormalizer.php b/Normalizer/AbstractNormalizer.php index abff50039..a9f46238e 100644 --- a/Normalizer/AbstractNormalizer.php +++ b/Normalizer/AbstractNormalizer.php @@ -304,7 +304,7 @@ protected function isCircularReference($object, &$context) * * @throws CircularReferenceException */ - protected function handleCircularReference($object/*, string $format = null, array $context = []*/) + protected function handleCircularReference($object/* , string $format = null, array $context = [] */) { if (\func_num_args() < 2 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface && !$this instanceof \Mockery\MockInterface) { @trigger_error(sprintf('The "%s()" method will have two new "string $format = null" and "array $context = []" arguments in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED); @@ -542,7 +542,7 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara * * @internal */ - protected function createChildContext(array $parentContext, $attribute/*, ?string $format */): array + protected function createChildContext(array $parentContext, $attribute/* , ?string $format */): array { if (\func_num_args() < 3) { @trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', static::class, __FUNCTION__), \E_USER_DEPRECATED); diff --git a/Normalizer/AbstractObjectNormalizer.php b/Normalizer/AbstractObjectNormalizer.php index 3b64c6421..4b8df1f54 100644 --- a/Normalizer/AbstractObjectNormalizer.php +++ b/Normalizer/AbstractObjectNormalizer.php @@ -647,7 +647,7 @@ private function isMaxDepthReached(array $attributesMetadata, string $class, str * * @internal */ - protected function createChildContext(array $parentContext, $attribute/*, ?string $format */): array + protected function createChildContext(array $parentContext, $attribute/* , ?string $format */): array { if (\func_num_args() >= 3) { $format = func_get_arg(2); diff --git a/Tests/Encoder/CsvEncoderTest.php b/Tests/Encoder/CsvEncoderTest.php index 596afa28b..edfa00ce3 100644 --- a/Tests/Encoder/CsvEncoderTest.php +++ b/Tests/Encoder/CsvEncoderTest.php @@ -47,7 +47,7 @@ public function testTrueFalseValues() foo,2,0,1,1,1 CSV - , $this->encoder->encode($data, 'csv')); + , $this->encoder->encode($data, 'csv')); $this->assertSame([ 'string' => 'foo', @@ -69,7 +69,7 @@ public function testDoubleQuotesAndSlashes() ,"""","foo""","\""",\,foo\ CSV - , $this->encoder->encode($data = ['', '"', 'foo"', '\\"', '\\', 'foo\\'], 'csv')); + , $this->encoder->encode($data = ['', '"', 'foo"', '\\"', '\\', 'foo\\'], 'csv')); $this->assertSame($data, $this->encoder->decode($csv, 'csv', [CsvEncoder::AS_COLLECTION_KEY => false])); } @@ -99,7 +99,7 @@ public function testEncode() hello,"hey ho" CSV - , $this->encoder->encode($value, 'csv')); + , $this->encoder->encode($value, 'csv')); } public function testEncodeCollection() @@ -115,7 +115,7 @@ public function testEncodeCollection() hi,"let's go" CSV - , $this->encoder->encode($value, 'csv')); + , $this->encoder->encode($value, 'csv')); } public function testEncodePlainIndexedArray() @@ -150,7 +150,7 @@ public function testEncodeNestedArrays() hello,yo,wesh,Halo,olá CSV - , $this->encoder->encode($value, 'csv')); + , $this->encoder->encode($value, 'csv')); } public function testEncodeCustomSettings() @@ -183,7 +183,7 @@ private function doTestEncodeCustomSettings(bool $legacy = false) 'he''llo';foo CSV - , $this->encoder->encode($value, 'csv')); + , $this->encoder->encode($value, 'csv')); } public function testEncodeCustomSettingsPassedInContext() @@ -195,12 +195,12 @@ public function testEncodeCustomSettingsPassedInContext() 'he''llo';foo CSV - , $this->encoder->encode($value, 'csv', [ - CsvEncoder::DELIMITER_KEY => ';', - CsvEncoder::ENCLOSURE_KEY => "'", - CsvEncoder::ESCAPE_CHAR_KEY => '|', - CsvEncoder::KEY_SEPARATOR_KEY => '-', - ])); + , $this->encoder->encode($value, 'csv', [ + CsvEncoder::DELIMITER_KEY => ';', + CsvEncoder::ENCLOSURE_KEY => "'", + CsvEncoder::ESCAPE_CHAR_KEY => '|', + CsvEncoder::KEY_SEPARATOR_KEY => '-', + ])); } public function testEncodeCustomSettingsPassedInConstructor() @@ -218,7 +218,7 @@ public function testEncodeCustomSettingsPassedInConstructor() 'he''llo';foo CSV - , $encoder->encode($value, 'csv')); + , $encoder->encode($value, 'csv')); } public function testEncodeEmptyArray() @@ -527,7 +527,7 @@ public function testDecodeLegacy() foo,bar a,b CSV - , 'csv')); + , 'csv')); } public function testDecodeAsSingle() @@ -538,7 +538,7 @@ public function testDecodeAsSingle() foo,bar a,b CSV - , 'csv', [CsvEncoder::AS_COLLECTION_KEY => false])); + , 'csv', [CsvEncoder::AS_COLLECTION_KEY => false])); } public function testDecodeCollection() @@ -556,7 +556,7 @@ public function testDecodeCollection() f CSV - , 'csv')); + , 'csv')); } public function testDecode() @@ -570,9 +570,9 @@ public function testDecode() a CSV - , 'csv', [ - CsvEncoder::AS_COLLECTION_KEY => true, // Can be removed in 5.0 - ])); + , 'csv', [ + CsvEncoder::AS_COLLECTION_KEY => true, // Can be removed in 5.0 + ])); } public function testDecodeToManyRelation() @@ -606,7 +606,7 @@ public function testDecodeNestedArrays() a,b c,d CSV - , 'csv')); + , 'csv')); } public function testDecodeCustomSettings() @@ -637,9 +637,9 @@ private function doTestDecodeCustomSettings(bool $legacy = false) a;bar-baz 'hell''o';b;c CSV - , 'csv', [ - CsvEncoder::AS_COLLECTION_KEY => true, // Can be removed in 5.0 - ])); + , 'csv', [ + CsvEncoder::AS_COLLECTION_KEY => true, // Can be removed in 5.0 + ])); } public function testDecodeCustomSettingsPassedInContext() @@ -649,13 +649,13 @@ public function testDecodeCustomSettingsPassedInContext() a;bar-baz 'hell''o';b;c CSV - , 'csv', [ - CsvEncoder::DELIMITER_KEY => ';', - CsvEncoder::ENCLOSURE_KEY => "'", - CsvEncoder::ESCAPE_CHAR_KEY => '|', - CsvEncoder::KEY_SEPARATOR_KEY => '-', - CsvEncoder::AS_COLLECTION_KEY => true, // Can be removed in 5.0 - ])); + , 'csv', [ + CsvEncoder::DELIMITER_KEY => ';', + CsvEncoder::ENCLOSURE_KEY => "'", + CsvEncoder::ESCAPE_CHAR_KEY => '|', + CsvEncoder::KEY_SEPARATOR_KEY => '-', + CsvEncoder::AS_COLLECTION_KEY => true, // Can be removed in 5.0 + ])); } public function testDecodeCustomSettingsPassedInConstructor() @@ -672,7 +672,7 @@ public function testDecodeCustomSettingsPassedInConstructor() a;bar-baz 'hell''o';b;c CSV - , 'csv')); + , 'csv')); } public function testDecodeMalformedCollection() @@ -705,18 +705,18 @@ public function testDecodeWithoutHeader() c,d CSV - , 'csv', [ - CsvEncoder::NO_HEADERS_KEY => true, - ])); + , 'csv', [ + CsvEncoder::NO_HEADERS_KEY => true, + ])); $encoder = new CsvEncoder([CsvEncoder::NO_HEADERS_KEY => true]); $this->assertEquals([['a', 'b'], ['c', 'd']], $encoder->decode(<<<'CSV' a,b c,d CSV - , 'csv', [ - CsvEncoder::NO_HEADERS_KEY => true, - ])); + , 'csv', [ + CsvEncoder::NO_HEADERS_KEY => true, + ])); } public function testBOMIsAddedOnDemand()