File tree Expand file tree Collapse file tree 2 files changed +0
-20
lines changed Expand file tree Collapse file tree 2 files changed +0
-20
lines changed Original file line number Diff line number Diff line change 2020
2121// Must have arguments.. so catch ArgumentCountError errors!
2222assert_exception_thrown ('test_variadic_args ' );
23- // try {
24- // $args = test_variadic_args();
25- // } catch (ArgumentCountError $e) {
26- // var_dump($e->getMessage());
27- // }
2823
2924// Values directly passed
3025test_variadic_add_optional (1 , 2 , 3 ); // 1
Original file line number Diff line number Diff line change @@ -90,15 +90,11 @@ pub fn test_variadic_args(params: &[&Zval]) -> Vec<Zval> {
9090
9191#[ php_function( optional = "numbers" ) ]
9292pub fn test_variadic_add_optional ( number : u32 , numbers : & [ & Zval ] ) -> u32 {
93- println ! ( "Optional numbers: {:?}" , numbers) ;
94- // numbers is a slice of 4 Zvals all of type long
9593 number
9694}
9795
9896#[ php_function]
9997pub fn test_variadic_add_required ( numbers : & [ & Zval ] ) -> Vec < Zval > {
100- // numbers is a slice of 4 Zvals all of type long
101- // *numbers[0].as_number()
10298 numbers. iter ( ) . map ( |x| x. shallow_clone ( ) ) . collect ( )
10399}
104100
@@ -107,17 +103,6 @@ pub fn test_variadic_all_types(everything: &[&Zval]) -> Vec<Zval> {
107103 everything. iter ( ) . map ( |x| x. shallow_clone ( ) ) . collect ( )
108104}
109105
110- // Rust type &[&Zval] must be converted because to Vec<Zval> because
111- // of lifetime hell... #[php_function] does not support lifetime.
112- // error1: error[E0261]: use of undeclared lifetime name `'a`
113- // error2: lifetime `'a` is missing in item created through this procedural
114- // macro #[php_function]
115- // pub fn test_variadic_optional_args<'a>(params: &'a [&'a Zval]) -> &'a [&'a
116- // Zval] {
117- // println!("Params: {:#?}", params);
118- // params
119- // }
120-
121106#[ php_class]
122107pub struct TestClass {
123108 string : String ,
You can’t perform that action at this time.
0 commit comments