Lines Matching refs:file

4  * This file is part of the Symfony package.
9 * file that was distributed with this source code.
38 protected static $defaultDescription = 'Lint a YAML file and outputs encountered errors';
61 ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')
66 The <info>%command.name%</info> command lints a YAML file and outputs to STDOUT
73 You can also validate the syntax of a file:
117 throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
126 foreach ($this->getFiles($filename) as $file) {
127 if (!\in_array($file->getPathname(), $excludes, true)) {
128 $filesInfo[] = $this->validate(file_get_contents($file), $flags, $file);
136 private function validate(string $content, int $flags, string $file = null)
138 $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) {
143 return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false;
149 return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage()];
154 return ['file' => $file, 'valid' => true];
183 $io->comment('<info>OK</info>'.($info['file'] ? sprintf(' in %s', $info['file']) : ''));
186 $io->text('<error> ERROR </error>'.($info['file'] ? sprintf(' in %s', $info['file']) : ''));
194 $githubReporter->error($info['message'], $info['file'] ?? 'php://stdin', $info['line']);
213 $v['file'] = (string) $v['file'];
236 foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
237 if (!\in_array($file->getExtension(), ['yml', 'yaml'])) {
241 yield $file;