Skip to content

Commit b802731

Browse files
committed
Leverage non-capturing catches
1 parent 73b8062 commit b802731

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

ChoiceList/Factory/PropertyAccessDecorator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function createView(ChoiceListInterface $list, mixed $preferredChoices =
148148
$preferredChoices = function ($choice) use ($accessor, $preferredChoices) {
149149
try {
150150
return $accessor->getValue($choice, $preferredChoices);
151-
} catch (UnexpectedTypeException $e) {
151+
} catch (UnexpectedTypeException) {
152152
// Assume not preferred if not readable
153153
return false;
154154
}
@@ -173,7 +173,7 @@ public function createView(ChoiceListInterface $list, mixed $preferredChoices =
173173
$groupBy = function ($choice) use ($accessor, $groupBy) {
174174
try {
175175
return $accessor->getValue($choice, $groupBy);
176-
} catch (UnexpectedTypeException $e) {
176+
} catch (UnexpectedTypeException) {
177177
// Don't group if path is not readable
178178
return null;
179179
}

Console/Descriptor/Descriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected function getOptionDefinition(OptionsResolver $optionsResolver, string
135135
foreach ($map as $key => $method) {
136136
try {
137137
$definition[$key] = $introspector->{$method}($option);
138-
} catch (NoConfigurationException $e) {
138+
} catch (NoConfigurationException) {
139139
// noop
140140
}
141141
}

Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private function getFileLink(string $class): string
213213

214214
try {
215215
$r = new \ReflectionClass($class);
216-
} catch (\ReflectionException $e) {
216+
} catch (\ReflectionException) {
217217
return '';
218218
}
219219

Extension/Core/Type/LanguageType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function configureOptions(OptionsResolver $resolver)
4343
try {
4444
$languageCode = $useAlpha3Codes ? Languages::getAlpha3Code($alpha2Code) : $alpha2Code;
4545
$languagesList[$languageCode] = Languages::getName($alpha2Code, $alpha2Code);
46-
} catch (MissingResourceException $e) {
46+
} catch (MissingResourceException) {
4747
// ignore errors like "Couldn't read the indices for the locale 'meta'"
4848
}
4949
}

FormRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function hasType(string $name): bool
129129

130130
try {
131131
$this->getType($name);
132-
} catch (ExceptionInterface $e) {
132+
} catch (ExceptionInterface) {
133133
return false;
134134
}
135135

Util/OptionsResolverWrapper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function setNormalizer(string $option, \Closure $normalizer): static
3131
{
3232
try {
3333
parent::setNormalizer($option, $normalizer);
34-
} catch (UndefinedOptionsException $e) {
34+
} catch (UndefinedOptionsException) {
3535
$this->undefined[$option] = true;
3636
}
3737

@@ -45,7 +45,7 @@ public function setAllowedValues(string $option, mixed $allowedValues): static
4545
{
4646
try {
4747
parent::setAllowedValues($option, $allowedValues);
48-
} catch (UndefinedOptionsException $e) {
48+
} catch (UndefinedOptionsException) {
4949
$this->undefined[$option] = true;
5050
}
5151

@@ -59,7 +59,7 @@ public function addAllowedValues(string $option, mixed $allowedValues): static
5959
{
6060
try {
6161
parent::addAllowedValues($option, $allowedValues);
62-
} catch (UndefinedOptionsException $e) {
62+
} catch (UndefinedOptionsException) {
6363
$this->undefined[$option] = true;
6464
}
6565

@@ -75,7 +75,7 @@ public function setAllowedTypes(string $option, $allowedTypes): static
7575
{
7676
try {
7777
parent::setAllowedTypes($option, $allowedTypes);
78-
} catch (UndefinedOptionsException $e) {
78+
} catch (UndefinedOptionsException) {
7979
$this->undefined[$option] = true;
8080
}
8181

@@ -91,7 +91,7 @@ public function addAllowedTypes(string $option, $allowedTypes): static
9191
{
9292
try {
9393
parent::addAllowedTypes($option, $allowedTypes);
94-
} catch (UndefinedOptionsException $e) {
94+
} catch (UndefinedOptionsException) {
9595
$this->undefined[$option] = true;
9696
}
9797

0 commit comments

Comments
 (0)