8000 report deprecations when linting YAML files · symfony/symfony@63221ac · GitHub
[go: up one dir, main page]

Skip to content

Commit 63221ac

Browse files
committed
report deprecations when linting YAML files
1 parent 4a5f22b commit 63221ac

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
102102

103103
private function validate($content, $file = null)
104104
{
105+
set_error_handler(function ($level, $message, $file, $line) {
106+
if (E_USER_DEPRECATED === $level) {
107+
throw new ParseException($message, $line);
108+
}
109+
});
110+
105111
try {
106112
$this->getParser()->parse($content);
113+
restore_error_handler();
107114
} catch (ParseException $e) {
115+
restore_error_handler();
116+
108117
return array('file' => $file, 'valid' => false, 'message' => $e->getMessage());
109118
}
110119

0 commit comments

Comments
 (0)
0