Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: format
  • Loading branch information
ryangjchandler committed Sep 12, 2022
commit 04d9c3be558d538df065c9d876df91648d4f8b08
38 changes: 23 additions & 15 deletions trunk_parser/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2870,20 +2870,24 @@ mod tests {
);

assert_ast(
"<?php function foo(string|int|float $b) {}", &[
Statement::Function {
name: "foo".to_string().into(),
params: vec![Param {
name: Expression::Variable { name: "b".into() },
r#type: Some(Type::Union(vec!["string".into(), "int".into(), "float".into()])),
variadic: false,
default: None,
flag: None,
}],
body: vec![],
return_type: None,
}
]);
"<?php function foo(string|int|float $b) {}",
&[Statement::Function {
name: "foo".to_string().into(),
params: vec![Param {
name: Expression::Variable { name: "b".into() },
r#type: Some(Type::Union(vec![
"string".into(),
"int".into(),
"float".into(),
])),
variadic: false,
default: None,
flag: None,
}],
body: vec![],
return_type: None,
}],
);
}

#[test]
Expand All @@ -2910,7 +2914,11 @@ mod tests {
name: "foo".to_string().into(),
params: vec![Param {
name: Expression::Variable { name: "b".into() },
r#type: Some(Type::Intersection(vec!["Foo".into(), "Bar".into(), "Baz".into()])),
r#type: Some(Type::Intersection(vec![
"Foo".into(),
"Bar".into(),
"Baz".into(),
])),
variadic: false,
default: None,
flag: None,
Expand Down