mirror of
https://github.com/danog/parser.git
synced 2025-01-22 04:51:13 +01:00
parser: support nullable types
This commit is contained in:
parent
8e1b13f715
commit
13d0aa21cd
@ -2,4 +2,8 @@
|
||||
|
||||
function foo(string $bar) {
|
||||
|
||||
}
|
||||
|
||||
function bar(?string $baz) {
|
||||
|
||||
}
|
@ -48,6 +48,11 @@ impl Parser {
|
||||
self.next();
|
||||
return Ok(t);
|
||||
},
|
||||
TokenKind::Question => {
|
||||
self.next();
|
||||
let t = self.type_string()?;
|
||||
return Ok(Type::Nullable(Box::new(t)));
|
||||
},
|
||||
_ => todo!()
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user