From f02dbbac9589272218f4f07fc6ee0a01a148004d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 9 Sep 2024 11:08:43 +0200 Subject: [PATCH] Bump to PHP 7.2, stick to phpunit 8.5 --- .github/workflows/tests.yml | 8 +- composer.json | 9 +- src/Apcu/composer.json | 2 +- src/Ctype/composer.json | 2 +- src/Iconv/composer.json | 2 +- src/Intl/Grapheme/composer.json | 2 +- src/Intl/Icu/composer.json | 2 +- src/Intl/Idn/Idn.php | 4 +- src/Intl/Idn/composer.json | 5 +- src/Intl/MessageFormatter/composer.json | 2 +- src/Intl/Normalizer/composer.json | 2 +- src/Mbstring/Mbstring.php | 12 -- src/Mbstring/composer.json | 2 +- src/Php72/LICENSE | 19 --- src/Php72/Php72.php | 218 ------------------------ src/Php72/README.md | 35 ---- src/Php72/bootstrap.php | 60 ------- src/Php72/composer.json | 32 ---- src/Php73/composer.json | 2 +- src/Php74/composer.json | 2 +- src/Php80/composer.json | 2 +- src/Php81/composer.json | 2 +- src/Php82/composer.json | 2 +- src/Php83/composer.json | 2 +- src/Php84/composer.json | 2 +- src/Util/TestListenerTrait.php | 7 - src/Util/composer.json | 2 +- src/Uuid/composer.json | 2 +- src/Xml/LICENSE | 19 --- src/Xml/README.md | 5 - src/Xml/composer.json | 30 ---- src/bootstrap.php | 4 - tests/Intl/Icu/CurrenciesTest.php | 3 - tests/Intl/Idn/IdnTest.php | 2 - tests/Mbstring/MbstringTest.php | 32 ---- tests/Php72/Php72Test.php | 204 ---------------------- 36 files changed, 26 insertions(+), 716 deletions(-) delete mode 100644 src/Php72/LICENSE delete mode 100644 src/Php72/Php72.php delete mode 100644 src/Php72/README.md delete mode 100644 src/Php72/bootstrap.php delete mode 100644 src/Php72/composer.json delete mode 100644 src/Xml/LICENSE delete mode 100644 src/Xml/README.md delete mode 100644 src/Xml/composer.json delete mode 100644 tests/Php72/Php72Test.php diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index da0da453a..c3f828ffd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,12 +12,11 @@ jobs: env: COMPOSER_ROOT_VERSION: 1.x-dev - SYMFONY_PHPUNIT_VERSION: 9.5 + SYMFONY_PHPUNIT_VERSION: 8.5 strategy: matrix: include: - - php: '7.1' - php: '7.2' - php: '7.3' - php: '7.4' @@ -44,11 +43,6 @@ jobs: - name: Install dependencies run: composer --prefer-source --no-progress --ansi install - - name: Configure for PHP <= 7.2 - if: "${{ matrix.php <= '7.2' }}" - run: | - echo SYMFONY_PHPUNIT_VERSION=7.5 >> $GITHUB_ENV - - name: Run tests run: | ok=0 diff --git a/composer.json b/composer.json index 9a3012ed0..7a8059e03 100644 --- a/composer.json +++ b/composer.json @@ -16,17 +16,16 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "require-dev": { - "symfony/intl": "^4.4|^5.0|^6.0", - "symfony/phpunit-bridge": "^5.3|^6.0", - "symfony/var-dumper": "^4.4|^5.1|^6.0" + "symfony/intl": "^5.4|^6.4", + "symfony/phpunit-bridge": "^6.4", + "symfony/var-dumper": "^5.4|^6.4" }, "replace": { "symfony/polyfill-apcu": "self.version", "symfony/polyfill-ctype": "self.version", - "symfony/polyfill-php72": "self.version", "symfony/polyfill-php73": "self.version", "symfony/polyfill-php74": "self.version", "symfony/polyfill-php80": "self.version", diff --git a/src/Apcu/composer.json b/src/Apcu/composer.json index a22e900f9..ba1b8743c 100644 --- a/src/Apcu/composer.json +++ b/src/Apcu/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Apcu\\": "" }, diff --git a/src/Ctype/composer.json b/src/Ctype/composer.json index b222fdab9..131ca7adb 100644 --- a/src/Ctype/composer.json +++ b/src/Ctype/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" diff --git a/src/Iconv/composer.json b/src/Iconv/composer.json index 2044a166c..af0b17396 100644 --- a/src/Iconv/composer.json +++ b/src/Iconv/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-iconv": "*" diff --git a/src/Intl/Grapheme/composer.json b/src/Intl/Grapheme/composer.json index a20d3faaf..0eea417d7 100644 --- a/src/Intl/Grapheme/composer.json +++ b/src/Intl/Grapheme/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Intl\\Grapheme\\": "" }, diff --git a/src/Intl/Icu/composer.json b/src/Intl/Icu/composer.json index ef27be86b..33c74ab91 100644 --- a/src/Intl/Icu/composer.json +++ b/src/Intl/Icu/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "files": [ "bootstrap.php" ], diff --git a/src/Intl/Idn/Idn.php b/src/Intl/Idn/Idn.php index eb6bada0a..334f8ee70 100644 --- a/src/Intl/Idn/Idn.php +++ b/src/Intl/Idn/Idn.php @@ -145,7 +145,7 @@ final class Idn */ public static function idn_to_ascii($domainName, $options = self::IDNA_DEFAULT, $variant = self::INTL_IDNA_VARIANT_UTS46, &$idna_info = []) { - if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) { + if (self::INTL_IDNA_VARIANT_2003 === $variant) { @trigger_error('idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated', \E_USER_DEPRECATED); } @@ -198,7 +198,7 @@ public static function idn_to_ascii($domainName, $options = self::IDNA_DEFAULT, */ public static function idn_to_utf8($domainName, $options = self::IDNA_DEFAULT, $variant = self::INTL_IDNA_VARIANT_UTS46, &$idna_info = []) { - if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) { + if (self::INTL_IDNA_VARIANT_2003 === $variant) { @trigger_error('idn_to_utf8(): INTL_IDNA_VARIANT_2003 is deprecated', \E_USER_DEPRECATED); } diff --git a/src/Intl/Idn/composer.json b/src/Intl/Idn/composer.json index 12f75bceb..760debcd2 100644 --- a/src/Intl/Idn/composer.json +++ b/src/Intl/Idn/composer.json @@ -20,9 +20,8 @@ } ], "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" + "php": ">=7.2", + "symfony/polyfill-intl-normalizer": "^1.10" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Intl\\Idn\\": "" }, diff --git a/src/Intl/MessageFormatter/composer.json b/src/Intl/MessageFormatter/composer.json index d79186da4..bac270a24 100644 --- a/src/Intl/MessageFormatter/composer.json +++ b/src/Intl/MessageFormatter/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Intl\\MessageFormatter\\": "" }, diff --git a/src/Intl/Normalizer/composer.json b/src/Intl/Normalizer/composer.json index 1b93573ae..9bd04e887 100644 --- a/src/Intl/Normalizer/composer.json +++ b/src/Intl/Normalizer/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, diff --git a/src/Mbstring/Mbstring.php b/src/Mbstring/Mbstring.php index 7be551bb8..3d45c9d9a 100644 --- a/src/Mbstring/Mbstring.php +++ b/src/Mbstring/Mbstring.php @@ -86,12 +86,6 @@ final class Mbstring public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) { if (\is_array($s)) { - if (\PHP_VERSION_ID < 70200) { - trigger_error('mb_convert_encoding() expects parameter 1 to be string, array given', \E_USER_WARNING); - - return null; - } - $r = []; foreach ($s as $str) { $r[] = self::mb_convert_encoding($str, $toEncoding, $fromEncoding); @@ -430,12 +424,6 @@ public static function mb_encoding_aliases($encoding) public static function mb_check_encoding($var = null, $encoding = null) { - if (\PHP_VERSION_ID < 70200 && \is_array($var)) { - trigger_error('mb_check_encoding() expects parameter 1 to be string, array given', \E_USER_WARNING); - - return null; - } - if (null === $encoding) { if (null === $var) { return false; diff --git a/src/Mbstring/composer.json b/src/Mbstring/composer.json index bd99d4b9d..4ed241a33 100644 --- a/src/Mbstring/composer.json +++ b/src/Mbstring/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" diff --git a/src/Php72/LICENSE b/src/Php72/LICENSE deleted file mode 100644 index 6e3afce69..000000000 --- a/src/Php72/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015-present Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Php72/Php72.php b/src/Php72/Php72.php deleted file mode 100644 index e97b1b27d..000000000 --- a/src/Php72/Php72.php +++ /dev/null @@ -1,218 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Php72; - -/** - * @author Nicolas Grekas - * @author Dariusz Rumiński - * - * @internal - */ -final class Php72 -{ - private static $hashMask; - - public static function utf8_encode($s) - { - $s .= $s; - $len = \strlen($s); - - for ($i = $len >> 1, $j = 0; $i < $len; ++$i, ++$j) { - switch (true) { - case $s[$i] < "\x80": $s[$j] = $s[$i]; break; - case $s[$i] < "\xC0": $s[$j] = "\xC2"; $s[++$j] = $s[$i]; break; - default: $s[$j] = "\xC3"; $s[++$j] = \chr(\ord($s[$i]) - 64); break; - } - } - - return substr($s, 0, $j); - } - - public static function utf8_decode($s) - { - $s = (string) $s; - $len = \strlen($s); - - for ($i = 0, $j = 0; $i < $len; ++$i, ++$j) { - switch ($s[$i] & "\xF0") { - case "\xC0": - case "\xD0": - $c = (\ord($s[$i] & "\x1F") << 6) | \ord($s[++$i] & "\x3F"); - $s[$j] = $c < 256 ? \chr($c) : '?'; - break; - - case "\xF0": - ++$i; - // no break - - case "\xE0": - $s[$j] = '?'; - $i += 2; - break; - - default: - $s[$j] = $s[$i]; - } - } - - return substr($s, 0, $j); - } - - public static function php_os_family() - { - if ('\\' === \DIRECTORY_SEPARATOR) { - return 'Windows'; - } - - $map = [ - 'Darwin' => 'Darwin', - 'DragonFly' => 'BSD', - 'FreeBSD' => 'BSD', - 'NetBSD' => 'BSD', - 'OpenBSD' => 'BSD', - 'Linux' => 'Linux', - 'SunOS' => 'Solaris', - ]; - - return $map[\PHP_OS] ?? 'Unknown'; - } - - public static function spl_object_id($object) - { - if (null === self::$hashMask) { - self::initHashMask(); - } - if (null === $hash = spl_object_hash($object)) { - return; - } - - // On 32-bit systems, PHP_INT_SIZE is 4, - return self::$hashMask ^ hexdec(substr($hash, 16 - (\PHP_INT_SIZE * 2 - 1), \PHP_INT_SIZE * 2 - 1)); - } - - public static function sapi_windows_vt100_support($stream, $enable = null) - { - if (!\is_resource($stream)) { - trigger_error('sapi_windows_vt100_support() expects parameter 1 to be resource, '.\gettype($stream).' given', \E_USER_WARNING); - - return false; - } - - $meta = stream_get_meta_data($stream); - - if ('STDIO' !== $meta['stream_type']) { - trigger_error('sapi_windows_vt100_support() was not able to analyze the specified stream', \E_USER_WARNING); - - return false; - } - - // We cannot actually disable vt100 support if it is set - if (false === $enable || !self::stream_isatty($stream)) { - return false; - } - - // The native function does not apply to stdin - $meta = array_map('strtolower', $meta); - $stdin = 'php://stdin' === $meta['uri'] || 'php://fd/0' === $meta['uri']; - - return !$stdin - && (false !== getenv('ANSICON') - || 'ON' === getenv('ConEmuANSI') - || 'xterm' === getenv('TERM') - || 'Hyper' === getenv('TERM_PROGRAM')); - } - - public static function stream_isatty($stream) - { - if (!\is_resource($stream)) { - trigger_error('stream_isatty() expects parameter 1 to be resource, '.\gettype($stream).' given', \E_USER_WARNING); - - return false; - } - - if ('\\' === \DIRECTORY_SEPARATOR) { - $stat = @fstat($stream); - - // Check if formatted mode is S_IFCHR - return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; - } - - return \function_exists('posix_isatty') && @posix_isatty($stream); - } - - private static function initHashMask() - { - $obj = (object) []; - self::$hashMask = -1; - - // check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below - $obFuncs = ['ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush']; - foreach (debug_backtrace(\PHP_VERSION_ID >= 50400 ? \DEBUG_BACKTRACE_IGNORE_ARGS : false) as $frame) { - if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && \in_array($frame['function'], $obFuncs)) { - $frame['line'] = 0; - break; - } - } - if (!empty($frame['line'])) { - ob_start(); - debug_zval_dump($obj); - self::$hashMask = (int) substr(ob_get_clean(), 17); - } - - self::$hashMask ^= hexdec(substr(spl_object_hash($obj), 16 - (\PHP_INT_SIZE * 2 - 1), \PHP_INT_SIZE * 2 - 1)); - } - - public static function mb_chr($code, $encoding = null) - { - if (0x80 > $code %= 0x200000) { - $s = \chr($code); - } elseif (0x800 > $code) { - $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); - } elseif (0x10000 > $code) { - $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); - } else { - $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); - } - - if ('UTF-8' !== $encoding = $encoding ?? mb_internal_encoding()) { - $s = mb_convert_encoding($s, $encoding, 'UTF-8'); - } - - return $s; - } - - public static function mb_ord($s, $encoding = null) - { - if (null === $encoding) { - $s = mb_convert_encoding($s, 'UTF-8'); - } elseif ('UTF-8' !== $encoding) { - $s = mb_convert_encoding($s, 'UTF-8', $encoding); - } - - if (1 === \strlen($s)) { - return \ord($s); - } - - $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; - if (0xF0 <= $code) { - return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; - } - if (0xE0 <= $code) { - return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80; - } - if (0xC0 <= $code) { - return (($code - 0xC0) << 6) + $s[2] - 0x80; - } - - return $code; - } -} diff --git a/src/Php72/README.md b/src/Php72/README.md deleted file mode 100644 index ed1905055..000000000 --- a/src/Php72/README.md +++ /dev/null @@ -1,35 +0,0 @@ -Symfony Polyfill / Php72 -======================== - -This component provides functions added to PHP 7.2 core: - -- [`spl_object_id`](https://php.net/spl_object_id) -- [`stream_isatty`](https://php.net/stream_isatty) - -And also functions added to PHP 7.2 mbstring: - -- [`mb_ord`](https://php.net/mb_ord) -- [`mb_chr`](https://php.net/mb_chr) -- [`mb_scrub`](https://php.net/mb_scrub) - -On Windows only: - -- [`sapi_windows_vt100_support`](https://php.net/sapi_windows_vt100_support) - -Moved to core since 7.2 (was in the optional XML extension earlier): - -- [`utf8_encode`](https://php.net/utf8_encode) -- [`utf8_decode`](https://php.net/utf8_decode) - -Also, it provides constants added to PHP 7.2: - -- [`PHP_FLOAT_*`](https://php.net/reserved.constants#constant.php-float-dig) -- [`PHP_OS_FAMILY`](https://php.net/reserved.constants#constant.php-os-family) - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/src/Php72/bootstrap.php b/src/Php72/bootstrap.php deleted file mode 100644 index 00d793c41..000000000 --- a/src/Php72/bootstrap.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Php72 as p; - -if (\PHP_VERSION_ID >= 70200) { - return; -} - -if (!defined('PHP_FLOAT_DIG')) { - define('PHP_FLOAT_DIG', 15); -} -if (!defined('PHP_FLOAT_EPSILON')) { - define('PHP_FLOAT_EPSILON', 2.2204460492503E-16); -} -if (!defined('PHP_FLOAT_MIN')) { - define('PHP_FLOAT_MIN', 2.2250738585072E-308); -} -if (!defined('PHP_FLOAT_MAX')) { - define('PHP_FLOAT_MAX', 1.7976931348623157E+308); -} -if (!defined('PHP_OS_FAMILY')) { - define('PHP_OS_FAMILY', p\Php72::php_os_family()); -} - -if ('\\' === \DIRECTORY_SEPARATOR && !function_exists('sapi_windows_vt100_support')) { - function sapi_windows_vt100_support($stream, $enable = null) { return p\Php72::sapi_windows_vt100_support($stream, $enable); } -} -if (!function_exists('stream_isatty')) { - function stream_isatty($stream) { return p\Php72::stream_isatty($stream); } -} -if (!function_exists('utf8_encode')) { - function utf8_encode($string) { return p\Php72::utf8_encode($string); } -} -if (!function_exists('utf8_decode')) { - function utf8_decode($string) { return p\Php72::utf8_decode($string); } -} -if (!function_exists('spl_object_id')) { - function spl_object_id($object) { return p\Php72::spl_object_id($object); } -} - -if (extension_loaded('mbstring')) { - if (!function_exists('mb_ord')) { - function mb_ord($string, $encoding = null) { return p\Php72::mb_ord($string, $encoding); } - } - if (!function_exists('mb_chr')) { - function mb_chr($codepoint, $encoding = null) { return p\Php72::mb_chr($codepoint, $encoding); } - } - if (!function_exists('mb_scrub')) { - function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); } - } -} diff --git a/src/Php72/composer.json b/src/Php72/composer.json deleted file mode 100644 index 1882576df..000000000 --- a/src/Php72/composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "symfony/polyfill-php72", - "type": "library", - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "keywords": ["polyfill", "shim", "compatibility", "portable"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Php72\\": "" }, - "files": [ "bootstrap.php" ] - }, - "minimum-stability": "dev", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/src/Php73/composer.json b/src/Php73/composer.json index 3d47d1541..09d98cb87 100644 --- a/src/Php73/composer.json +++ b/src/Php73/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php73\\": "" }, diff --git a/src/Php74/composer.json b/src/Php74/composer.json index 353d8b48f..ede769e9a 100644 --- a/src/Php74/composer.json +++ b/src/Php74/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php74\\": "" }, diff --git a/src/Php80/composer.json b/src/Php80/composer.json index 46ccde203..a503b039a 100644 --- a/src/Php80/composer.json +++ b/src/Php80/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php80\\": "" }, diff --git a/src/Php81/composer.json b/src/Php81/composer.json index 381af79ac..28b6408ea 100644 --- a/src/Php81/composer.json +++ b/src/Php81/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php81\\": "" }, diff --git a/src/Php82/composer.json b/src/Php82/composer.json index e1f8230c8..2031ae8d0 100644 --- a/src/Php82/composer.json +++ b/src/Php82/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php82\\": "" }, diff --git a/src/Php83/composer.json b/src/Php83/composer.json index 02a0bf830..a8b8ba707 100644 --- a/src/Php83/composer.json +++ b/src/Php83/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php83\\": "" }, diff --git a/src/Php84/composer.json b/src/Php84/composer.json index 9ceeee1be..8bbc28125 100644 --- a/src/Php84/composer.json +++ b/src/Php84/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php84\\": "" }, diff --git a/src/Util/TestListenerTrait.php b/src/Util/TestListenerTrait.php index 37e2ee4cb..3b87d426d 100644 --- a/src/Util/TestListenerTrait.php +++ b/src/Util/TestListenerTrait.php @@ -129,13 +129,6 @@ function {$f['name']}{$f['signature']} 'array|string|null $string' => 'array|string $string', 'array|string|null $from_encoding = null' => 'array|string|null $from_encoding = null', 'array|string|null $from_encoding' => 'array|string $from_encoding', - 'string $characters = null' => '?string $characters = null', - 'string $charset = null' => '?string $charset = null', - 'string $encoding = null' => '?string $encoding = null', - 'string $language = null' => '?string $language = null', - 'string $transfer_encoding = null' => '?string $transfer_encoding = null', - 'string $type = null' => '?string $type = null', - 'int $length = null' => '?int $length = null', ]; if (strtr($polyfillSignature, $map) !== $originalSignature) { diff --git a/src/Util/composer.json b/src/Util/composer.json index 315b34ffd..773bb2d53 100644 --- a/src/Util/composer.json +++ b/src/Util/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Util\\": "" } diff --git a/src/Uuid/composer.json b/src/Uuid/composer.json index 2494ea172..f3c5045d5 100644 --- a/src/Uuid/composer.json +++ b/src/Uuid/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-uuid": "*" diff --git a/src/Xml/LICENSE b/src/Xml/LICENSE deleted file mode 100644 index 6e3afce69..000000000 --- a/src/Xml/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015-present Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Xml/README.md b/src/Xml/README.md deleted file mode 100644 index 41ffbf896..000000000 --- a/src/Xml/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Symfony Polyfill / XML -====================== - -This polyfill is deprecated. -Use the `symfony/polyfill-php72` package instead. diff --git a/src/Xml/composer.json b/src/Xml/composer.json deleted file mode 100644 index ce2935d03..000000000 --- a/src/Xml/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "symfony/polyfill-xml", - "type": "metapackage", - "description": "Symfony polyfill for xml's utf8_encode and utf8_decode functions", - "keywords": ["polyfill", "shim", "compatibility", "portable"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "abandoned": "symfony/polyfill-php72", - "require": { - "php": ">=7.1", - "symfony/polyfill-php72": "^1.20" - }, - "minimum-stability": "dev", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/src/bootstrap.php b/src/bootstrap.php index 5c3736bbd..56a216d58 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -9,10 +9,6 @@ * file that was distributed with this source code. */ -if (\PHP_VERSION_ID < 70200) { - require __DIR__.'/Php72/bootstrap.php'; -} - if (\PHP_VERSION_ID < 70300) { require __DIR__.'/Php73/bootstrap.php'; } diff --git a/tests/Intl/Icu/CurrenciesTest.php b/tests/Intl/Icu/CurrenciesTest.php index dddddb02f..291bbcbcf 100644 --- a/tests/Intl/Icu/CurrenciesTest.php +++ b/tests/Intl/Icu/CurrenciesTest.php @@ -18,9 +18,6 @@ */ class CurrenciesTest extends TestCase { - /** - * @requires PHP 7.2 - */ public function testMetadata() { $dataDir = \dirname(__DIR__, 3).'/vendor/symfony/intl/Resources/data/currencies/'; diff --git a/tests/Intl/Idn/IdnTest.php b/tests/Intl/Idn/IdnTest.php index 8152a6d25..1df884372 100644 --- a/tests/Intl/Idn/IdnTest.php +++ b/tests/Intl/Idn/IdnTest.php @@ -15,8 +15,6 @@ use Symfony\Polyfill\Intl\Idn\Idn; /** - * @requires PHP 7.2 - * * @author Renan Gonçalves * @author Sebastian Kroczek * @author Dmitry Lukashin diff --git a/tests/Mbstring/MbstringTest.php b/tests/Mbstring/MbstringTest.php index e2882908c..75bb3be00 100644 --- a/tests/Mbstring/MbstringTest.php +++ b/tests/Mbstring/MbstringTest.php @@ -79,28 +79,12 @@ public function testConvertEncoding() /** * @covers \Symfony\Polyfill\Mbstring\Mbstring::mb_convert_encoding - * - * @requires PHP 7.2 */ public function testConvertEncodingWithArrayValue() { $this->assertSame(['déjà', 'là'], mb_convert_encoding(['déjà', 'là'], 'Utf-8', 'Html-entities')); } - /** - * @covers \Symfony\Polyfill\Mbstring\Mbstring::mb_convert_encoding - * - * @requires PHP < 7.2 - */ - public function testConvertEncodingWithArrayValueForPhpLessThan72() - { - $errorMessage = null; - set_error_handler(function ($type, $msg, $file, $line) use (&$errorMessage) { $errorMessage = \E_USER_WARNING === $type || \E_WARNING === $type ? $msg : null; }); - $this->assertNull(mb_convert_encoding(['déjà', 'là'], 'Utf-8', 'Html-entities')); - restore_error_handler(); - $this->assertSame('mb_convert_encoding() expects parameter 1 to be string, array given', $errorMessage); - } - /** * @covers \Symfony\Polyfill\Mbstring\Mbstring::mb_decode_numericentity */ @@ -496,8 +480,6 @@ public function testCheckEncoding() /** * @covers \Symfony\Polyfill\Mbstring\Mbstring::mb_check_encoding - * - * @requires PHP 7.2 */ public function testCheckEncodingWithArrayValue() { @@ -524,20 +506,6 @@ public function testCheckEncodingWithArrayValue() $this->assertFalse(mb_check_encoding(['aςσb' => 'aςσb', 'abc' => ['abc' => 'abc', "\xE9" => 'aςσb']], 'UTF8')); } - /** - * @covers \Symfony\Polyfill\Mbstring\Mbstring::mb_check_encoding - * - * @requires PHP < 7.2 - */ - public function testCheckEncodingWithArrayValueForPhpLessThan72() - { - $errorMessage = null; - set_error_handler(function ($type, $msg, $file, $line) use (&$errorMessage) { $errorMessage = \E_USER_WARNING === $type || \E_WARNING === $type ? $msg : null; }); - $this->assertNull(mb_check_encoding(['aςσb'], 'UTF8')); - restore_error_handler(); - $this->assertSame('mb_check_encoding() expects parameter 1 to be string, array given', $errorMessage); - } - /** * @covers \Symfony\Polyfill\Mbstring\Mbstring::mb_detect_encoding */ diff --git a/tests/Php72/Php72Test.php b/tests/Php72/Php72Test.php deleted file mode 100644 index 55b2b01e1..000000000 --- a/tests/Php72/Php72Test.php +++ /dev/null @@ -1,204 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Tests\Php72; - -use PHPUnit\Framework\TestCase; -use Symfony\Polyfill\Php72\Php72 as p; - -/** - * @author Nicolas Grekas - * - * @covers \Symfony\Polyfill\Php72\Php72:: - */ -class Php72Test extends TestCase -{ - /** - * @covers \Symfony\Polyfill\Php72\Php72::utf8_encode - * @covers \Symfony\Polyfill\Php72\Php72::utf8_decode - */ - public function testUtf8Encode() - { - $s = array_map('chr', range(0, 255)); - $s = implode('', $s); - $e = utf8_encode($s); - - $this->assertSame(utf8_encode($s), utf8_encode($s)); - $this->assertSame(utf8_decode($e), utf8_decode($e)); - $this->assertSame('??', utf8_decode('Σ어')); - - $s = 444; - - $this->assertSame(utf8_encode($s), utf8_encode($s)); - $this->assertSame(utf8_decode($s), utf8_decode($s)); - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::php_os_family - */ - public function testPhpOsFamily() - { - $this->assertTrue(\defined('PHP_OS_FAMILY')); - $this->assertSame(\PHP_OS_FAMILY, p::php_os_family()); - } - - /** - * @requires PHP <7.3 - */ - public function testPhpFloat() - { - $this->assertSame(15, \PHP_FLOAT_DIG); - $this->assertSame(2.2204460492503E-16, \PHP_FLOAT_EPSILON); - $this->assertSame(2.2250738585072E-308, \PHP_FLOAT_MIN); - $this->assertSame(1.7976931348623157E+308, \PHP_FLOAT_MAX); - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::spl_object_id - */ - public function testSplObjectId() - { - $obj = new \stdClass(); - $id = spl_object_id($obj); - ob_start(); - var_dump($obj); - $dump = ob_get_clean(); - - $this->assertStringContainsString("#$id ", $dump); - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::spl_object_id - * - * @requires PHP < 8 - */ - public function testSplObjectIdWithInvalidType() - { - $this->assertNull(@spl_object_id(123)); - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::spl_object_id - */ - public function testSplObjectIdUniqueValues() - { - // Should be able to represent more than 2**16 ids on 32-bit systems. - $result = []; - for ($i = 0; $i < 70000; ++$i) { - $obj = new \stdClass(); - $result[spl_object_id($obj)] = $obj; - } - $this->assertCount(70000, $result); - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::sapi_windows_vt100_support - */ - public function testSapiWindowsVt100Support() - { - if ('\\' !== \DIRECTORY_SEPARATOR) { - $this->markTestSkipped('Windows only test'); - } - - $this->assertFalse(sapi_windows_vt100_support(\STDIN, true)); - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::sapi_windows_vt100_support - */ - public function testSapiWindowsVt100SupportWarnsOnInvalidInputType() - { - if ('\\' !== \DIRECTORY_SEPARATOR) { - $this->markTestSkipped('Windows only test'); - } - - try { - sapi_windows_vt100_support('foo', true); - } catch (\PHPUnit\Framework\Error\Warning $e) { - $this->expectWarning(); - $this->expectWarningMessage('expects parameter 1 to be resource'); - - throw $e; - } - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::sapi_windows_vt100_support - */ - public function testSapiWindowsVt100SupportWarnsOnInvalidStream() - { - if ('\\' !== \DIRECTORY_SEPARATOR) { - $this->markTestSkipped('Windows only test'); - } - - try { - sapi_windows_vt100_support(fopen('php://memory', 'w'), true); - } catch (\PHPUnit\Framework\Error\Warning $e) { - $this->expectWarning(); - $this->expectWarningMessage('was not able to analyze the specified stream'); - - throw $e; - } - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::stream_isatty - */ - public function testStreamIsatty() - { - $fp = fopen('php://temp', 'r+'); - $this->assertFalse(stream_isatty($fp)); - fclose($fp); - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::stream_isatty - * - * @requires PHP < 8 - */ - public function testStreamIsattyWarnsOnInvalidInputType() - { - try { - stream_isatty('foo'); - } catch (\PHPUnit\Framework\Error\Warning $e) { - $this->expectWarning(); - $this->expectWarningMessage('expects parameter 1 to be resource'); - - throw $e; - } - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::mb_chr - */ - public function testChr() - { - $this->assertSame("\xF0\xA0\xAE\xB7", mb_chr(0x20BB7)); - $this->assertSame("\xE9", mb_chr(0xE9, 'CP1252')); - } - - /** - * @covers \Symfony\Polyfill\Php72\Php72::mb_ord - */ - public function testOrd() - { - $this->assertSame(0x20BB7, mb_ord("\xF0\xA0\xAE\xB7")); - $this->assertSame(0xE9, mb_ord("\xE9", 'CP1252')); - } - - public function testScrub() - { - $subst = mb_substitute_character(); - mb_substitute_character('none'); - $this->assertSame('ab', mb_scrub("a\xE9b")); - mb_substitute_character($subst); - } -}