sort($firstChars);
$quickCheck = '"'.
str_replace('%', '\\x',
rawurlencode(implode('',
$firstChars))).'"';
$file =
dirname(__DIR__, 2
).'/Transliterator/EmojiTransliterator.php';
file_put_contents($file,
preg_replace('/QUICK_CHECK = .*;/m', "QUICK_CHECK = {
$quickCheck};",
file_get_contents($file)));
} private static function testEmoji(string
$emoji, string
$locale): void
{ if (!Transliterator::
createFromRules("\\
$emoji > test ;"
)) { throw new \
RuntimeException(sprintf('Could not create transliterator for "%s" in "%s" locale. Error: "%s".',
$emoji,
$locale,
intl_get_error_message()));
} } private static function createRules(array
$maps): array
{ // We must sort the maps by the number of code points, because the order really matters:
// 🫶🏼 must be before 🫶
krsort($maps);
$maps =
array_merge(...
$maps);