Skip to content

Commit

Permalink
Normalize the way we check versions
Browse files Browse the repository at this point in the history
  • Loading branch information
romainneutron committed Sep 23, 2015
1 parent 0ad587a commit 121eade
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Tests/Node/DumpNodeTest.php
Expand Up @@ -80,7 +80,7 @@ public function testOneVar()
}
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());
}
Expand All @@ -106,7 +106,7 @@ public function testMultiVars()
}
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());
}
Expand Down
Expand Up @@ -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;
}

Expand Down
Expand Up @@ -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;
}

Expand Down
Expand Up @@ -64,7 +64,7 @@ public function provideValidComparisons()
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);
}
Expand Down
Expand Up @@ -194,7 +194,7 @@ public function getTenthToTwentiethMarch2014()
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'));
Expand All @@ -216,7 +216,7 @@ public function getSoonerThanTenthMarch2014()
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');
}
Expand All @@ -237,7 +237,7 @@ public function getLaterThanTwentiethMarch2014()
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');
}
Expand Down

0 comments on commit 121eade

Please sign in to comment.