Skip to content

Commit 00a9db7

Browse files
committed
Using FQ name for PHP_VERSION_ID
1 parent 804b39c commit 00a9db7

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

Data/Bundle/Writer/JsonBundleWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function write($path, $locale, $data)
3535
}
3636
});
3737

38-
if (PHP_VERSION_ID >= 50400) {
38+
if (\PHP_VERSION_ID >= 50400) {
3939
// Use JSON_PRETTY_PRINT so that we can see what changed in Git diffs
4040
file_put_contents(
4141
$path.'/'.$locale.'.json',

DateFormatter/IntlDateFormatter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function format($timestamp)
209209
$argumentError = null;
210210
if (!is_int($timestamp) && !$timestamp instanceof \DateTime) {
211211
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object';
212-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
212+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
213213
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
214214
}
215215
}
@@ -371,7 +371,7 @@ public function getTimeZoneId()
371371
}
372372

373373
// In PHP 5.5 default timezone depends on `date_default_timezone_get()` method
374-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
374+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
375375
return date_default_timezone_get();
376376
}
377377
}
@@ -536,7 +536,7 @@ public function setTimeZoneId($timeZoneId)
536536
{
537537
if (null === $timeZoneId) {
538538
// In PHP 5.5 if $timeZoneId is null it fallbacks to `date_default_timezone_get()` method
539-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
539+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
540540
$timeZoneId = date_default_timezone_get();
541541
} else {
542542
// TODO: changes were made to ext/intl in PHP 5.4.4 release that need to be investigated since it will
@@ -567,7 +567,7 @@ public function setTimeZoneId($timeZoneId)
567567
$timeZone = $this->getTimeZoneId();
568568
}
569569
} catch (\Exception $e) {
570-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
570+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
571571
$timeZoneId = $timeZone = $this->getTimeZoneId();
572572
} else {
573573
$timeZoneId = 'UTC';

NumberFormatter/NumberFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ private function getInt64Value($value)
854854
// The negative PHP_INT_MAX was being converted to float
855855
if (
856856
$value == -self::$int32Max - 1 &&
857-
((PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50314) || PHP_VERSION_ID >= 50404 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone')))
857+
((\PHP_VERSION_ID < 50400 && \PHP_VERSION_ID >= 50314) || \PHP_VERSION_ID >= 50404 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone')))
858858
) {
859859
return (int) $value;
860860
}
@@ -867,7 +867,7 @@ private function getInt64Value($value)
867867
// A 32 bit integer was being generated instead of a 64 bit integer
868868
if (
869869
($value > self::$int32Max || $value < -self::$int32Max - 1) &&
870-
(PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) &&
870+
(\PHP_VERSION_ID < 50314 || (\PHP_VERSION_ID >= 50400 && \PHP_VERSION_ID < 50404)) &&
871871
!(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))
872872
) {
873873
$value = (-2147483648 - ($value % -2147483648)) * ($value / abs($value));

Tests/Data/Bundle/Reader/IntlBundleReaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testReadFollowsAlias()
5151

5252
public function testReadDoesNotFollowFallback()
5353
{
54-
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
54+
if (\PHP_VERSION_ID < 50307 || \PHP_VERSION_ID === 50400) {
5555
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
5656
}
5757

@@ -71,7 +71,7 @@ public function testReadDoesNotFollowFallback()
7171

7272
public function testReadDoesNotFollowFallbackAlias()
7373
{
74-
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
74+
if (\PHP_VERSION_ID < 50307 || \PHP_VERSION_ID === 50400) {
7575
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
7676
}
7777

Tests/Data/Bundle/Writer/JsonBundleWriterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function setUp()
4444

4545
protected function tearDown()
4646
{
47-
if (PHP_VERSION_ID < 50400) {
47+
if (\PHP_VERSION_ID < 50400) {
4848
return;
4949
}
5050

Tests/Data/Bundle/Writer/PhpBundleWriterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testWrite()
6969
*/
7070
public function testWriteResourceBundle()
7171
{
72-
if (PHP_VERSION_ID < 50315 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) {
72+
if (\PHP_VERSION_ID < 50315 || (\PHP_VERSION_ID >= 50400 && \PHP_VERSION_ID < 50404)) {
7373
$this->markTestSkipped('ResourceBundle implements Traversable only as of PHP 5.3.15 and 5.4.4');
7474
}
7575

Tests/DateFormatter/AbstractIntlDateFormatterTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testConstructorDefaultTimeZone()
3737
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);
3838

3939
// In PHP 5.5 default timezone depends on `date_default_timezone_get()` method
40-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
40+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
4141
$this->assertEquals(date_default_timezone_get(), $formatter->getTimeZoneId());
4242
} else {
4343
$this->assertNull($formatter->getTimeZoneId());
@@ -277,7 +277,7 @@ public function testFormatIllegalArgumentError($pattern, $timestamp, $errorMessa
277277
public function formatErrorProvider()
278278
{
279279
// With PHP 5.5 IntlDateFormatter accepts empty values ('0')
280-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
280+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
281281
return array(
282282
array('y-M-d', 'foobar', 'datefmt_format: string \'foobar\' is not numeric, which would be required for it to be a valid date: U_ILLEGAL_ARGUMENT_ERROR'),
283283
);
@@ -330,7 +330,7 @@ public function formatWithTimezoneProvider()
330330
);
331331

332332
// As of PHP 5.5, intl ext no longer fallbacks invalid time zones to UTC
333-
if (PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
333+
if (\PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
334334
// When time zone not exists, uses UTC by default
335335
$data[] = array(0, 'Foo/Bar', '1970-01-01 00:00:00');
336336
$data[] = array(0, 'UTC+04:30', '1970-01-01 00:00:00');
@@ -413,7 +413,7 @@ public function testFormatWithGmtTimezone()
413413
{
414414
$formatter = $this->getDefaultDateFormatter('zzzz');
415415

416-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
416+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
417417
$formatter->setTimeZone('GMT+03:00');
418418
} else {
419419
$formatter->setTimeZoneId('GMT+03:00');
@@ -426,7 +426,7 @@ public function testFormatWithGmtTimeZoneAndMinutesOffset()
426426
{
427427
$formatter = $this->getDefaultDateFormatter('zzzz');
428428

429-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
429+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
430430
$formatter->setTimeZone('GMT+00:30');
431431
} else {
432432
$formatter->setTimeZoneId('GMT+00:30');
@@ -439,7 +439,7 @@ public function testFormatWithNonStandardTimezone()
439439
{
440440
$formatter = $this->getDefaultDateFormatter('zzzz');
441441

442-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
442+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
443443
$formatter->setTimeZone('Pacific/Fiji');
444444
} else {
445445
$formatter->setTimeZoneId('Pacific/Fiji');
@@ -471,7 +471,7 @@ public function testFormatWithDateTimeZoneGmt()
471471

472472
public function testFormatWithDateTimeZoneGmtOffset()
473473
{
474-
if (defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) {
474+
if (defined('HHVM_VERSION_ID') || \PHP_VERSION_ID <= 50509) {
475475
$this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.');
476476
}
477477

@@ -485,7 +485,7 @@ public function testFormatWithIntlTimeZone()
485485
if (!extension_loaded('intl')) {
486486
$this->markTestSkipped('Extension intl is required.');
487487
}
488-
if (PHP_VERSION_ID < 50500 && !method_exists('IntlDateFormatter', 'setTimeZone')) {
488+
if (\PHP_VERSION_ID < 50500 && !method_exists('IntlDateFormatter', 'setTimeZone')) {
489489
$this->markTestSkipped('Only in PHP 5.5+ IntlDateFormatter allows to use DateTimeZone objects.');
490490
}
491491

@@ -496,7 +496,7 @@ public function testFormatWithIntlTimeZone()
496496

497497
public function testFormatWithTimezoneFromEnvironmentVariable()
498498
{
499-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
499+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
500500
$this->markTestSkipped('IntlDateFormatter in PHP 5.5 no longer depends on TZ environment.');
501501
}
502502

@@ -519,7 +519,7 @@ public function testFormatWithTimezoneFromEnvironmentVariable()
519519

520520
public function testFormatWithTimezoneFromPhp()
521521
{
522-
if (PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
522+
if (\PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
523523
$this->markTestSkipped('Only in PHP 5.5 IntlDateFormatter depends on default timezone (`date_default_timezone_get()`).');
524524
}
525525

@@ -949,7 +949,7 @@ public function testSetTimeZoneId($timeZoneId, $expectedTimeZoneId)
949949
{
950950
$formatter = $this->getDefaultDateFormatter();
951951

952-
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
952+
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
953953
$formatter->setTimeZone($timeZoneId);
954954
} else {
955955
$formatter->setTimeZoneId($timeZoneId);
@@ -960,7 +960,7 @@ public function testSetTimeZoneId($timeZoneId, $expectedTimeZoneId)
960960

961961
public function setTimeZoneIdProvider()
962962
{
963-
$isPhp55 = PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'));
963+
$isPhp55 = \PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'));
964964

965965
return array(
966966
array('UTC', 'UTC'),

Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ public function testParseTypeInt64With32BitIntegerInPhp32Bit()
701701

702702
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
703703
// The negative PHP_INT_MAX was being converted to float
704-
if ((PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50314) || PHP_VERSION_ID >= 50404 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
704+
if ((\PHP_VERSION_ID < 50400 && \PHP_VERSION_ID >= 50314) || \PHP_VERSION_ID >= 50404 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
705705
$this->assertInternalType('int', $parsedValue);
706706
} else {
707707
$this->assertInternalType('float', $parsedValue);
@@ -758,7 +758,7 @@ public function testParseTypeInt64With64BitIntegerInPhp64Bit()
758758

759759
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
760760
// A 32 bit integer was being generated instead of a 64 bit integer
761-
if (PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) {
761+
if (\PHP_VERSION_ID < 50314 || (\PHP_VERSION_ID >= 50400 && \PHP_VERSION_ID < 50404)) {
762762
$this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
763763
} else {
764764
$this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
@@ -769,7 +769,7 @@ public function testParseTypeInt64With64BitIntegerInPhp64Bit()
769769

770770
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
771771
// A 32 bit integer was being generated instead of a 64 bit integer
772-
if (PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) {
772+
if (\PHP_VERSION_ID < 50314 || (\PHP_VERSION_ID >= 50400 && \PHP_VERSION_ID < 50404)) {
773773
$this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
774774
} else {
775775
$this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');

0 commit comments

Comments
 (0)