| 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 |
// The $locale argument added to grapheme_*() in PHP 8.5 / ICU 74 is accepted |
| 13 |
// for native-signature compatibility but ignored by the polyfill, which only |
| 14 |
// performs UTF-8 case folding. |
| 15 |
|
| 16 |
use Symfony\Polyfill\Intl\Grapheme as p; |
| 17 |
|
| 18 |
if (!function_exists('grapheme_stripos')) { |
| 19 |
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); } |
| 20 |
} |
| 21 |
if (!function_exists('grapheme_stristr')) { |
| 22 |
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); } |
| 23 |
} |
| 24 |
if (!function_exists('grapheme_strlen')) { |
| 25 |
function grapheme_strlen(?string $string): int|false|null { return p\Grapheme::grapheme_strlen((string) $string); } |
| 26 |
} |
| 27 |
if (!function_exists('grapheme_strpos')) { |
| 28 |
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); } |
| 29 |
} |
| 30 |
if (!function_exists('grapheme_strripos')) { |
| 31 |
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); } |
| 32 |
} |
| 33 |
if (!function_exists('grapheme_strrpos')) { |
| 34 |
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); } |
| 35 |
} |
| 36 |
if (!function_exists('grapheme_strstr')) { |
| 37 |
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); } |
| 38 |
} |
| 39 |
if (!function_exists('grapheme_substr')) { |
| 40 |
function grapheme_substr(?string $string, ?int $offset, ?int $length = null, ?string $locale = ''): string|false { return p\Grapheme::grapheme_substr((string) $string, (int) $offset, $length); } |
| 41 |
} |