Skip to content

Commit f91a020

Browse files
committed
Using FQ name for PHP_VERSION_ID
1 parent 36bd06a commit f91a020

File tree

65 files changed

+121
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+121
-121
lines changed

.github/build-packages.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
$mergeBase = trim(shell_exec(sprintf('git merge-base %s HEAD', array_shift($dirs))));
1212

1313
$packages = array();
14-
$flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
14+
$flags = \PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
1515

1616
foreach ($dirs as $k => $dir) {
1717
if (!system("git diff --name-only $mergeBase -- $dir", $exitStatus)) {

phpunit

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
77
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
88
exit(1);
99
}
10-
if (PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {
10+
if (\PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {
1111
putenv('SYMFONY_PHPUNIT_VERSION=6.0');
1212
}
1313
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');

src/Symfony/Bridge/Twig/Extension/CodeExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function formatFile($file, $line, $text = null)
174174
$text = "$text at line $line";
175175

176176
if (false !== $link = $this->getFileLink($file, $line)) {
177-
if (PHP_VERSION_ID >= 50400) {
177+
if (\PHP_VERSION_ID >= 50400) {
178178
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
179179
} else {
180180
$flags = ENT_QUOTES;

src/Symfony/Bridge/Twig/Tests/Node/DumpNodeTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ public function testOneVar()
8181
}
8282

8383
EOTXT;
84-
if (PHP_VERSION_ID >= 70000) {
84+
if (\PHP_VERSION_ID >= 70000) {
8585
$expected = preg_replace('/%(.*?)%/', '($context["$1"] ?? null)', $expected);
86-
} elseif (PHP_VERSION_ID >= 50400) {
86+
} elseif (\PHP_VERSION_ID >= 50400) {
8787
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);
8888
} else {
8989
$expected = preg_replace('/%(.*?)%/', '$this->getContext($context, "$1")', $expected);
@@ -114,9 +114,9 @@ public function testMultiVars()
114114

115115
EOTXT;
116116

117-
if (PHP_VERSION_ID >= 70000) {
117+
if (\PHP_VERSION_ID >= 70000) {
118118
$expected = preg_replace('/%(.*?)%/', '($context["$1"] ?? null)', $expected);
119-
} elseif (PHP_VERSION_ID >= 50400) {
119+
} elseif (\PHP_VERSION_ID >= 50400) {
120120
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);
121121
} else {
122122
$expected = preg_replace('/%(.*?)%/', '$this->getContext($context, "$1")', $expected);

src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ public function testCompile()
6767

6868
protected function getVariableGetter($name)
6969
{
70-
if (PHP_VERSION_ID >= 70000) {
70+
if (\PHP_VERSION_ID >= 70000) {
7171
return sprintf('($context["%s"] ?? null)', $name, $name);
7272
}
7373

74-
if (PHP_VERSION_ID >= 50400) {
74+
if (\PHP_VERSION_ID >= 50400) {
7575
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
7676
}
7777

src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,11 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
264264

265265
protected function getVariableGetter($name)
266266
{
267-
if (PHP_VERSION_ID >= 70000) {
267+
if (\PHP_VERSION_ID >= 70000) {
268268
return sprintf('($context["%s"] ?? null)', $name, $name);
269269
}
270270

271-
if (PHP_VERSION_ID >= 50400) {
271+
if (\PHP_VERSION_ID >= 50400) {
272272
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
273273
}
274274

src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public function testCompileStrict()
4040

4141
protected function getVariableGetterWithoutStrictCheck($name)
4242
{
43-
if (PHP_VERSION_ID >= 70000) {
43+
if (\PHP_VERSION_ID >= 70000) {
4444
return sprintf('($context["%s"] ?? null)', $name, $name);
4545
}
4646

47-
if (PHP_VERSION_ID >= 50400) {
47+
if (\PHP_VERSION_ID >= 50400) {
4848
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
4949
}
5050

@@ -57,11 +57,11 @@ protected function getVariableGetterWithStrictCheck($name)
5757
return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%s" does not exist.\', 0, $this->getSourceContext()); })())', $name, $name, $name, $name);
5858
}
5959

60-
if (PHP_VERSION_ID >= 70000) {
60+
if (\PHP_VERSION_ID >= 70000) {
6161
return sprintf('($context["%s"] ?? $this->getContext($context, "%s"))', $name, $name, $name);
6262
}
6363

64-
if (PHP_VERSION_ID >= 50400) {
64+
if (\PHP_VERSION_ID >= 50400) {
6565
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
6666
}
6767

src/Symfony/Bundle/FrameworkBundle/Command/ServerCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class ServerCommand extends ContainerAwareCommand
2323
*/
2424
public function isEnabled()
2525
{
26-
if (PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) {
26+
if (\PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) {
2727
return false;
2828
}
2929

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function fileExcerpt($file, $line)
154154
*/
155155
public function formatFile($file, $line, $text = null)
156156
{
157-
if (PHP_VERSION_ID >= 50400) {
157+
if (\PHP_VERSION_ID >= 50400) {
158158
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
159159
} else {
160160
$flags = ENT_QUOTES;

src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function extract($resource, MessageCatalogue $catalog)
8585
foreach ($files as $file) {
8686
$this->parseTokens(token_get_all(file_get_contents($file)), $catalog);
8787

88-
if (PHP_VERSION_ID >= 70000) {
88+
if (\PHP_VERSION_ID >= 70000) {
8989
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
9090
gc_mem_caches();
9191
}

src/Symfony/Component/ClassLoader/ClassCollectionLoader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public static function fixNamespaceDeclarations($source)
232232

233233
$output .= self::compressCode($rawChunk);
234234

235-
if (PHP_VERSION_ID >= 70000) {
235+
if (\PHP_VERSION_ID >= 70000) {
236236
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
237237
unset($tokens, $rawChunk);
238238
gc_mem_caches();

src/Symfony/Component/ClassLoader/ClassMapGenerator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\ClassLoader;
1313

1414
if (!defined('SYMFONY_TRAIT')) {
15-
if (PHP_VERSION_ID >= 50400) {
15+
if (\PHP_VERSION_ID >= 50400) {
1616
define('SYMFONY_TRAIT', T_TRAIT);
1717
} else {
1818
define('SYMFONY_TRAIT', 0);
@@ -72,7 +72,7 @@ public static function createMap($dir)
7272

7373
$classes = self::findClasses($path);
7474

75-
if (PHP_VERSION_ID >= 70000) {
75+
if (\PHP_VERSION_ID >= 70000) {
7676
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
7777
gc_mem_caches();
7878
}

src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function getTestCreateMapTests()
108108
)),
109109
);
110110

111-
if (PHP_VERSION_ID >= 50400) {
111+
if (\PHP_VERSION_ID >= 50400) {
112112
$data[] = array(__DIR__.'/Fixtures/php5.4', array(
113113
'TFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
114114
'CFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
@@ -119,7 +119,7 @@ public function getTestCreateMapTests()
119119
));
120120
}
121121

122-
if (PHP_VERSION_ID >= 50500) {
122+
if (\PHP_VERSION_ID >= 50500) {
123123
$data[] = array(__DIR__.'/Fixtures/php5.5', array(
124124
'ClassCons\\Foo' => __DIR__.'/Fixtures/php5.5/class_cons.php',
125125
));

src/Symfony/Component/Console/Descriptor/TextDescriptor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private function formatDefaultValue($default)
247247
}
248248
}
249249

250-
if (PHP_VERSION_ID < 50400) {
250+
if (\PHP_VERSION_ID < 50400) {
251251
return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
252252
}
253253

src/Symfony/Component/Debug/ErrorHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public function handleError($type, $message, $file, $line)
404404
$throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
405405
}
406406

407-
if (PHP_VERSION_ID <= 50407 && (PHP_VERSION_ID >= 50400 || PHP_VERSION_ID <= 50317)) {
407+
if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
408408
// Exceptions thrown from error handlers are sometimes not caught by the exception
409409
// handler and shutdown handlers are bypassed before 5.4.8/5.3.18.
410410
// We temporarily re-enable display_errors to prevent any blank page related to this bug.

src/Symfony/Component/Debug/ExceptionHandler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,15 @@ protected static function utf8Htmlize($str)
434434
{
435435
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
436436

437-
return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
437+
return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
438438
}
439439

440440
/**
441441
* HTML-encodes a string.
442442
*/
443443
private function escapeHtml($str)
444444
{
445-
return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
445+
return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
446446
}
447447

448448
/**

src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testIdempotence()
6161

6262
public function testUnsilencing()
6363
{
64-
if (PHP_VERSION_ID >= 70000) {
64+
if (\PHP_VERSION_ID >= 70000) {
6565
$this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.');
6666
}
6767
if (defined('HHVM_VERSION')) {
@@ -111,7 +111,7 @@ class ChildTestingStacking extends TestingStacking { function foo($bar) {} }
111111
restore_error_handler();
112112
restore_exception_handler();
113113
$this->assertStringStartsWith(__FILE__, $exception->getFile());
114-
if (PHP_VERSION_ID < 70000) {
114+
if (\PHP_VERSION_ID < 70000) {
115115
$this->assertRegExp('/^Runtime Notice: Declaration/', $exception->getMessage());
116116
$this->assertEquals(E_STRICT, $exception->getSeverity());
117117
} else {
@@ -227,7 +227,7 @@ class_exists('Symfony\Bridge\Debug\Tests\Fixtures\ExtendsDeprecatedParent', true
227227

228228
public function testReservedForPhp7()
229229
{
230-
if (PHP_VERSION_ID >= 70000) {
230+
if (\PHP_VERSION_ID >= 70000) {
231231
$this->markTestSkipped('PHP7 already prevents using reserved names.');
232232
}
233233

src/Symfony/Component/ExpressionLanguage/Parser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public function parsePostfixExpression($node)
344344

345345
$node = new Node\GetAttrNode($node, $arg, $arguments, $type);
346346
} elseif ('[' === $token->value) {
347-
if ($node instanceof Node\GetAttrNode && Node\GetAttrNode::METHOD_CALL === $node->attributes['type'] && PHP_VERSION_ID < 50400) {
347+
if ($node instanceof Node\GetAttrNode && Node\GetAttrNode::METHOD_CALL === $node->attributes['type'] && \PHP_VERSION_ID < 50400) {
348348
throw new SyntaxError('Array calls on a method call is only supported on PHP 5.4+', $token->cursor, $this->stream->getExpression());
349349
}
350350

src/Symfony/Component/Finder/Iterator/FilterIterator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ abstract class FilterIterator extends \FilterIterator
2929
*/
3030
public function rewind()
3131
{
32-
if (PHP_VERSION_ID > 50607 || (PHP_VERSION_ID > 50523 && PHP_VERSION_ID < 50600)) {
32+
if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
3333
parent::rewind();
3434

3535
return;

src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function rewind()
119119
}
120120

121121
// @see https://bugs.php.net/68557
122-
if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
122+
if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
123123
parent::next();
124124
}
125125

src/Symfony/Component/Form/Extension/Core/Type/DateType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private function formatTimestamps(\IntlDateFormatter $formatter, $regex, array $
272272
$timezone = $formatter->getTimezoneId();
273273
$formattedTimestamps = array();
274274

275-
if ($setTimeZone = PHP_VERSION_ID >= 50500 || method_exists($formatter, 'setTimeZone')) {
275+
if ($setTimeZone = \PHP_VERSION_ID >= 50500 || method_exists($formatter, 'setTimeZone')) {
276276
$formatter->setTimeZone('UTC');
277277
} else {
278278
$formatter->setTimeZoneId('UTC');

src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function isCsrfTokenValid($intention, $token)
8585
*/
8686
protected function getSessionId()
8787
{
88-
if (PHP_VERSION_ID >= 50400) {
88+
if (\PHP_VERSION_ID >= 50400) {
8989
if (PHP_SESSION_NONE === session_status()) {
9090
session_start();
9191
}

src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testGuessRequired($constraint, $guess)
9090
*/
9191
public function testLegacyGuessRequired()
9292
{
93-
if (PHP_VERSION_ID >= 70000) {
93+
if (\PHP_VERSION_ID >= 70000) {
9494
$this->markTestSkipped('Cannot use a class called True on PHP 7 or higher.');
9595
}
9696
$true = 'Symfony\Component\Validator\Constraints\True';

src/Symfony/Component/HttpFoundation/JsonResponse.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function setData($data = array())
121121
$data = json_encode($data, $this->encodingOptions);
122122
} else {
123123
try {
124-
if (PHP_VERSION_ID < 50400) {
124+
if (\PHP_VERSION_ID < 50400) {
125125
// PHP 5.3 triggers annoying warnings for some
126126
// types that can't be serialized as JSON (INF, resources, etc.)
127127
// but doesn't provide the JsonSerializable interface.
@@ -131,7 +131,7 @@ public function setData($data = array())
131131
// PHP 5.4 and up wrap exceptions thrown by JsonSerializable
132132
// objects in a new exception that needs to be removed.
133133
// Fortunately, PHP 5.5 and up do not trigger any warning anymore.
134-
if (PHP_VERSION_ID < 50500) {
134+
if (\PHP_VERSION_ID < 50500) {
135135
// Clear json_last_error()
136136
json_encode(null);
137137
$errorHandler = set_error_handler('var_dump');
@@ -146,14 +146,14 @@ public function setData($data = array())
146146
$data = json_encode($data, $this->encodingOptions);
147147
}
148148

149-
if (PHP_VERSION_ID < 50500) {
149+
if (\PHP_VERSION_ID < 50500) {
150150
restore_error_handler();
151151
}
152152
} catch (\Exception $e) {
153-
if (PHP_VERSION_ID < 50500) {
153+
if (\PHP_VERSION_ID < 50500) {
154154
restore_error_handler();
155155
}
156-
if (PHP_VERSION_ID >= 50400 && 'Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
156+
if (\PHP_VERSION_ID >= 50400 && 'Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
157157
throw $e->getPrevious() ?: $e;
158158
}
159159
throw $e;

src/Symfony/Component/HttpFoundation/Request.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ public function isMethodCacheable()
15021502
public function getContent($asResource = false)
15031503
{
15041504
$currentContentIsResource = is_resource($this->content);
1505-
if (PHP_VERSION_ID < 50600 && false === $this->content) {
1505+
if (\PHP_VERSION_ID < 50600 && false === $this->content) {
15061506
throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.');
15071507
}
15081508

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
// Adds SessionHandler functionality if available.
1515
// @see http://php.net/sessionhandler
16-
if (PHP_VERSION_ID >= 50400) {
16+
if (\PHP_VERSION_ID >= 50400) {
1717
class NativeSessionHandler extends \SessionHandler
1818
{
1919
}

0 commit comments

Comments
 (0)