1 | <?php |
||
7 | class PreCheckPhp extends AbstractSubCommand |
||
8 | { |
||
9 | /** |
||
10 | * Check PHP environment against minimal required settings modules |
||
11 | * |
||
12 | * @return void |
||
13 | */ |
||
14 | public function execute() |
||
15 | { |
||
16 | $this->checkExtensions(); |
||
17 | $this->checkXDebug(); |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * @return array |
||
|
|||
22 | */ |
||
23 | protected function checkExtensions() |
||
24 | { |
||
25 | $extensions = $this->commandConfig['installation']['pre-check']['php']['extensions']; |
||
26 | $missingExtensions = array(); |
||
27 | foreach ($extensions as $extension) { |
||
28 | if (!extension_loaded($extension)) { |
||
29 | $missingExtensions[] = $extension; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | if (count($missingExtensions) > 0) { |
||
34 | throw new \RuntimeException( |
||
35 | 'The following PHP extensions are required to start installation: ' . implode(',', $missingExtensions) |
||
36 | ); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @throws \RuntimeException |
||
42 | */ |
||
43 | protected function checkXDebug() |
||
52 | } |
||
53 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.