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 9b7ee6f commit 447b7ef
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Annotation/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class Context
public function __construct(array $options = [], array $context = [], array $normalizationContext = [], array $denormalizationContext = [], $groups = [])
{
if (!$context) {
if (!array_intersect((array_keys($options)), ['normalizationContext', 'groups', 'context', 'value', 'denormalizationContext'])) {
if (!array_intersect(array_keys($options), ['normalizationContext', 'groups', 'context', 'value', 'denormalizationContext'])) {
// gracefully supports context as first, unnamed attribute argument if it cannot be confused with Doctrine-style options
$context = $options;
} else {
Expand Down
62 changes: 31 additions & 31 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 All @@ -169,7 +169,7 @@ public function testEncodeCustomSettings()
'he''llo';foo

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

public function testEncodeCustomSettingsPassedInContext()
Expand All @@ -181,12 +181,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 @@ -204,7 +204,7 @@ public function testEncodeCustomSettingsPassedInConstructor()
'he''llo';foo

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

public function testEncodeEmptyArray()
Expand Down Expand Up @@ -495,7 +495,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 @@ -513,7 +513,7 @@ public function testDecodeCollection()
f

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

public function testDecode()
Expand All @@ -527,7 +527,7 @@ public function testDecode()
a

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

public function testDecodeToManyRelation()
Expand Down Expand Up @@ -561,7 +561,7 @@ public function testDecodeNestedArrays()
a,b
c,d
CSV
, 'csv'));
, 'csv'));
}

public function testDecodeCustomSettings()
Expand All @@ -578,7 +578,7 @@ public function testDecodeCustomSettings()
a;bar-baz
'hell''o';b;c
CSV
, 'csv'));
, 'csv'));
}

public function testDecodeCustomSettingsPassedInContext()
Expand All @@ -588,12 +588,12 @@ 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 => '-',
]));
, 'csv', [
CsvEncoder::DELIMITER_KEY => ';',
CsvEncoder::ENCLOSURE_KEY => "'",
CsvEncoder::ESCAPE_CHAR_KEY => '|',
CsvEncoder::KEY_SEPARATOR_KEY => '-',
]));
}

public function testDecodeCustomSettingsPassedInConstructor()
Expand All @@ -610,7 +610,7 @@ public function testDecodeCustomSettingsPassedInConstructor()
a;bar-baz
'hell''o';b;c
CSV
, 'csv'));
, 'csv'));
}

public function testDecodeMalformedCollection()
Expand Down Expand Up @@ -643,18 +643,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
10 changes: 5 additions & 5 deletions Tests/Normalizer/FormErrorNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function setUp(): void
new FormError('a', 'b', ['c', 'd'], 5, 'f'),
new FormError(1, 2, [3, 4], 5, 6),
])
);
);
}

public function testSupportsNormalizationWithWrongClass()
Expand Down Expand Up @@ -130,21 +130,21 @@ public function testNormalizeWithChildren()
->willReturn(new FormErrorIterator($form1, [
new FormError('b'),
])
);
);
$form1->method('getName')->willReturn('form1');

$form2->method('getErrors')
->willReturn(new FormErrorIterator($form1, [
new FormError('c'),
])
);
);
$form2->method('getName')->willReturn('form2');

$form3->method('getErrors')
->willReturn(new FormErrorIterator($form1, [
new FormError('d'),
])
);
);
$form3->method('getName')->willReturn('form3');

$form2->method('all')->willReturn([$form3]);
Expand All @@ -156,7 +156,7 @@ public function testNormalizeWithChildren()
->willReturn(new FormErrorIterator($form, [
new FormError('a'),
])
);
);

$this->assertEquals($exptected, $this->normalizer->normalize($form));
}
Expand Down

0 comments on commit 447b7ef

Please sign in to comment.