|
6 | 6 | use Sitegeist\FluidComponentsLinter\CodeQuality\Issue\IssueInterface;
|
7 | 7 | use Sitegeist\FluidComponentsLinter\CodeQuality\Output\GroupedOutput;
|
8 | 8 | use Sitegeist\FluidComponentsLinter\CodeQuality\Output\JsonOutput;
|
9 |
| -use Sitegeist\FluidComponentsLinter\Configuration\LintConfiguration; |
10 |
| -use Sitegeist\FluidComponentsLinter\Exception\ConfigurationException; |
11 | 9 | use Sitegeist\FluidComponentsLinter\Service\CodeQualityService;
|
12 | 10 | use Sitegeist\FluidComponentsLinter\Service\ComponentService;
|
13 | 11 | use Sitegeist\FluidComponentsLinter\Service\ConfigurationService;
|
14 |
| -use Symfony\Component\Config\Definition\Processor; |
| 12 | +use Symfony\Component\Console\Attribute\AsCommand; |
15 | 13 | use Symfony\Component\Console\Command\Command;
|
16 | 14 | use Symfony\Component\Console\Input\InputArgument;
|
17 | 15 | use Symfony\Component\Console\Input\InputInterface;
|
|
20 | 18 |
|
21 | 19 | class LintCommand extends Command
|
22 | 20 | {
|
23 |
| - |
24 | 21 | /**
|
25 | 22 | * Define severities which will lead to an exit status 0
|
26 |
| - * |
27 |
| - * @var array |
28 | 23 | */
|
29 |
| - protected $fatalSeverities = [ |
| 24 | + protected array $fatalSeverities = [ |
30 | 25 | IssueInterface::SEVERITY_BLOCKER,
|
31 | 26 | IssueInterface::SEVERITY_CRITICAL,
|
32 | 27 | IssueInterface::SEVERITY_MAJOR
|
33 | 28 | ];
|
34 | 29 |
|
35 |
| - protected function configure() |
| 30 | + protected function configure(): void |
36 | 31 | {
|
37 | 32 | $this
|
38 | 33 | ->setName('lint')
|
@@ -85,7 +80,7 @@ protected function configure()
|
85 | 80 | );
|
86 | 81 | }
|
87 | 82 |
|
88 |
| - protected function execute(InputInterface $input, OutputInterface $output) |
| 83 | + protected function execute(InputInterface $input, OutputInterface $output): int |
89 | 84 | {
|
90 | 85 | try {
|
91 | 86 | $configurationService = new ConfigurationService;
|
@@ -121,9 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
|
121 | 116 |
|
122 | 117 | $skipSeverities = $this->determineSeveritiesToSkip($input->getOption('severity'));
|
123 | 118 | if (!empty($skipSeverities)) {
|
124 |
| - $issues = array_filter($issues, function (IssueInterface $issue) use ($skipSeverities) { |
125 |
| - return !in_array($issue->getSeverity(), $skipSeverities); |
126 |
| - }); |
| 119 | + $issues = array_filter($issues, fn(IssueInterface $issue) => !in_array($issue->getSeverity(), $skipSeverities)); |
127 | 120 | }
|
128 | 121 |
|
129 | 122 | if ($input->getOption('json')) {
|
@@ -154,7 +147,7 @@ protected function determineExitStatus(array $issues): int
|
154 | 147 | return 0;
|
155 | 148 | }
|
156 | 149 |
|
157 |
| - protected function determineSeveritiesToSkip(string $minSeverity) |
| 150 | + protected function determineSeveritiesToSkip(string $minSeverity): array |
158 | 151 | {
|
159 | 152 | $skipSeverities = [];
|
160 | 153 | foreach (IssueInterface::SEVERITIES as $severity) {
|
|
0 commit comments