Skip to content

Commit 590fd36

Browse files
committed
fixed some exception types
1 parent 3e5776f commit 590fd36

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/PHPTypes/Type.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Type {
5050
public function __construct($type, array $subTypes = [], $userType = null) {
5151
foreach ($subTypes as $sub) {
5252
if (!$sub instanceof Type) {
53-
throw new \RuntimeException("Subtypes must implement Type");
53+
throw new \LogicException("Subtypes must implement Type");
5454
}
5555
}
5656
if ($type === self::TYPE_OBJECT) {
@@ -111,7 +111,7 @@ public function __toString() {
111111
return implode('&', $subTypeStrings);
112112
}
113113

114-
throw new \RuntimeException("Assertion failure: unknown type {$this->type}");
114+
throw new \LogicException("Assertion failure: unknown type {$this->type}");
115115
}
116116

117117
public function hasSubtypes() {
@@ -444,7 +444,7 @@ public static function parseDecl($decl) {
444444
if ($decl instanceof Type) {
445445
return $decl;
446446
} elseif (!is_string($decl)) {
447-
throw new \LogicException("Should never happen");
447+
throw new \RuntimeException("Decl is not a string");
448448
} elseif (empty($decl)) {
449449
throw new \RuntimeException("Empty declaration found");
450450
}

lib/PHPTypes/TypeReconstructor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function resolveVar(Operand $var, SplObjectStorage $resolved) {
8484
} else {
8585
return false;
8686
}
87-
} catch (\Exception $e) {
87+
} catch (\LogicException $e) {
8888
throw new \LogicException(sprintf('Exception raised while handling op %s@%s:%d', $prev->getType(), $prev->getFile(), $prev->getLine()), 0, $e);
8989
}
9090
}

0 commit comments

Comments
 (0)