Skip to content

Commit 1628aa4

Browse files
committed
Leverage non-capturing catches
1 parent 1b92d10 commit 1628aa4

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

Compiler/AttributeAutoconfigurationPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function process(ContainerBuilder $container): void
5555

5656
try {
5757
$attributeReflector = new \ReflectionClass($attributeName);
58-
} catch (\ReflectionException $e) {
58+
} catch (\ReflectionException) {
5959
continue;
6060
}
6161

@@ -103,7 +103,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
103103
if ($this->parameterAttributeConfigurators) {
104104
try {
105105
$constructorReflector = $this->getConstructor($value, false);
106-
} catch (RuntimeException $e) {
106+
} catch (RuntimeException) {
107107
$constructorReflector = null;
108108
}
109109

Compiler/AutowireRequiredMethodsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
7373
}
7474
try {
7575
$r = $r->getPrototype();
76-
} catch (\ReflectionException $e) {
76+
} catch (\ReflectionException) {
7777
break; // method has no prototype
7878
}
7979
}

Compiler/CheckTypeDeclarationsPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private function checkType(Definition $checkedDefinition, mixed $value, \Reflect
226226
} elseif ($value instanceof Expression) {
227227
try {
228228
$value = $this->getExpressionLanguage()->evaluate($value, ['container' => $this->container]);
229-
} catch (\Exception $e) {
229+
} catch (\Exception) {
230230
// If a service from the expression cannot be fetched from the container, we skip the validation.
231231
return;
232232
}
@@ -241,7 +241,7 @@ private function checkType(Definition $checkedDefinition, mixed $value, \Reflect
241241
if ('' === preg_replace('/'.$envPlaceholderUniquePrefix.'_\w+_[a-f0-9]{32}/U', '', $value, -1, $c) && 1 === $c) {
242242
try {
243243
$value = $this->container->resolveEnvPlaceholders($value, true);
244-
} catch (\Exception $e) {
244+
} catch (\Exception) {
245245
// If an env placeholder cannot be resolved, we skip the validation.
246246
return;
247247
}

Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public function reset()
281281
if ($service instanceof ResetInterface) {
282282
$service->reset();
283283
}
284-
} catch (\Throwable $e) {
284+
} catch (\Throwable) {
285285
continue;
286286
}
287287
}

Dumper/GraphvizDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private function findNodes(): array
161161

162162
try {
163163
$class = $this->container->getParameterBag()->resolveValue($class);
164-
} catch (ParameterNotFoundException $e) {
164+
} catch (ParameterNotFoundException) {
165165
}
166166

167167
$nodes[$id] = ['class' => str_replace('\\', '\\\\', $class), 'attributes' => array_merge($this->options['node.definition'], ['style' => $definition->isShared() ? 'filled' : 'dotted'])];

Dumper/Preloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private static function doPreload(string $class, array &$preloaded): void
109109

110110
self::preloadType($m->getReturnType(), $preloaded);
111111
}
112-
} catch (\Throwable $e) {
112+
} catch (\Throwable) {
113113
// ignore missing classes
114114
}
115115
}

EnvVarProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed
104104
if ('' !== $env && null !== $env) {
105105
return $env;
106106
}
107-
} catch (EnvNotFoundException $e) {
107+
} catch (EnvNotFoundException) {
108108
// no-op
109109
}
110110

@@ -160,7 +160,7 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed
160160
if ($ended || $count === $i) {
161161
$loaders = $this->loaders;
162162
}
163-
} catch (ParameterCircularReferenceException $e) {
163+
} catch (ParameterCircularReferenceException) {
164164
// skip loaders that need an env var that is not defined
165165
} finally {
166166
$this->loaders = $loaders;

0 commit comments

Comments
 (0)