@@ -52,14 +52,9 @@ public static function create(string $id, int $direction = self::FORWARD): self
52
52
static $ maps ;
53
53
54
54
// Create an instance of \Transliterator with a custom id; that's the only way
55
- if (\PHP_VERSION_ID >= 80200 ) {
56
- static $ newInstance ;
57
- $ instance = ($ newInstance ??= (new \ReflectionClass (self ::class))->newInstanceWithoutConstructor (...))();
58
- $ instance ->id = $ id ;
59
- } else {
60
- $ instance = unserialize (sprintf ('O:%d:"%s":1:{s:2:"id";s:%d:"%s";} ' , \strlen (self ::class), self ::class, \strlen ($ id ), $ id ));
61
- }
62
-
55
+ static $ newInstance ;
56
+ $ instance = ($ newInstance ??= (new \ReflectionClass (self ::class))->newInstanceWithoutConstructor (...))();
57
+ $ instance ->id = $ id ;
63
58
$ instance ->map = $ maps [$ id ] ??= str_ends_with ($ file , '.gz ' ) ? GzipStreamWrapper::require ($ file ) : require $ file ;
64
59
65
60
return $ instance ;
@@ -132,32 +127,17 @@ public function transliterate(string $string, int $start = 0, int $end = -1): st
132
127
}
133
128
}
134
129
135
- if (\PHP_VERSION_ID >= 80200 ) {
136
- final class EmojiTransliterator extends \Transliterator
137
- {
138
- use EmojiTransliteratorTrait;
130
+ final class EmojiTransliterator extends \Transliterator
131
+ {
132
+ use EmojiTransliteratorTrait;
139
133
140
- private const QUICK_CHECK = "\xA9\xAE\xE2\xE3\xF0" ;
141
- private const REVERSEABLE_IDS = [
142
- 'emoji-github ' => 'github-emoji ' ,
143
- 'emoji-slack ' => 'slack-emoji ' ,
144
- 'github-emoji ' => 'emoji-github ' ,
145
- 'slack-emoji ' => 'emoji-slack ' ,
146
- ];
134
+ private const QUICK_CHECK = "\xA9\xAE\xE2\xE3\xF0" ;
135
+ private const REVERSEABLE_IDS = [
136
+ 'emoji-github ' => 'github-emoji ' ,
137
+ 'emoji-slack ' => 'slack-emoji ' ,
138
+ 'github-emoji ' => 'emoji-github ' ,
139
+ 'slack-emoji ' => 'emoji-slack ' ,
140
+ ];
147
141
148
- public readonly string $ id ;
149
- }
150
- } else {
151
- final class EmojiTransliterator extends \Transliterator
152
- {
153
- use EmojiTransliteratorTrait;
154
-
155
- private const QUICK_CHECK = "\xA9\xAE\xE2\xE3\xF0" ;
156
- private const REVERSEABLE_IDS = [
157
- 'emoji-github ' => 'github-emoji ' ,
158
- 'emoji-slack ' => 'slack-emoji ' ,
159
- 'github-emoji ' => 'emoji-github ' ,
160
- 'slack-emoji ' => 'emoji-slack ' ,
161
- ];
162
- }
142
+ public readonly string $ id ;
163
143
}
0 commit comments