Skip to content

Commit 9ec99bc

Browse files
committed
Leverage non-capturing catches
1 parent aed08e5 commit 9ec99bc

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

Countries.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static function exists(string $alpha2Code): bool
6868
self::readEntry(['Names', $alpha2Code]);
6969

7070
return true;
71-
} catch (MissingResourceException $e) {
71+
} catch (MissingResourceException) {
7272
return false;
7373
}
7474
}
@@ -79,7 +79,7 @@ public static function alpha3CodeExists(string $alpha3Code): bool
7979
self::getAlpha2Code($alpha3Code);
8080

8181
return true;
82-
} catch (MissingResourceException $e) {
82+
} catch (MissingResourceException) {
8383
return false;
8484
}
8585
}

Currencies.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function exists(string $currency): bool
4242
self::readEntry(['Names', $currency, self::INDEX_NAME]);
4343

4444
return true;
45-
} catch (MissingResourceException $e) {
45+
} catch (MissingResourceException) {
4646
return false;
4747
}
4848
}
@@ -91,7 +91,7 @@ public static function getFractionDigits(string $currency): int
9191
{
9292
try {
9393
return self::readEntry(['Meta', $currency, self::INDEX_FRACTION_DIGITS], 'meta');
94-
} catch (MissingResourceException $e) {
94+
} catch (MissingResourceException) {
9595
return self::readEntry(['Meta', 'DEFAULT', self::INDEX_FRACTION_DIGITS], 'meta');
9696
}
9797
}
@@ -100,7 +100,7 @@ public static function getRoundingIncrement(string $currency): int
100100
{
101101
try {
102102
return self::readEntry(['Meta', $currency, self::INDEX_ROUNDING_INCREMENT], 'meta');
103-
} catch (MissingResourceException $e) {
103+
} catch (MissingResourceException) {
104104
return self::readEntry(['Meta', 'DEFAULT', self::INDEX_ROUNDING_INCREMENT], 'meta');
105105
}
106106
}
@@ -109,7 +109,7 @@ public static function getCashFractionDigits(string $currency): int
109109
{
110110
try {
111111
return self::readEntry(['Meta', $currency, self::INDEX_CASH_FRACTION_DIGITS], 'meta');
112-
} catch (MissingResourceException $e) {
112+
} catch (MissingResourceException) {
113113
return self::readEntry(['Meta', 'DEFAULT', self::INDEX_CASH_FRACTION_DIGITS], 'meta');
114114
}
115115
}
@@ -118,7 +118,7 @@ public static function getCashRoundingIncrement(string $currency): int
118118
{
119119
try {
120120
return self::readEntry(['Meta', $currency, self::INDEX_CASH_ROUNDING_INCREMENT], 'meta');
121-
} catch (MissingResourceException $e) {
121+
} catch (MissingResourceException) {
122122
return self::readEntry(['Meta', 'DEFAULT', self::INDEX_CASH_ROUNDING_INCREMENT], 'meta');
123123
}
124124
}

Data/Bundle/Reader/IntlBundleReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function read(string $path, string $locale): mixed
3333
try {
3434
// Never enable fallback. We want to know if a bundle cannot be found
3535
$bundle = new \ResourceBundle($locale, $path, false);
36-
} catch (\Exception $e) {
36+
} catch (\Exception) {
3737
$bundle = null;
3838
}
3939

Data/Generator/LocaleDataGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, str
100100
// Script, Region and Variants are optional. If none of them is
101101
// available, the braces are not printed.
102102
$localeNames[$locale] = $this->generateLocaleName($reader, $tempDir, $locale, $displayLocale, $pattern, $separator);
103-
} catch (MissingResourceException $e) {
103+
} catch (MissingResourceException) {
104104
// Silently ignore incomplete locale names
105105
// In this case one should configure at least one fallback locale that is complete (e.g. English) during
106106
// runtime. Alternatively a translation for the missing resource can be proposed upstream.

Data/Generator/TimezoneDataGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private function generateZones(BundleEntryReaderInterface $reader, string $tempD
182182
if (isset($this->zoneToCountryMapping[$id])) {
183183
try {
184184
$country = $reader->readEntry($tempDir.'/region', $locale, ['Countries', $this->zoneToCountryMapping[$id]]);
185-
} catch (MissingResourceException $e) {
185+
} catch (MissingResourceException) {
186186
return null;
187187
}
188188

@@ -200,7 +200,7 @@ private function generateZones(BundleEntryReaderInterface $reader, string $tempD
200200
foreach (\func_get_args() as $indices) {
201201
try {
202202
return $reader->readEntry($tempDir, $locale, $indices);
203-
} catch (MissingResourceException $e) {
203+
} catch (MissingResourceException) {
204204
}
205205
}
206206

Intl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function getIcuVersion(): ?string
8484
preg_match('/^ICU version (?:=>)?(.*)$/m', $output, $matches);
8585

8686
self::$icuVersion = trim($matches[1]);
87-
} catch (\ReflectionException $e) {
87+
} catch (\ReflectionException) {
8888
self::$icuVersion = null;
8989
}
9090
}

Languages.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function exists(string $language): bool
4444
self::readEntry(['Names', $language]);
4545

4646
return true;
47-
} catch (MissingResourceException $e) {
47+
} catch (MissingResourceException) {
4848
return false;
4949
}
5050
}
@@ -60,7 +60,7 @@ public static function getName(string $language, string $displayLocale = null):
6060
{
6161
try {
6262
return self::readEntry(['Names', $language], $displayLocale);
63-
} catch (MissingResourceException $e) {
63+
} catch (MissingResourceException) {
6464
try {
6565
return self::readEntry(['LocalizedNames', $language], $displayLocale);
6666
} catch (MissingResourceException $e) {
@@ -124,7 +124,7 @@ public static function alpha3CodeExists(string $language): bool
124124
self::getAlpha2Code($language);
125125

126126
return true;
127-
} catch (MissingResourceException $e) {
127+
} catch (MissingResourceException) {
128128
static $cache;
129129
if (null === $cache) {
130130
$cache = array_flip(self::getAlpha3Codes());
@@ -170,7 +170,7 @@ public static function getAlpha3Names(string $displayLocale = null): array
170170
}
171171
try {
172172
$alpha3Names[self::getAlpha3Code($alpha2Code)] = $name;
173-
} catch (MissingResourceException $e) {
173+
} catch (MissingResourceException) {
174174
}
175175
}
176176

Locales.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static function exists(string $locale): bool
4343
self::readEntry(['Names', $locale]);
4444

4545
return true;
46-
} catch (MissingResourceException $e) {
46+
} catch (MissingResourceException) {
4747
return \in_array($locale, self::getAliases(), true);
4848
}
4949
}

Scripts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function exists(string $script): bool
3535
self::readEntry(['Names', $script]);
3636

3737
return true;
38-
} catch (MissingResourceException $e) {
38+
} catch (MissingResourceException) {
3939
return false;
4040
}
4141
}

Timezones.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ public static function exists(string $timezone): bool
3535
self::readEntry(['Names', $timezone]);
3636

3737
return true;
38-
} catch (MissingResourceException $e) {
38+
} catch (MissingResourceException) {
3939
try {
4040
new \DateTimeZone($timezone);
4141

4242
return true;
43-
} catch (\Exception $e) {
43+
} catch (\Exception) {
4444
return false;
4545
}
4646
}

0 commit comments

Comments
 (0)