Skip to content

Commit af0cd84

Browse files
[7.0] Bump to PHP 8.2 minimum
1 parent 09dd9b1 commit af0cd84

File tree

3 files changed

+18
-38
lines changed

3 files changed

+18
-38
lines changed

Resources/emoji/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
],
1616
"require": {
17-
"php": ">=7.2",
17+
"php": ">=8.2",
1818
"symfony/filesystem": "^6.4|^7.0",
1919
"symfony/finder": "^6.4|^7.0",
2020
"symfony/var-exporter": "^6.4|^7.0",

Transliterator/EmojiTransliterator.php

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,9 @@ public static function create(string $id, int $direction = self::FORWARD): self
5252
static $maps;
5353

5454
// 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;
6358
$instance->map = $maps[$id] ??= str_ends_with($file, '.gz') ? GzipStreamWrapper::require($file) : require $file;
6459

6560
return $instance;
@@ -132,32 +127,17 @@ public function transliterate(string $string, int $start = 0, int $end = -1): st
132127
}
133128
}
134129

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;
139133

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+
];
147141

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;
163143
}

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
}
2525
],
2626
"require": {
27-
"php": ">=8.1"
27+
"php": ">=8.2"
2828
},
2929
"require-dev": {
30-
"symfony/filesystem": "^5.4|^6.0|^7.0",
31-
"symfony/finder": "^5.4|^6.0|^7.0"
30+
"symfony/filesystem": "^6.4|^7.0",
31+
"symfony/finder": "^6.4|^7.0"
3232
},
3333
"autoload": {
3434
"psr-4": { "Symfony\\Component\\Intl\\": "" },

0 commit comments

Comments
 (0)