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 ed07aa7

Browse filesBrowse files
committed
report deprecations when linting YAML files
1 parent 4a5f22b commit ed07aa7
Copy full SHA for ed07aa7

File tree

1 file changed

+10
-0
lines changed
Filter options

1 file changed

+10
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Command/LintCommand.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
102102

103103
private function validate($content, $file = null)
104104
{
105+
$prevErrorHandler = set_error_handler(function ($level, $message, $file, $line, $context) use (&$prevErrorHandler) {
106+
if (E_USER_DEPRECATED === $level) {
107+
throw new ParseException($message);
108+
}
109+
110+
return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line, $context) : false;
111+
});
112+
105113
try {
106114
$this->getParser()->parse($content);
107115
} catch (ParseException $e) {
108116
return array('file' => $file, 'valid' => false, 'message' => $e->getMessage());
117+
} finally {
118+
restore_error_handler();
109119
}
110120

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.