Skip to content

Commit 0bf54ab

Browse files
committed
compare version using PHP_VERSION_ID
This continues the work started in #12497 on the `2.3` branch.
1 parent ddbb019 commit 0bf54ab

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Tests/Validator/LegacyValidator2Dot5ApiTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class LegacyValidator2Dot5ApiTest extends Abstract2Dot5ApiTest
2121
{
2222
protected function setUp()
2323
{
24-
if (version_compare(PHP_VERSION, '5.3.9', '<')) {
24+
if (PHP_VERSION_ID < 50309) {
2525
$this->markTestSkipped('Not supported prior to PHP 5.3.9');
2626
}
2727

Tests/Validator/LegacyValidatorLegacyApiTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class LegacyValidatorLegacyApiTest extends AbstractLegacyApiTest
2121
{
2222
protected function setUp()
2323
{
24-
if (version_compare(PHP_VERSION, '5.3.9', '<')) {
24+
if (PHP_VERSION_ID < 50309) {
2525
$this->markTestSkipped('Not supported prior to PHP 5.3.9');
2626
}
2727

Tests/ValidatorBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function testSetTranslationDomain()
112112

113113
public function testDefaultApiVersion()
114114
{
115-
if (version_compare(PHP_VERSION, '5.3.9', '<')) {
115+
if (PHP_VERSION_ID < 50309) {
116116
// Old implementation on PHP < 5.3.9
117117
$this->assertInstanceOf('Symfony\Component\Validator\Validator', $this->builder->getValidator());
118118
} else {
@@ -135,7 +135,7 @@ public function testSetApiVersion25()
135135

136136
public function testSetApiVersion24And25()
137137
{
138-
if (version_compare(PHP_VERSION, '5.3.9', '<')) {
138+
if (PHP_VERSION_ID < 50309) {
139139
$this->markTestSkipped('Not supported prior to PHP 5.3.9');
140140
}
141141

ValidatorBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public function setApiVersion($apiVersion)
325325
));
326326
}
327327

328-
if (version_compare(PHP_VERSION, '5.3.9', '<') && $apiVersion === Validation::API_VERSION_2_5_BC) {
328+
if (PHP_VERSION_ID < 50309 && $apiVersion === Validation::API_VERSION_2_5_BC) {
329329
throw new InvalidArgumentException(sprintf(
330330
'The Validator API that is compatible with both Symfony 2.4 '.
331331
'and Symfony 2.5 can only be used on PHP 5.3.9 and higher. '.
@@ -385,7 +385,7 @@ public function getValidator()
385385
$apiVersion = $this->apiVersion;
386386

387387
if (null === $apiVersion) {
388-
$apiVersion = version_compare(PHP_VERSION, '5.3.9', '<')
388+
$apiVersion = PHP_VERSION_ID < 50309
389389
? Validation::API_VERSION_2_4
390390
: Validation::API_VERSION_2_5_BC;
391391
}

0 commit comments

Comments
 (0)