From 861950b386402e2f7cab30450d2dcd674e01b8e2 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Wed, 12 Nov 2025 12:01:29 +0100 Subject: [PATCH 1/3] Disable calls to (deprecated) setAccessible on versions it is no-op --- src/Util/TestListenerTrait.php | 6 +++++- tests/Intl/Icu/AbstractNumberFormatterTest.php | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Util/TestListenerTrait.php b/src/Util/TestListenerTrait.php index f4d5478e9..1f5a4d75e 100644 --- a/src/Util/TestListenerTrait.php +++ b/src/Util/TestListenerTrait.php @@ -163,7 +163,11 @@ public function addError($test, \Exception $e, $time) { if (false !== self::$enabledPolyfills) { $r = new \ReflectionProperty('Exception', 'message'); - $r->setAccessible(true); + if (\PHP_VERSION_ID < 80100) + { + // This method is no-op starting from PHP 8.1; see also https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionsetaccessible + $r->setAccessible(true); + } $r->setValue($e, 'Polyfills enabled, '.$r->getValue($e)); } } diff --git a/tests/Intl/Icu/AbstractNumberFormatterTest.php b/tests/Intl/Icu/AbstractNumberFormatterTest.php index e5f470794..5ce4419e8 100644 --- a/tests/Intl/Icu/AbstractNumberFormatterTest.php +++ b/tests/Intl/Icu/AbstractNumberFormatterTest.php @@ -625,7 +625,11 @@ public function testGetSymbol() $currencyFormatter = static::getNumberFormatter('en', NumberFormatter::CURRENCY); $r = new \ReflectionProperty('Symfony\Polyfill\Intl\Icu\NumberFormatter', 'enSymbols'); - $r->setAccessible(true); + if (\PHP_VERSION_ID < 80100) + { + // This method is no-op starting from PHP 8.1; see also https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionsetaccessible + $r->setAccessible(true); + } $expected = $r->getValue(); for ($i = 0; $i <= 17; ++$i) { @@ -644,7 +648,11 @@ public function testGetTextAttribute() $currencyFormatter = static::getNumberFormatter('en', NumberFormatter::CURRENCY); $r = new \ReflectionProperty('Symfony\Polyfill\Intl\Icu\NumberFormatter', 'enTextAttributes'); - $r->setAccessible(true); + if (\PHP_VERSION_ID < 80100) + { + // This method is no-op starting from PHP 8.1; see also https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionsetaccessible + $r->setAccessible(true); + } $expected = $r->getValue(); for ($i = 0; $i <= 5; ++$i) { From 5fb050792218c38ab79d9f2ed320429ebf242cb5 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Wed, 12 Nov 2025 12:01:48 +0100 Subject: [PATCH 2/3] Replace deprecated 'null' as array-key with empty string in tests --- tests/Php73/Php73Test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Php73/Php73Test.php b/tests/Php73/Php73Test.php index fb20aade0..3539fc59b 100644 --- a/tests/Php73/Php73Test.php +++ b/tests/Php73/Php73Test.php @@ -139,7 +139,7 @@ public static function arrayKeyFirstDataProvider() ['a', ['a' => 'aaa', 'A' => 'AAA', 'c' => 'ccc', 'd' => 'ddd', 'e' => 'eee']], [1, ['1' => 'one', '2' => 'two', '3' => 'three', '4' => 'four', '5' => 'five']], [1, [1 => 'one', 2 => 'two', 3 => 7, 4 => 'four', 5 => 'five']], - ['f', ['f' => 'fff', '1' => 'one', 4 => 6, '' => 'blank', 24 => 'float', 'F' => 'FFF', 'blank' => '', 3 => 3.7, 5 => 7, 6 => 8.6, '5' => 'Five', '4name' => 'jonny', 'a' => null, null => 3]], + ['f', ['f' => 'fff', '1' => 'one', 4 => 6, '' => 'blank', 24 => 'float', 'F' => 'FFF', 'blank' => '', 3 => 3.7, 5 => 7, 6 => 8.6, '5' => 'Five', '4name' => 'jonny', 'a' => null, '' => 3]], [0, [12, 'name', 'age', '45']], [0, [['oNe', 'tWo', 4], [10, 20, 30, 40, 50], []]], ['one', ['one' => 1, 'one' => 2, 'three' => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, 5 => 54, 5 => 57, '5.4' => 554, '5.7' => 557]], @@ -158,7 +158,7 @@ public static function arrayKeyLastDataProvider() ['e', ['a' => 'aaa', 'A' => 'AAA', 'c' => 'ccc', 'd' => 'ddd', 'e' => 'eee']], [5, ['1' => 'one', '2' => 'two', '3' => 'three', '4' => 'four', '5' => 'five']], [5, [1 => 'one', 2 => 'two', 3 => 7, 4 => 'four', 5 => 'five']], - ['a', ['f' => 'fff', '1' => 'one', 4 => 6, '' => 'blank', 2 => 'float', 'F' => 'FFF', 'blank' => '', 3 => 3.7, 5 => 7, 6 => 8.6, '5' => 'Five', '4name' => 'jonny', 'a' => null, null => 3]], + ['a', ['f' => 'fff', '1' => 'one', 4 => 6, '' => 'blank', 2 => 'float', 'F' => 'FFF', 'blank' => '', 3 => 3.7, 5 => 7, 6 => 8.6, '5' => 'Five', '4name' => 'jonny', 'a' => null, '' => 3]], [3, [12, 'name', 'age', '45']], [2, [['oNe', 'tWo', 4], [10, 20, 30, 40, 50], []]], ['5.7', ['one' => 1, 'one' => 2, 'three' => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, 5 => 54, 5 => 57, '5.4' => 554, '5.7' => 557]], From 54760b505ddd0f6eece20c37390e68abe461e9e3 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Thu, 13 Nov 2025 09:22:30 +0100 Subject: [PATCH 3/3] Drop duplicated empty string key from Php73Test arrays --- tests/Php73/Php73Test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Php73/Php73Test.php b/tests/Php73/Php73Test.php index 3539fc59b..3dafabd1b 100644 --- a/tests/Php73/Php73Test.php +++ b/tests/Php73/Php73Test.php @@ -139,7 +139,7 @@ public static function arrayKeyFirstDataProvider() ['a', ['a' => 'aaa', 'A' => 'AAA', 'c' => 'ccc', 'd' => 'ddd', 'e' => 'eee']], [1, ['1' => 'one', '2' => 'two', '3' => 'three', '4' => 'four', '5' => 'five']], [1, [1 => 'one', 2 => 'two', 3 => 7, 4 => 'four', 5 => 'five']], - ['f', ['f' => 'fff', '1' => 'one', 4 => 6, '' => 'blank', 24 => 'float', 'F' => 'FFF', 'blank' => '', 3 => 3.7, 5 => 7, 6 => 8.6, '5' => 'Five', '4name' => 'jonny', 'a' => null, '' => 3]], + ['f', ['f' => 'fff', '1' => 'one', 4 => 6, '' => 'blank', 24 => 'float', 'F' => 'FFF', 'blank' => '', 3 => 3.7, 5 => 7, 6 => 8.6, '5' => 'Five', '4name' => 'jonny', 'a' => null]], [0, [12, 'name', 'age', '45']], [0, [['oNe', 'tWo', 4], [10, 20, 30, 40, 50], []]], ['one', ['one' => 1, 'one' => 2, 'three' => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, 5 => 54, 5 => 57, '5.4' => 554, '5.7' => 557]], @@ -158,7 +158,7 @@ public static function arrayKeyLastDataProvider() ['e', ['a' => 'aaa', 'A' => 'AAA', 'c' => 'ccc', 'd' => 'ddd', 'e' => 'eee']], [5, ['1' => 'one', '2' => 'two', '3' => 'three', '4' => 'four', '5' => 'five']], [5, [1 => 'one', 2 => 'two', 3 => 7, 4 => 'four', 5 => 'five']], - ['a', ['f' => 'fff', '1' => 'one', 4 => 6, '' => 'blank', 2 => 'float', 'F' => 'FFF', 'blank' => '', 3 => 3.7, 5 => 7, 6 => 8.6, '5' => 'Five', '4name' => 'jonny', 'a' => null, '' => 3]], + ['a', ['f' => 'fff', '1' => 'one', 4 => 6, '' => 'blank', 2 => 'float', 'F' => 'FFF', 'blank' => '', 3 => 3.7, 5 => 7, 6 => 8.6, '5' => 'Five', '4name' => 'jonny', 'a' => null]], [3, [12, 'name', 'age', '45']], [2, [['oNe', 'tWo', 4], [10, 20, 30, 40, 50], []]], ['5.7', ['one' => 1, 'one' => 2, 'three' => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, 5 => 54, 5 => 57, '5.4' => 554, '5.7' => 557]],