From d56dd6bed67398c46cc844b7e682970f2033a692 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Thu, 14 Jun 2018 13:49:16 -0400 Subject: [PATCH] Fix #818 - prevent class of 0 --- src/Psalm/Type.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index ba4ffb416..35eb47530 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -649,10 +649,14 @@ abstract class Type */ public static function getFQCLNFromString($class, Aliases $aliases) { - if (empty($class)) { + if ($class === '') { throw new \InvalidArgumentException('$class cannot be empty'); } + if ($class === '0') { + throw new TypeParseTreeException('Unrecognised class 0'); + } + if ($class[0] === '\\') { return substr($class, 1); }