From f2e549a92bcfddcbabbe1a506c3f062afe6bcc0b Mon Sep 17 00:00:00 2001 From: Guillaume Date: Sat, 18 Jul 2026 18:06:34 +0200 Subject: [PATCH] :coffin: Drop useless php comparisons --- .../intl-extra/Tests/Fixtures/format_date_php8.test | 2 +- .../Tests/Fixtures/format_date_php8_ICU72.test | 2 +- .../functions/enum/invalid_dynamic_enum.test | 1 - tests/Util/CallableArgumentsExtractorTest.php | 12 ------------ 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/extra/intl-extra/Tests/Fixtures/format_date_php8.test b/extra/intl-extra/Tests/Fixtures/format_date_php8.test index 5d694e52a..c3e574c43 100644 --- a/extra/intl-extra/Tests/Fixtures/format_date_php8.test +++ b/extra/intl-extra/Tests/Fixtures/format_date_php8.test @@ -1,7 +1,7 @@ --TEST-- "format_date" filter --CONDITION-- -PHP_VERSION_ID >= 80000 && version_compare(Symfony\Component\Intl\Intl::getIcuVersion(), '72.1', '<') +version_compare(Symfony\Component\Intl\Intl::getIcuVersion(), '72.1', '<') --TEMPLATE-- {{ 'today 23:39:12'|format_datetime('relative_short', 'none', locale='fr') }} {{ 'today 23:39:12'|format_datetime('relative_full', 'full', locale='fr') }} diff --git a/extra/intl-extra/Tests/Fixtures/format_date_php8_ICU72.test b/extra/intl-extra/Tests/Fixtures/format_date_php8_ICU72.test index 3162ae54d..1a0d4c4c7 100644 --- a/extra/intl-extra/Tests/Fixtures/format_date_php8_ICU72.test +++ b/extra/intl-extra/Tests/Fixtures/format_date_php8_ICU72.test @@ -1,7 +1,7 @@ --TEST-- "format_date" filter --CONDITION-- -PHP_VERSION_ID >= 80000 && version_compare(Symfony\Component\Intl\Intl::getIcuVersion(), '72.1', '>=') +version_compare(Symfony\Component\Intl\Intl::getIcuVersion(), '72.1', '>=') --TEMPLATE-- {{ 'today 23:39:12'|format_datetime('relative_short', 'none', locale='fr') }} {{ 'today 23:39:12'|format_datetime('relative_full', 'full', locale='fr') }} diff --git a/tests/Fixtures/functions/enum/invalid_dynamic_enum.test b/tests/Fixtures/functions/enum/invalid_dynamic_enum.test index 2cb0d431c..71788b38d 100644 --- a/tests/Fixtures/functions/enum/invalid_dynamic_enum.test +++ b/tests/Fixtures/functions/enum/invalid_dynamic_enum.test @@ -1,7 +1,6 @@ --TEST-- "enum" function with invalid dynamic enum class --CONDITION-- -\PHP_VERSION_ID >= 80100 --TEMPLATE-- {% set from_variable = 'Twig\Tests\NonExistentEnum' %} {% for c in enum(from_variable).cases() %} diff --git a/tests/Util/CallableArgumentsExtractorTest.php b/tests/Util/CallableArgumentsExtractorTest.php index 5859cff38..9b0139983 100644 --- a/tests/Util/CallableArgumentsExtractorTest.php +++ b/tests/Util/CallableArgumentsExtractorTest.php @@ -71,18 +71,6 @@ class CallableArgumentsExtractorTest extends TestCase $this->getArguments('date', 'date', ['Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => '']); } - public function testResolveArgumentsWithMissingValueForOptionalArgument(): void - { - if (\PHP_VERSION_ID >= 80000) { - $this->markTestSkipped('substr_compare() has a default value in 8.0, so the test does not work anymore, one should find another PHP built-in function for this test to work in PHP 8.'); - } - - $this->expectException(SyntaxError::class); - $this->expectExceptionMessage('Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length".'); - - $this->getArguments('substr_compare', 'substr_compare', ['abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true]); - } - public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction(): void { $this->assertEquals(['arg1'], $this->getArguments('custom_function', [$this, 'customFunction'], ['arg1' => 'arg1']));