for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace N98\Magento\Command\Installer\SubCommand;
use N98\Magento\Command\SubCommand\AbstractSubCommand;
class PreCheckPhp extends AbstractSubCommand
{
/**
* Check PHP environment against minimal required settings modules
*
* @return void
*/
public function execute()
$this->checkExtensions();
$this->checkXDebug();
}
* @return array
array|null
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.
@return
protected function checkExtensions()
$extensions = $this->commandConfig['installation']['pre-check']['php']['extensions'];
$missingExtensions = array();
foreach ($extensions as $extension) {
if (!extension_loaded($extension)) {
$missingExtensions[] = $extension;
if (count($missingExtensions) > 0) {
throw new \RuntimeException(
'The following PHP extensions are required to start installation: ' . implode(',', $missingExtensions)
);
* @throws \RuntimeException
protected function checkXDebug()
if (extension_loaded('xdebug') && xdebug_is_enabled() && ini_get('xdebug.max_nesting_level') != -1 && ini_get('xdebug.max_nesting_level') < 200) {
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.
$errorMessage = 'Please change PHP ini setting "xdebug.max_nesting_level". '
. 'Please change it to a value >= 200. '
. 'Your current value is ' . ini_get('xdebug.max_nesting_level');
throw new \RuntimeException($errorMessage);
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.