sadovnik/hexlet-psr-linter

View on GitHub
bin/psr-linter

Summary

Maintainability
Test Coverage
#!/usr/bin/env php
<?php

namespace PsrLinter;

$autoloadPaths = [
    __DIR__ . '/../vendor/autoload.php', // local dev
    __DIR__ . '/../../../autoload.php' // composer global
];

foreach ($autoloadPaths as $path) {
    if (file_exists($path)) {
        require_once $path;
        break;
    }
}

use PsrLinter\CliApp;
use PhpParser\Error;
use Docopt;

$doc = <<<DOC
PSR linter.

Usage:
    psr-linter [--fix] [--debug] <path>
    psr-linter (-h | --help)
    psr-linter --version

Options:
    --fix    try to fix automatically
    --debug  print verbose
DOC;

$args = Docopt::handle($doc, [ 'version' => 'PSR linter WIP' ]);
$app = new CliApp;
$exitCode = $app->run($args);
exit($exitCode);