remove no longer needed PHP version checks

This commit is contained in:
Christian Flothmann
2024-09-02 15:36:13 +02:00
parent 06ac86e3dd
commit 038d70f2aa
8 changed files with 7 additions and 17 deletions
@@ -32,7 +32,7 @@ final class ProfilerNodeVisitor implements NodeVisitorInterface
public function __construct(
private string $extensionName,
) {
$this->varName = \sprintf('__internal_%s', hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $extensionName));
$this->varName = \sprintf('__internal_%s', hash('xxh128', $extensionName));
}
public function enterNode(Node $node, Environment $env): Node
+4 -6
View File
@@ -77,12 +77,10 @@ final class CallableArgumentsExtractor
$pos = 0;
foreach ($callableParameters as $callableParameter) {
$name = $this->normalizeName($callableParameter->name);
if (\PHP_VERSION_ID >= 80000 && 'range' === $callable) {
if ('start' === $name) {
$name = 'low';
} elseif ('end' === $name) {
$name = 'high';
}
if ('range' === $callable && 'start' === $name) {
$name = 'low';
} elseif ('range' === $callable && 'end' === $name) {
$name = 'high';
}
$names[] = $name;
+1 -1
View File
@@ -25,7 +25,7 @@ class ChainTest extends TestCase
protected function setUp(): void
{
$nonce = hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', random_bytes(32));
$nonce = hash('xxh128', random_bytes(32));
$this->className = '__Twig_Tests_Cache_ChainTest_Template_'.$nonce;
$this->directory = sys_get_temp_dir().'/twig-test';
$this->cache = new ChainCache([
+1 -1
View File
@@ -23,7 +23,7 @@ class ReadOnlyFilesystemTest extends TestCase
protected function setUp(): void
{
$nonce = hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', random_bytes(32));
$nonce = hash('xxh128', random_bytes(32));
$this->className = '__Twig_Tests_Cache_ReadOnlyFilesystemTest_Template_'.$nonce;
$this->directory = sys_get_temp_dir().'/twig-test';
$this->cache = new ReadOnlyFilesystemCache($this->directory);
@@ -1,7 +1,5 @@
--TEST--
"enum_cases" function with invalid dynamic enum class
--CONDITION--
\PHP_VERSION_ID >= 80100
--TEMPLATE--
{% set from_variable = 'Twig\\Tests\\NonExistentEnum' %}
{% for c in enum_cases(from_variable) %}
@@ -1,7 +1,5 @@
--TEST--
"enum_cases" function with invalid enum class
--CONDITION--
\PHP_VERSION_ID >= 80100
--TEMPLATE--
{% for c in enum_cases('Twig\\Tests\\NonExistentEnum') %}
{{~ c.name }}
@@ -1,7 +1,5 @@
--TEST--
"enum_cases" function with invalid literal type
--CONDITION--
\PHP_VERSION_ID >= 80100
--TEMPLATE--
{% for c in enum_cases(13) %}
{{~ c.name }}
@@ -1,7 +1,5 @@
--TEST--
"enum_cases" function
--CONDITION--
\PHP_VERSION_ID >= 80100
--TEMPLATE--
{% for c in enum_cases('Twig\\Tests\\DummyBackedEnum') %}
{{~ c.name }}: {{ c.value }}