File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ pub fn build_arg_parser<'a>(
188188 None
189189 } ) ;
190190
191- if rest_optional && !arg. nullable && arg. default . is_none ( ) {
191+ if rest_optional && !arg. nullable && arg. default . is_none ( ) && !arg . variadic {
192192 bail ! (
193193 "Parameter `{}` must be a variant of `Option` or have a default value as it is optional." ,
194194 arg. name
Original file line number Diff line number Diff line change @@ -718,3 +718,18 @@ impl<'a> FromZvalMut<'a> for &'a mut Zval {
718718 Some ( zval)
719719 }
720720}
721+
722+ impl < ' a > FromZvalMut < ' a > for & ' a [ & ' a Zval ] {
723+ const TYPE : DataType = DataType :: Array ;
724+
725+ fn from_zval_mut ( zval : & ' a mut Zval ) -> Option < Self > {
726+ // Check if the input Zval is an array and convert it into a slice of references
727+ if let Some ( a) = zval. array ( ) {
728+ // Collect references to each element in the array
729+ let slice: Vec < & ' a Zval > = a. values ( ) . collect ( ) ;
730+ Some ( Box :: leak ( slice. into_boxed_slice ( ) ) )
731+ } else {
732+ None
733+ }
734+ }
735+ }
You can’t perform that action at this time.
0 commit comments