From 9d4271f023e61d2b501bc5693d375b01dfa5fd0e Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Thu, 4 Aug 2016 14:43:33 -0400 Subject: [PATCH] Allow better handling of questionmark type annotations --- src/Psalm/Type.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index f08a8eebd..6f9ca9cbb 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -11,7 +11,7 @@ abstract class Type { /** * Parses a string type representation - * @param string $string + * @param string $type_string * @return Union */ public static function parseString($type_string) @@ -20,6 +20,8 @@ abstract class Type $type_string = self::convertSquareBrackets($type_string); } + $type_string = str_replace('?', 'null|', $type_string); + $type_tokens = self::tokenize($type_string); if (count($type_tokens) === 1) {