bootstrap85.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. // The $locale argument added to grapheme_*() in PHP 8.5 / ICU 74 is accepted
  11. // for native-signature compatibility but ignored by the polyfill, which only
  12. // performs UTF-8 case folding.
  13. use Symfony\Polyfill\Intl\Grapheme as p;
  14. if (!function_exists('grapheme_stripos')) {
  15. function grapheme_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $locale = ''): int|false { return p\Grapheme::grapheme_stripos((string) $haystack, (string) $needle, (int) $offset); }
  16. }
  17. if (!function_exists('grapheme_stristr')) {
  18. function grapheme_stristr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false, ?string $locale = ''): string|false { return p\Grapheme::grapheme_stristr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
  19. }
  20. if (!function_exists('grapheme_strlen')) {
  21. function grapheme_strlen(?string $string): int|false|null { return p\Grapheme::grapheme_strlen((string) $string); }
  22. }
  23. if (!function_exists('grapheme_strpos')) {
  24. function grapheme_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $locale = ''): int|false { return p\Grapheme::grapheme_strpos((string) $haystack, (string) $needle, (int) $offset); }
  25. }
  26. if (!function_exists('grapheme_strripos')) {
  27. function grapheme_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $locale = ''): int|false { return p\Grapheme::grapheme_strripos((string) $haystack, (string) $needle, (int) $offset); }
  28. }
  29. if (!function_exists('grapheme_strrpos')) {
  30. function grapheme_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $locale = ''): int|false { return p\Grapheme::grapheme_strrpos((string) $haystack, (string) $needle, (int) $offset); }
  31. }
  32. if (!function_exists('grapheme_strstr')) {
  33. function grapheme_strstr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false, ?string $locale = ''): string|false { return p\Grapheme::grapheme_strstr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
  34. }
  35. if (!function_exists('grapheme_substr')) {
  36. function grapheme_substr(?string $string, ?int $offset, ?int $length = null, ?string $locale = ''): string|false { return p\Grapheme::grapheme_substr((string) $string, (int) $offset, $length); }
  37. }