8000 compare version using PHP_VERSION_ID · symfony/symfony@9c322b9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9c322b9

Browse files
committed
compare version using PHP_VERSION_ID
To let opcode caches optimize cached code, the `PHP_VERSION_ID` constant is used to detect the current PHP version instead of calling `version_compare()` with `PHP_VERSION`.
1 parent 8d18c98 commit 9c322b9

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function formatFile($file, $line, $text = null)
172172
$text = "$text at line $line";
173173

174174
if (false !== $link = $this->getFileLink($file, $line)) {
175-
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
175+
if (PHP_VERSION_ID >= 50400) {
176176
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
177177
} else {
178178
$flags = ENT_QUOTES;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function formatFile($file, $line, $text = null)
166166
}
167167

168168
if (false !== $link = $this->getFileLink($file, $line)) {
169-
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
169+
if (PHP_VERSION_ID >= 50400) {
170170
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
171171
} else {
172172
$flags = ENT_QUOTES;

src/Symfony/Component/ClassLoader/ClassMapGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\ClassLoader;
1313

14-
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
14+
if (PHP_VERSION_ID >= 50400) {
1515
define('SYMFONY_TRAIT', T_TRAIT);
1616
} else {
1717
define('SYMFONY_TRAIT', 0);

src/Symfony/Component/Debug/ExceptionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ private function abbrClass($class)
288288
*/
289289
private function formatArgs(array $args)
290290
{
291-
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
291+
if (PHP_VERSION_ID >= 50400) {
292292
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
293293
} else {
294294
$flags = ENT_QUOTES;

src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function render($uri, Request $request, array $options = array())
107107
}
108108
$renderedAttributes = '';
109109
if (count($attributes) > 0) {
110-
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
110+
if (PHP_VERSION_ID >= 50400) {
111111
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
112112
} else {
113113
$flags = ENT_QUOTES;

src/Symfony/Component/Templating/PhpEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public function getGlobals()
462462
protected function initializeEscapers()
463463
{
464464
$that = $this;
465-
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
465+
if (PHP_VERSION_ID >= 50400) {
466466
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
467467
} else {
468468
$flags = ENT_QUOTES;

src/Symfony/Component/Yaml/Exception/ParseException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private function updateRepr()
125125
}
126126

127127
if (null !== $this->parsedFile) {
128-
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
128+
if (PHP_VERSION_ID >= 50400) {
129129
$jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
130130
} else {
131131
$jsonOptions = 0;

0 commit comments

Comments
 (0)
0