8000 Allow to parse custom tags when linting yaml files · symfony/symfony@59651f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 59651f7

Browse files
committed
Allow to parse custom tags when linting yaml files
1 parent 7bcb90f commit 59651f7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Symfony/Component/Yaml/Command/LintCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private function validate($content, $file = null)
112112
});
113113

114114
try {
115-
$this->getParser()->parse($content, Yaml::PARSE_CONSTANT);
115+
$this->getParser()->parse($content, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
116116
} catch (ParseException $e) {
117117
return array('file' => $file, 'valid' => false, 'message' => $e->getMessage());
118118
} finally {

src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ public function testConstantAsKey()
6060
$this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success');
6161
}
6262

63+
public function testCustomTags()
64+
{
65+
$yaml = <<<YAML
66+
foo: !my_tag {foo: bar}
67+
YAML;
68+
$ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml)), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false));
69+
$this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success');
70+
}
71+
6372
/**
6473
* @expectedException \RuntimeException
6574
*/

0 commit comments

Comments
 (0)
0