| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of the Symfony package. |
| 5 |
* |
| 6 |
* (c) Fabien Potencier <[email protected]> |
| 7 |
* |
| 8 |
* For the full copyright and license information, please view the LICENSE |
| 9 |
* file that was distributed with this source code. |
| 10 |
*/ |
| 11 |
|
| 12 |
use Symfony\Polyfill\Php84 as p; |
| 13 |
|
| 14 |
if (\PHP_VERSION_ID >= 80400) { |
| 15 |
return; |
| 16 |
} |
| 17 |
|
| 18 |
if (defined('CURL_VERSION_HTTP3') || \PHP_VERSION_ID < 80200 && function_exists('curl_version') && curl_version()['version'] >= 0x074200) { // libcurl >= 7.66.0 |
| 19 |
if (!defined('CURL_HTTP_VERSION_3')) { |
| 20 |
define('CURL_HTTP_VERSION_3', 30); |
| 21 |
} |
| 22 |
|
| 23 |
if (!defined('CURL_HTTP_VERSION_3ONLY') && defined('CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256')) { // libcurl >= 7.80.0 (7.88 would be better but is slow to check) |
| 24 |
define('CURL_HTTP_VERSION_3ONLY', 31); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
if (!function_exists('array_find')) { |
| 29 |
function array_find(array $array, callable $callback) { return p\Php84::array_find($array, $callback); } |
| 30 |
} |
| 31 |
|
| 32 |
if (!function_exists('array_find_key')) { |
| 33 |
function array_find_key(array $array, callable $callback) { return p\Php84::array_find_key($array, $callback); } |
| 34 |
} |
| 35 |
|
| 36 |
if (!function_exists('array_any')) { |
| 37 |
function array_any(array $array, callable $callback): bool { return p\Php84::array_any($array, $callback); } |
| 38 |
} |
| 39 |
|
| 40 |
if (!function_exists('array_all')) { |
| 41 |
function array_all(array $array, callable $callback): bool { return p\Php84::array_all($array, $callback); } |
| 42 |
} |
| 43 |
|
| 44 |
if (!function_exists('fpow')) { |
| 45 |
function fpow(float $num, float $exponent): float { return p\Php84::fpow($num, $exponent); } |
| 46 |
} |
| 47 |
|
| 48 |
if (\PHP_VERSION_ID >= 80000) { |
| 49 |
return require __DIR__.'/bootstrap80.php'; |
| 50 |
} |
| 51 |
|
| 52 |
if (extension_loaded('mbstring')) { |
| 53 |
if (!function_exists('mb_ucfirst')) { |
| 54 |
function mb_ucfirst(string $string, ?string $encoding = null) { return p\Php84::mb_ucfirst($string, $encoding); } |
| 55 |
} |
| 56 |
|
| 57 |
if (!function_exists('mb_lcfirst')) { |
| 58 |
function mb_lcfirst(string $string, ?string $encoding = null) { return p\Php84::mb_lcfirst($string, $encoding); } |
| 59 |
} |
| 60 |
|
| 61 |
if (!function_exists('mb_trim')) { |
| 62 |
function mb_trim(string $string, ?string $characters = null, ?string $encoding = null) { return p\Php84::mb_trim($string, $characters, $encoding); } |
| 63 |
} |
| 64 |
|
| 65 |
if (!function_exists('mb_ltrim')) { |
| 66 |
function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null) { return p\Php84::mb_ltrim($string, $characters, $encoding); } |
| 67 |
} |
| 68 |
|
| 69 |
if (!function_exists('mb_rtrim')) { |
| 70 |
function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null) { return p\Php84::mb_rtrim($string, $characters, $encoding); } |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
if (extension_loaded('bcmath')) { |
| 75 |
if (!function_exists('bcceil')) { |
| 76 |
function bcceil(string $num): string { return p\Php84::bcceil($num); } |
| 77 |
} |
| 78 |
if (!function_exists('bcdivmod')) { |
| 79 |
function bcdivmod(string $num1, string $num2, ?int $scale = null): ?array { return p\Php84::bcdivmod($num1, $num2, $scale); } |
| 80 |
} |
| 81 |
if (!function_exists('bcfloor')) { |
| 82 |
function bcfloor(string $num): string { return p\Php84::bcfloor($num); } |
| 83 |
} |
| 84 |
if (!function_exists('bcround')) { |
| 85 |
function bcround(string $num, int $precision = 0, $mode = RoundingMode::HalfAwayFromZero): string { return p\Php84::bcround($num, $precision, $mode); } |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
if (extension_loaded('intl') && !function_exists('grapheme_str_split')) { |
| 90 |
function grapheme_str_split(string $string, int $length = 1) { return p\Php84::grapheme_str_split($string, $length); } |
| 91 |
} |