forked from vimeo/psalm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_levels_doc.php
62 lines (44 loc) · 1.44 KB
/
generate_levels_doc.php
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
55
56
57
58
59
60
61
62
<?php
use Psalm\Config\IssueHandler;
use Psalm\Issue\CodeIssue;
require_once(dirname(__DIR__) . '/vendor/autoload.php');
$issue_types = IssueHandler::getAllIssueTypes();
$grouped_issues = [];
foreach ($issue_types as $issue_type) {
$issue_class = 'Psalm\\Issue\\' . $issue_type;
if (!class_exists($issue_class) || !is_a($issue_class, CodeIssue::class, true)) {
throw new Exception($issue_class . ' is not a Codeissue');
}
/** @var int */
$issue_level = $issue_class::ERROR_LEVEL;
$grouped_issues[$issue_level][] = $issue_type;
}
?>
## Always treated as errors
<?php
foreach ($grouped_issues[-1] as $issue_type) {
echo ' - [' . $issue_type . '](issues/' . $issue_type . '.md)' . "\n";
}
?>
## Errors that only appear at level 1
<?php
foreach ($grouped_issues[1] as $issue_type) {
echo ' - [' . $issue_type . '](issues/' . $issue_type . '.md)' . "\n";
}
?>
<?php
foreach ([2, 3, 4, 5, 6, 7] as $level) {
echo '## Errors ignored at level ' . ($level + 1) . ($level < 7 ? ' and higher' : '') . "\n\n";
echo 'These issues are treated as errors at level ' . $level . ' and below.' . "\n\n";
foreach ($grouped_issues[$level] as $issue_type) {
echo ' - [' . $issue_type . '](issues/' . $issue_type . '.md)' . "\n";
}
echo "\n";
}
?>
## Feature-specific errors
<?php
foreach ($grouped_issues[-2] as $issue_type) {
echo ' - [' . $issue_type . '](issues/' . $issue_type . '.md)' . "\n";
}
?>