[TwigBundle] Fix return code in LintComand
This commit is contained in:
parent
604a79aba2
commit
df5590ec60
@ -87,14 +87,18 @@ EOF
|
|||||||
$files = Finder::create()->files()->in($dir)->name('*.twig');
|
$files = Finder::create()->files()->in($dir)->name('*.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$error = false;
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
try {
|
try {
|
||||||
$twig->parse($twig->tokenize(file_get_contents($file), (string) $file));
|
$twig->parse($twig->tokenize(file_get_contents($file), (string) $file));
|
||||||
$output->writeln(sprintf("<info>OK</info> in %s", $file));
|
$output->writeln(sprintf("<info>OK</info> in %s", $file));
|
||||||
} catch (\Twig_Error $e) {
|
} catch (\Twig_Error $e) {
|
||||||
$this->renderException($output, $file, $e);
|
$this->renderException($output, $file, $e);
|
||||||
|
$error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $error ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function renderException(OutputInterface $output, $file, \Twig_Error $exception)
|
protected function renderException(OutputInterface $output, $file, \Twig_Error $exception)
|
||||||
|
Reference in New Issue
Block a user