Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit261e5f8

Browse files
author
Kevin Grenier
committed
YamlEncoder handle yml format
1 parentf0168e3 commit261e5f8

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

‎src/Symfony/Component/Serializer/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
*`AbstractNormalizer::handleCircularReference` is now final, and receives two optional extra arguments: the format and the context
8+
*`YamlEncoder` now handle the`yml` format too
89

910
4.1.0
1011
-----

‎src/Symfony/Component/Serializer/Encoder/YamlEncoder.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
class YamlEncoderimplements EncoderInterface, DecoderInterface
2424
{
2525
constFORMAT ='yaml';
26+
constALTERNATIVE_FORMAT ='yml';
2627

2728
private$dumper;
2829
private$parser;
@@ -54,7 +55,7 @@ public function encode($data, $format, array $context = array())
5455
*/
5556
publicfunctionsupportsEncoding($format)
5657
{
57-
returnself::FORMAT ===$format;
58+
returnself::FORMAT ===$format ||self::ALTERNATIVE_FORMAT ===$format;
5859
}
5960

6061
/**
@@ -72,6 +73,6 @@ public function decode($data, $format, array $context = array())
7273
*/
7374
publicfunctionsupportsDecoding($format)
7475
{
75-
returnself::FORMAT ===$format;
76+
returnself::FORMAT ===$format ||self::ALTERNATIVE_FORMAT ===$format;
7677
}
7778
}

‎src/Symfony/Component/Serializer/Tests/Encoder/YamlEncoderTest.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function testSupportsEncoding()
3535
$encoder =newYamlEncoder();
3636

3737
$this->assertTrue($encoder->supportsEncoding('yaml'));
38+
$this->assertTrue($encoder->supportsEncoding('yml'));
3839
$this->assertFalse($encoder->supportsEncoding('json'));
3940
}
4041

@@ -51,6 +52,7 @@ public function testSupportsDecoding()
5152
$encoder =newYamlEncoder();
5253

5354
$this->assertTrue($encoder->supportsDecoding('yaml'));
55+
$this->assertTrue($encoder->supportsDecoding('yml'));
5456
$this->assertFalse($encoder->supportsDecoding('json'));
5557
}
5658

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp