Skip to content

Instantly share code, notes, and snippets.

@mickaelandrieu
Forked from raulfraile/yamllint.php
Created October 20, 2016 08:14
Embed
What would you like to do?
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