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

Skip to content

Commit f0d27ae

Browse files
committed
repor 10000 t deprecations when linting YAML files
1 parent 4a5f22b commit f0d27ae

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +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);
107113
} catch (ParseException $e) {
108114
return array('file' => $file, 'valid' => false, 'message' => $e->getMessage());
115+
} finally {
116+
restore_error_handler();
109117
}
110118

111119
return array('file' => $file, 'valid' => true);

0 commit comments

Comments
 (0)
0