1 | <?php |
||
10 | class PhpLinter extends ActionAbstract |
||
11 | { |
||
12 | /** @var FileList */ |
||
13 | protected $files; |
||
14 | |||
15 | /** |
||
16 | * Ensures that all the provided files are valid PHP files, terminating the |
||
17 | * process with an error and non-zero exit code, if not. |
||
18 | * |
||
19 | * @param FileList $files The files to check |
||
20 | */ |
||
21 | 7 | public function __construct(FileList $files) |
|
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | 2 | public function getName() |
|
30 | { |
||
31 | 2 | return 'PHP Syntax Check (PhpLinter)'; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | 3 | public function isSupported() |
|
38 | { |
||
39 | 3 | $process = new Process('php -v'); |
|
40 | |||
41 | 3 | if ($process->run() !== 0) { |
|
42 | $this->logger->warning( |
||
43 | sprintf( |
||
44 | 'PHP could not be executed successfully (exit code: %d): %s', |
||
45 | $process->getExitCode(), |
||
46 | $process->getOutput() |
||
47 | ) |
||
48 | ); |
||
49 | } |
||
50 | |||
51 | 3 | return $process->isSuccessful(); |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | 6 | public function execute(InputInterface $input, OutputInterface $output) |
|
99 | } |
||
100 |