Re-dump autoloader and composer.lock

This commit is contained in:
Stephen Abello
2025-09-18 10:26:38 +02:00
parent 7e515e7216
commit edbe4974ac
613 changed files with 5661 additions and 4259 deletions

View File

@@ -26,6 +26,7 @@ namespace Symfony\Polyfill\Intl\Grapheme;
* - grapheme_strrpos - Find position (in grapheme units) of last occurrence of a string
* - grapheme_strstr - Returns part of haystack string from the first occurrence of needle to the end of haystack
* - grapheme_substr - Return part of a string
* - grapheme_str_split - Splits a string into an array of individual or chunks of graphemes
*
* @author Nicolas Grekas <p@tchwork.com>
*
@@ -191,6 +192,37 @@ final class Grapheme
return mb_strstr($s, $needle, $beforeNeedle, 'UTF-8');
}
public static function grapheme_str_split($s, $len = 1)
{
if (0 > $len || 1073741823 < $len) {
if (80000 > \PHP_VERSION_ID) {
return false;
}
throw new \ValueError('grapheme_str_split(): Argument #2 ($length) must be greater than 0 and less than or equal to 1073741823.');
}
if ('' === $s) {
return [];
}
if (!preg_match_all('/('.SYMFONY_GRAPHEME_CLUSTER_RX.')/u', $s, $matches)) {
return false;
}
if (1 === $len) {
return $matches[0];
}
$chunks = array_chunk($matches[0], $len);
foreach ($chunks as &$chunk) {
$chunk = implode('', $chunk);
}
return $chunks;
}
private static function grapheme_position($s, $needle, $offset, $mode)
{
$needle = (string) $needle;