-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathphpstan-baseline-analyze.php
More file actions
54 lines (41 loc) · 1.17 KB
/
phpstan-baseline-analyze.php
File metadata and controls
54 lines (41 loc) · 1.17 KB
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
47
48
49
50
51
52
53
54
<?php
use staabm\PHPStanBaselineAnalysis\ResultPrinter;
// Finding composer
$paths = [
__DIR__.'/../vendor/autoload.php',
__DIR__.'/../../../autoload.php',
];
foreach ($paths as $path) {
if (file_exists($path)) {
include $path;
break;
}
}
error_reporting(E_ALL);
ini_set('display_errors', 'stderr');
$app = new \staabm\PHPStanBaselineAnalysis\AnalyzeApplication();
if (in_array('--version', $argv)) {
echo "PHPStan baseline analysis, version ". \Composer\InstalledVersions::getPrettyVersion('staabm/phpstan-baseline-analysis') ."\n";
echo "https://github.com/staabm/phpstan-baseline-analysis\n";
exit(0);
}
if ($argc <= 1) {
$app->help();
exit(254);
}
$format = ResultPrinter::FORMAT_TEXT;
if (in_array('--json', $argv)) {
$format = ResultPrinter::FORMAT_JSON;
}
$excludeOptions = preg_grep('/^--exclude=/', $argv);
if ($excludeOptions) {
$excludedFiles = preg_replace('/^--exclude=/', '', $excludeOptions);
} else {
$excludedFiles = [];
}
if (in_array('--summary', $argv)) {
$exitCode = $app->summarize($argv[1], $format, $excludedFiles);
} else {
$exitCode = $app->start($argv[1], $format);
}
exit($exitCode);