Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LintCommand.php

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\Command

Code

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);
}
RSS feed
Powered by Drupal