function LintCommand::displayJson
File
-
vendor/
symfony/ yaml/ Command/ LintCommand.php, line 198
Class
- LintCommand
- Validates YAML files syntax and outputs encountered errors.
Namespace
Symfony\Component\Yaml\CommandCode
private function displayJson(SymfonyStyle $io, array $filesInfo) : int {
$errors = 0;
array_walk($filesInfo, function (&$v) use (&$errors) {
$v['file'] = (string) $v['file'];
if (!$v['valid']) {
++$errors;
}
if (isset($v['message']) && str_contains($v['message'], 'PARSE_CUSTOM_TAGS')) {
$v['message'] .= ' Use the --parse-tags option if you want parse custom tags.';
}
});
$io->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
return min($errors, 1);
}