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

Appearance settings

Commit d8640f9

Browse filesBrowse files
author
Kevin Grenier
committed
YamlEncoder handle yml extension
1 parent f0168e3 commit d8640f9
Copy full SHA for d8640f9

File tree

Expand file treeCollapse file tree

3 files changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+6
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/CHANGELOG.md
+1Lines 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` extension too
89

910
4.1.0
1011
-----

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Encoder/YamlEncoder.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
class YamlEncoder implements EncoderInterface, DecoderInterface
2424
{
2525
const FORMAT = 'yaml';
26+
const ALTERNATIVE_FORMAT = 'yml';
2627

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

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

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Encoder/YamlEncoderTest.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function testSupportsEncoding()
3535
$encoder = new YamlEncoder();
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 = new YamlEncoder();
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.