Skip to content

Commit 2f62d5a

Browse files
committed
Leverage non-capturing catches
1 parent cb43e1f commit 2f62d5a

13 files changed

+17
-17
lines changed

CacheWarmer/AbstractPhpFileCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ final protected function ignoreAutoloadException(string $class, \Exception $exce
7878
{
7979
try {
8080
ClassExistenceResource::throwOnRequiredClass($class, $exception);
81-
} catch (\ReflectionException $e) {
81+
} catch (\ReflectionException) {
8282
}
8383
}
8484

CacheWarmer/AnnotationsCacheWarmer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private function readAllComponents(Reader $reader, string $class)
8585

8686
try {
8787
$reader->getClassAnnotations($reflectionClass);
88-
} catch (AnnotationException $e) {
88+
} catch (AnnotationException) {
8989
/*
9090
* Ignore any AnnotationException to not break the cache warming process if an Annotation is badly
9191
* configured or could not be found / read / etc.
@@ -99,14 +99,14 @@ private function readAllComponents(Reader $reader, string $class)
9999
foreach ($reflectionClass->getMethods() as $reflectionMethod) {
100100
try {
101101
$reader->getMethodAnnotations($reflectionMethod);
102-
} catch (AnnotationException $e) {
102+
} catch (AnnotationException) {
103103
}
104104
}
105105

106106
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
107107
try {
108108
$reader->getPropertyAnnotations($reflectionProperty);
109-
} catch (AnnotationException $e) {
109+
} catch (AnnotationException) {
110110
}
111111
}
112112
}

CacheWarmer/SerializerCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter): bool
5454
foreach ($loader->getMappedClasses() as $mappedClass) {
5555
try {
5656
$metadataFactory->getMetadataFor($mappedClass);
57-
} catch (AnnotationException $e) {
57+
} catch (AnnotationException) {
5858
// ignore failing annotations
5959
} catch (\Exception $e) {
6060
$this->ignoreAutoloadException($mappedClass, $e);

CacheWarmer/ValidatorCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter): bool
5757
if ($metadataFactory->hasMetadataFor($mappedClass)) {
5858
$metadataFactory->getMetadataFor($mappedClass);
5959
}
60-
} catch (AnnotationException $e) {
60+
} catch (AnnotationException) {
6161
// ignore failing annotations
6262
} catch (\Exception $e) {
6363
$this->ignoreAutoloadException($mappedClass, $e);

Command/AssetsInstallCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private function relativeSymlinkWithFallback(string $originDir, string $targetDi
202202
try {
203203
$this->symlink($originDir, $targetDir, true);
204204
$method = self::METHOD_RELATIVE_SYMLINK;
205-
} catch (IOException $e) {
205+
} catch (IOException) {
206206
$method = $this->absoluteSymlinkWithFallback($originDir, $targetDir);
207207
}
208208

@@ -219,7 +219,7 @@ private function absoluteSymlinkWithFallback(string $originDir, string $targetDi
219219
try {
220220
$this->symlink($originDir, $targetDir);
221221
$method = self::METHOD_ABSOLUTE_SYMLINK;
222-
} catch (IOException $e) {
222+
} catch (IOException) {
223223
// fall back to copy
224224
$method = $this->hardCopy($originDir, $targetDir);
225225
}

Command/ConfigDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
195195
$config = $this->getConfig($this->findExtension($name), $this->compileContainer());
196196
$paths = array_keys(self::buildPathsCompletion($config));
197197
$suggestions->suggestValues($paths);
198-
} catch (LogicException $e) {
198+
} catch (LogicException) {
199199
}
200200
}
201201
}

Command/TranslationDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
153153
if ($this->defaultViewsPath) {
154154
$codePaths[] = $this->defaultViewsPath;
155155
}
156-
} catch (\InvalidArgumentException $e) {
156+
} catch (\InvalidArgumentException) {
157157
// such a bundle does not exist, so treat the argument as path
158158
$path = $input->getArgument('bundle');
159159

Command/TranslationUpdateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
186186
$codePaths[] = $this->defaultViewsPath;
187187
}
188188
$currentName = $foundBundle->getName();
189-
} catch (\InvalidArgumentException $e) {
189+
} catch (\InvalidArgumentException) {
190190
// such a bundle does not exist, so treat the argument as path
191191
$path = $input->getArgument('bundle');
192192

Console/Descriptor/Descriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public static function getClassDescription(string $class, string &$resolvedClass
299299

300300
return trim(preg_replace('#\s*\n\s*\*\s*#', ' ', $docComment));
301301
}
302-
} catch (\ReflectionException $e) {
302+
} catch (\ReflectionException) {
303303
}
304304

305305
return '';

Console/Descriptor/TextDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ private function formatControllerLink(mixed $controller, string $anchorText, cal
563563
} else {
564564
$r = new \ReflectionFunction($controller);
565565
}
566-
} catch (\ReflectionException $e) {
566+
} catch (\ReflectionException) {
567567
if (\is_array($controller)) {
568568
$controller = implode('::', $controller);
569569
}
@@ -582,7 +582,7 @@ private function formatControllerLink(mixed $controller, string $anchorText, cal
582582

583583
try {
584584
$r = new \ReflectionMethod($container->findDefinition($id)->getClass(), $method);
585-
} catch (\ReflectionException $e) {
585+
} catch (\ReflectionException) {
586586
return $anchorText;
587587
}
588588
}

0 commit comments

Comments
 (0)