Skip to content

Commit 163bb4e

Browse files
committed
Leverage non-capturing catches
1 parent 8de9f30 commit 163bb4e

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

Caster/ArgsStub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private static function getParameters(string $function, ?string $class): array
5757

5858
try {
5959
$r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function);
60-
} catch (\ReflectionException $e) {
60+
} catch (\ReflectionException) {
6161
return [null, null];
6262
}
6363

Caster/Caster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function castObject(object $obj, string $class, bool $hasDebugInfo
4747
if ($hasDebugInfo) {
4848
try {
4949
$debugInfo = $obj->__debugInfo();
50-
} catch (\Exception $e) {
50+
} catch (\Exception) {
5151
// ignore failing __debugInfo()
5252
$hasDebugInfo = false;
5353
}

Caster/ClassStub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(string $identifier, callable|array|string $callable
5050
if (\is_array($r)) {
5151
try {
5252
$r = new \ReflectionMethod($r[0], $r[1]);
53-
} catch (\ReflectionException $e) {
53+
} catch (\ReflectionException) {
5454
$r = new \ReflectionClass($r[0]);
5555
}
5656
}
@@ -71,7 +71,7 @@ public function __construct(string $identifier, callable|array|string $callable
7171
$this->value .= $s;
7272
}
7373
}
74-
} catch (\ReflectionException $e) {
74+
} catch (\ReflectionException) {
7575
return;
7676
} finally {
7777
if (0 < $i = strrpos($this->value, '\\')) {

Caster/ExceptionCaster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ private static function extractSource(string $srcLines, int $line, int $srcConte
337337
$stub->attr['file'] = $f;
338338
$stub->attr['line'] = $caller->getStartLine();
339339
}
340-
} catch (\ReflectionException $e) {
340+
} catch (\ReflectionException) {
341341
// ignore fake class/function
342342
}
343343

Caster/PdoCaster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested)
7676
if ($v && isset($v[$attr[$k]])) {
7777
$attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]);
7878
}
79-
} catch (\Exception $e) {
79+
} catch (\Exception) {
8080
}
8181
}
8282
if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {

Caster/RdKafkaCaster.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub,
3737

3838
try {
3939
$assignment = $c->getAssignment();
40-
} catch (RdKafkaException $e) {
40+
} catch (RdKafkaException) {
4141
$assignment = [];
4242
}
4343

@@ -172,7 +172,7 @@ private static function extractMetadata(KafkaConsumer|\RdKafka $c)
172172

173173
try {
174174
$m = $c->getMetadata(true, null, 500);
175-
} catch (RdKafkaException $e) {
175+
} catch (RdKafkaException) {
176176
return [];
177177
}
178178

Caster/ReflectionCaster.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $
8383
// Cannot create ReflectionGenerator based on a terminated Generator
8484
try {
8585
$reflectionGenerator = new \ReflectionGenerator($c);
86-
} catch (\Exception $e) {
86+
} catch (\Exception) {
8787
$a[Caster::PREFIX_VIRTUAL.'closed'] = true;
8888

8989
return $a;
@@ -298,7 +298,7 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st
298298
if (null === $v) {
299299
unset($a[$prefix.'allowsNull']);
300300
}
301-
} catch (\ReflectionException $e) {
301+
} catch (\ReflectionException) {
302302
}
303303
}
304304

Caster/SplCaster.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool
117117
foreach ($map as $key => $accessor) {
118118
try {
119119
$a[$prefix.$key] = $c->$accessor();
120-
} catch (\Exception $e) {
120+
} catch (\Exception) {
121121
}
122122
}
123123

@@ -155,7 +155,7 @@ public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, b
155155
foreach ($map as $key => $accessor) {
156156
try {
157157
$a[$prefix.$key] = $c->$accessor();
158-
} catch (\Exception $e) {
158+
} catch (\Exception) {
159159
}
160160
}
161161

Caster/XmlReaderCaster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, b
5151
'VALIDATE' => @$reader->getParserProperty(\XMLReader::VALIDATE),
5252
'SUBST_ENTITIES' => @$reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
5353
];
54-
} catch (\Error $e) {
54+
} catch (\Error) {
5555
$properties = [
5656
'LOADDTD' => false,
5757
'DEFAULTATTRS' => false,

0 commit comments

Comments
 (0)