Skip to content

Commit 9cf6410

Browse files
committed
Use multiple catch
1 parent f4cfa8c commit 9cf6410

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/main/php/lang/reflection/Method.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function invoke($instance, $args= [], $context= null) {
6363
try {
6464
$pass= PHP_VERSION_ID < 80000 && $args ? self::pass($this->reflect, $args) : $args;
6565
return $this->reflect->invokeArgs($instance, $pass);
66-
} catch (ReflectionException | ArgumentCountError | TypeError $e) {
66+
} catch (ReflectionException|ArgumentCountError|TypeError $e) {
6767
throw new CannotInvoke($this, $e);
6868
} catch (Throwable $e) {
6969

src/main/php/lang/reflection/Type.class.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,7 @@ public function newInstance(... $args) {
205205
} else {
206206
return $this->reflect->newInstance();
207207
}
208-
} catch (ArgumentCountError $e) {
209-
throw new CannotInstantiate($this, $e);
210-
} catch (TypeError $e) {
211-
throw new CannotInstantiate($this, $e);
212-
} catch (ReflectionException $e) {
208+
} catch (ReflectionException|ArgumentCountError|TypeError $e) {
213209
throw new CannotInstantiate($this, $e);
214210
} catch (Throwable $e) {
215211
if (0 === strpos($e->getMessage(), 'Unknown named parameter $')) {

0 commit comments

Comments
 (0)