/
codestyle
46 lines (34 loc) · 1.16 KB
/
codestyle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env php
<?php
use DragonCode\CodeStyler\Commands\Check;
use DragonCode\CodeStyler\Commands\Dependabot;
use DragonCode\CodeStyler\Commands\EditorConfig;
use DragonCode\CodeStyler\Commands\Fix;
use Symfony\Component\Console\Application;
if (PHP_SAPI !== 'cli' || PHP_MAJOR_VERSION < 8) {
echo 'Warning: codestyle should be invoked via the CLI minimum version of PHP 8.0.0, not the ' . PHP_SAPI . ' ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;
exit(1);
}
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
$possible_files = [
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
];
$file = null;
foreach ($possible_files as $possible_file) {
if (file_exists($possible_file)) {
$file = $possible_file;
break;
}
}
if (is_null($file)) {
throw new RuntimeException('Unable to locate autoload.php file.');
}
require_once $file;
$application = new Application('The Dragon Code Styler');
$application->add(new Check());
$application->add(new Fix());
$application->add(new Dependabot());
$application->add(new EditorConfig());
$application->run();