Skip to content

Commit ed07aa7

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

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy