Merge branch '2.7' into 2.8

* 2.7:
  Fix syntax in a test
  Normalize the way we check versions
This commit is contained in:
Nicolas Grekas 2015-09-24 11:01:09 +02:00
commit 995cf4ea7d
5 changed files with 8 additions and 8 deletions

View File

@ -80,7 +80,7 @@ if ($this->env->isDebug()) {
}
EOTXT;
$expected = preg_replace('/%(.*?)%/', version_compare(PHP_VERSION, '5.4.0') >= 0 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected);
$expected = preg_replace('/%(.*?)%/', PHP_VERSION_ID >= 50400 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected);
$this->assertSame($expected, $compiler->compile($node)->getSource());
}
@ -106,7 +106,7 @@ if ($this->env->isDebug()) {
}
EOTXT;
$expected = preg_replace('/%(.*?)%/', version_compare(PHP_VERSION, '5.4.0') >= 0 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected);
$expected = preg_replace('/%(.*?)%/', PHP_VERSION_ID >= 50400 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected);
$this->assertSame($expected, $compiler->compile($node)->getSource());
}

View File

@ -23,7 +23,7 @@ abstract class ServerCommand extends ContainerAwareCommand
*/
public function isEnabled()
{
if (version_compare(phpversion(), '5.4.0', '<') || defined('HHVM_VERSION')) {
if (PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) {
return false;
}

View File

@ -36,7 +36,7 @@ abstract class AbstractComparisonValidatorTestCase extends AbstractConstraintVal
{
protected static function addPhp5Dot5Comparisons(array $comparisons)
{
if (version_compare(PHP_VERSION, '5.5.0-dev', '<')) {
if (PHP_VERSION_ID < 50500) {
return $comparisons;
}

View File

@ -69,7 +69,7 @@ class IdenticalToValidatorTest extends AbstractComparisonValidatorTestCase
array(null, 1),
);
if (version_compare(PHP_VERSION, '>=', '5.5')) {
if (PHP_VERSION_ID >= 50500) {
$immutableDate = new \DateTimeImmutable('2000-01-01');
$comparisons[] = array($immutableDate, $immutableDate);
}

View File

@ -194,7 +194,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest
array(new \DateTime('March 20, 2014')),
);
if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
if (PHP_VERSION_ID >= 50500) {
$tests[] = array(new \DateTimeImmutable('March 10, 2014'));
$tests[] = array(new \DateTimeImmutable('March 15, 2014'));
$tests[] = array(new \DateTimeImmutable('March 20, 2014'));
@ -216,7 +216,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest
array(new \DateTime('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'),
);
if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
if (PHP_VERSION_ID >= 50500) {
$tests[] = array(new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM');
$tests[] = array(new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM');
}
@ -237,7 +237,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest
array(new \DateTime('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'),
);
if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
if (PHP_VERSION_ID >= 50500) {
$tests[] = array(new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM');
$tests[] = array(new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM');
}