Improve error messages for required hhvm/php versions, fixes #3767

main
Jordi Boggiano 9 years ago
parent 2426788cdc
commit 3ba581f0df

@ -65,6 +65,11 @@ class Pool
}
$this->stabilityFlags = $stabilityFlags;
$this->filterRequires = $filterRequires;
foreach ($filterRequires as $name => $constraint) {
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
unset($this->filterRequires[$name]);
}
}
}
public function setWhitelist($whitelist)

@ -87,6 +87,19 @@ class Problem
}
if ($job && $job['cmd'] === 'install' && empty($packages)) {
// handle php/hhvm
if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
$msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
if (defined('HHVM_VERSION')) {
return $msg . 'your HHVM version does not satisfy that requirement.';
} elseif ($job['packageName'] === 'hhvm') {
return $msg . 'you are running this with PHP and not HHVM.';
}
return $msg . 'your PHP version does not satisfy that requirement.';
}
// handle php extensions
if (0 === stripos($job['packageName'], 'ext-')) {
$ext = substr($job['packageName'], 4);

@ -217,7 +217,15 @@ class Rule
$targetName = $this->reasonData->getTarget();
// handle php extensions
if (0 === strpos($targetName, 'ext-')) {
if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
if (defined('HHVM_VERSION')) {
$text .= ' -> your HHVM version does not satisfy that requirement.';
} elseif ($targetName === 'hhvm') {
$text .= ' -> you are running this with PHP and not HHVM.';
} else {
$text .= ' -> your PHP version does not satisfy that requirement.';
}
} elseif (0 === strpos($targetName, 'ext-')) {
$ext = substr($targetName, 4);
$error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';

Loading…
Cancel
Save