Example #1
0
 /**
  * @param SplFileInfo $file
  *
  * @return LintErrorsCollection
  */
 public function lint(SplFileInfo $file)
 {
     $errors = new LintErrorsCollection();
     try {
         $content = file_get_contents($file->getPathname());
         Yaml::parse($content, $this->exceptionOnInvalidType, $this->objectSupport);
     } catch (ParseException $exception) {
         $exception->setParsedFile($file->getPathname());
         $errors[] = YamlLintError::fromParseException($exception);
     }
     return $errors;
 }
Example #2
0
 /**
  * @param SplFileInfo $file
  *
  * @return LintErrorsCollection
  */
 public function lint(SplFileInfo $file)
 {
     $errors = new LintErrorsCollection();
     try {
         $content = $this->filesystem->readFromFileInfo($file);
         $this->parseYaml($content);
     } catch (ParseException $exception) {
         $exception->setParsedFile($file->getPathname());
         $errors[] = YamlLintError::fromParseException($exception);
     }
     return $errors;
 }