Skip to content

Instantly share code, notes, and snippets.

@raulfraile
Created June 2, 2015 09:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save raulfraile/47d3264fdc86cb3f2cd4 to your computer and use it in GitHub Desktop.
Save raulfraile/47d3264fdc86cb3f2cd4 to your computer and use it in GitHub Desktop.
YAML linter
<?php
<<<CONFIG
packages:
- "symfony/yaml: ~2.3"
CONFIG;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
$content = file_get_contents($argv[1]);
$parser = new Parser();
try {
$parser->parse($content);
} catch (ParseException $e) {
echo $e->getMessage();
return 1;
}
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment