Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jul 20, 2022
1 parent 68ce84e commit 7b9addc
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions Normalizer/AbstractNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Normalizer/AbstractObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
74 changes: 37 additions & 37 deletions Tests/Encoder/CsvEncoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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]));
}
Expand Down Expand Up @@ -99,7 +99,7 @@ public function testEncode()
hello,"hey ho"

CSV
, $this->encoder->encode($value, 'csv'));
, $this->encoder->encode($value, 'csv'));
}

public function testEncodeCollection()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -218,7 +218,7 @@ public function testEncodeCustomSettingsPassedInConstructor()
'he''llo';foo

CSV
, $encoder->encode($value, 'csv'));
, $encoder->encode($value, 'csv'));
}

public function testEncodeEmptyArray()
Expand Down Expand Up @@ -527,7 +527,7 @@ public function testDecodeLegacy()
foo,bar
a,b
CSV
, 'csv'));
, 'csv'));
}

public function testDecodeAsSingle()
Expand All @@ -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()
Expand All @@ -556,7 +556,7 @@ public function testDecodeCollection()
f

CSV
, 'csv'));
, 'csv'));
}

public function testDecode()
Expand All @@ -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()
Expand Down Expand Up @@ -606,7 +606,7 @@ public function testDecodeNestedArrays()
a,b
c,d
CSV
, 'csv'));
, 'csv'));
}

public function testDecodeCustomSettings()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -672,7 +672,7 @@ public function testDecodeCustomSettingsPassedInConstructor()
a;bar-baz
'hell''o';b;c
CSV
, 'csv'));
, 'csv'));
}

public function testDecodeMalformedCollection()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 7b9addc

Please sign in to comment.