Skip to content

Commit ba9fd9b

Browse files
Use ??= more
1 parent 45b4b03 commit ba9fd9b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

AbstractUnicodeString.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ public function ascii(array $rules = []): self
121121
$s = preg_replace("/([AUO])\u{0308}(?=\p{Ll})/u", '$1e', $s);
122122
$s = str_replace(["a\u{0308}", "o\u{0308}", "u\u{0308}", "A\u{0308}", "O\u{0308}", "U\u{0308}"], ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], $s);
123123
} elseif (\function_exists('transliterator_transliterate')) {
124-
if (null === $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule)) {
124+
if (null === $transliterator = self::$transliterators[$rule] ??= \Transliterator::create($rule)) {
125125
if ('any-latin/bgn' === $rule) {
126126
$rule = 'any-latin';
127-
$transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule);
127+
$transliterator = self::$transliterators[$rule] ??= \Transliterator::create($rule);
128128
}
129129

130130
if (null === $transliterator) {
@@ -550,9 +550,7 @@ private function wcswidth(string $string): int
550550
return -1;
551551
}
552552

553-
if (null === self::$tableZero) {
554-
self::$tableZero = require __DIR__.'/Resources/data/wcswidth_table_zero.php';
555-
}
553+
self::$tableZero ??= require __DIR__.'/Resources/data/wcswidth_table_zero.php';
556554

557555
if ($codePoint >= self::$tableZero[0][0] && $codePoint <= self::$tableZero[$ubound = \count(self::$tableZero) - 1][1]) {
558556
$lbound = 0;
@@ -569,9 +567,7 @@ private function wcswidth(string $string): int
569567
}
570568
}
571569

572-
if (null === self::$tableWide) {
573-
self::$tableWide = require __DIR__.'/Resources/data/wcswidth_table_wide.php';
574-
}
570+
self::$tableWide ??= require __DIR__.'/Resources/data/wcswidth_table_wide.php';
575571

576572
if ($codePoint >= self::$tableWide[0][0] && $codePoint <= self::$tableWide[$ubound = \count(self::$tableWide) - 1][1]) {
577573
$lbound = 0;

0 commit comments

Comments
 (0)