mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 02:16:41 +00:00
minor #2348 remove condition on PHP version (MatTheCat)
This PR was merged into the 2.x branch.
Discussion
----------
remove condition on PHP version
Twig now requires PHP >= 7 so there is no need to check for prior version.
Commits
-------
df185584 remove condition on PHP version
This commit is contained in:
@@ -44,22 +44,11 @@ class Twig_Node_Expression_Name extends Twig_Node_Expression
|
||||
;
|
||||
} else {
|
||||
if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) {
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
// use PHP 7 null coalescing operator
|
||||
$compiler
|
||||
->raw('($context[')
|
||||
->string($name)
|
||||
->raw('] ?? null)')
|
||||
;
|
||||
} else {
|
||||
$compiler
|
||||
->raw('(isset($context[')
|
||||
->string($name)
|
||||
->raw(']) ? $context[')
|
||||
->string($name)
|
||||
->raw('] : null)')
|
||||
;
|
||||
}
|
||||
$compiler
|
||||
->raw('($context[')
|
||||
->string($name)
|
||||
->raw('] ?? null)')
|
||||
;
|
||||
} else {
|
||||
$compiler
|
||||
->raw('(isset($context[')
|
||||
|
||||
Reference in New Issue
Block a user