1
0
Fork 0

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

pull/3775/head
Jordi Boggiano 2015-02-25 16:23:27 +00:00
parent 2426788cdc
commit 3ba581f0df
3 changed files with 27 additions and 1 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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';