Skip to content

Commit 8592bf6

Browse files
Update and apply CS rules
1 parent a40894e commit 8592bf6

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

Normalizer.php

+15-15
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@
2323
*/
2424
class Normalizer
2525
{
26-
const FORM_D = \Normalizer::FORM_D;
27-
const FORM_KD = \Normalizer::FORM_KD;
28-
const FORM_C = \Normalizer::FORM_C;
29-
const FORM_KC = \Normalizer::FORM_KC;
30-
const NFD = \Normalizer::NFD;
31-
const NFKD = \Normalizer::NFKD;
32-
const NFC = \Normalizer::NFC;
33-
const NFKC = \Normalizer::NFKC;
26+
public const FORM_D = \Normalizer::FORM_D;
27+
public const FORM_KD = \Normalizer::FORM_KD;
28+
public const FORM_C = \Normalizer::FORM_C;
29+
public const FORM_KC = \Normalizer::FORM_KC;
30+
public const NFD = \Normalizer::NFD;
31+
public const NFKD = \Normalizer::NFKD;
32+
public const NFC = \Normalizer::NFC;
33+
public const NFKC = \Normalizer::NFKC;
3434

3535
private static $C;
3636
private static $D;
3737
private static $KD;
3838
private static $cC;
39-
private static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
39+
private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
4040
private static $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
4141

4242
public static function isNormalized(string $s, int $form = self::FORM_C)
4343
{
44-
if (!\in_array($form, array(self::NFD, self::NFKD, self::NFC, self::NFKC))) {
44+
if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) {
4545
return false;
4646
}
4747
if (!isset($s[strspn($s, self::$ASCII)])) {
@@ -154,7 +154,7 @@ private static function recompose($s)
154154
|| $lastUcls) {
155155
// Table lookup and combining chars composition
156156

157-
$ucls = isset($combClass[$uchr]) ? $combClass[$uchr] : 0;
157+
$ucls = $combClass[$uchr] ?? 0;
158158

159159
if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) {
160160
$lastUchr = $compMap[$lastUchr.$uchr];
@@ -206,7 +206,7 @@ private static function decompose($s, $c)
206206
$compatMap = self::$KD;
207207
}
208208

209-
$c = array();
209+
$c = [];
210210
$i = 0;
211211
$len = \strlen($s);
212212

@@ -217,7 +217,7 @@ private static function decompose($s, $c)
217217
if ($c) {
218218
ksort($c);
219219
$result .= implode('', $c);
220-
$c = array();
220+
$c = [];
221221
}
222222

223223
$j = 1 + strspn($s, $ASCII, $i + 1);
@@ -233,7 +233,7 @@ private static function decompose($s, $c)
233233
if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr) {
234234
// Table lookup
235235

236-
if ($uchr !== $j = isset($compatMap[$uchr]) ? $compatMap[$uchr] : (isset($decompMap[$uchr]) ? $decompMap[$uchr] : $uchr)) {
236+
if ($uchr !== $j = $compatMap[$uchr] ?? ($decompMap[$uchr] ?? $uchr)) {
237237
$uchr = $j;
238238

239239
$j = \strlen($uchr);
@@ -285,7 +285,7 @@ private static function decompose($s, $c)
285285
if ($c) {
286286
ksort($c);
287287
$result .= implode('', $c);
288-
$c = array();
288+
$c = [];
289289
}
290290

291291
$result .= $uchr;

Resources/stubs/Normalizer.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ class Normalizer extends Symfony\Polyfill\Intl\Normalizer\Normalizer
55
/**
66
* @deprecated since ICU 56 and removed in PHP 8
77
*/
8-
const NONE = 1;
9-
const FORM_D = 2;
10-
const FORM_KD = 3;
11-
const FORM_C = 4;
12-
const FORM_KC = 5;
13-
const NFD = 2;
14-
const NFKD = 3;
15-
const NFC = 4;
16-
const NFKC = 5;
8+
public const NONE = 1;
9+
public const FORM_D = 2;
10+
public const FORM_KD = 3;
11+
public const FORM_C = 4;
12+
public const FORM_KC = 5;
13+
public const NFD = 2;
14+
public const NFKD = 3;
15+
public const NFC = 4;
16+
public const NFKC = 5;
1717
}

bootstrap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
use Symfony\Polyfill\Intl\Normalizer as p;
1313

14-
if (PHP_VERSION_ID >= 80000) {
14+
if (\PHP_VERSION_ID >= 80000) {
1515
return require __DIR__.'/bootstrap80.php';
1616
}
1717

0 commit comments

Comments
 (0)