Skip to content

Commit

Permalink
fix closure impl
Browse files Browse the repository at this point in the history
  • Loading branch information
ptondereau committed Oct 25, 2023
1 parent a98129d commit f605c54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
4 changes: 0 additions & 4 deletions php

This file was deleted.

19 changes: 18 additions & 1 deletion src/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
flags::{DataType, MethodFlags},
props::Property,
types::Zval,
zend::ExecuteData,
zend::{ClassEntry, ExecuteData},
zend_fastcall,
};

Expand Down Expand Up @@ -152,13 +152,29 @@ impl Closure {
impl RegisteredClass for Closure {
const CLASS_NAME: &'static str = "RustClosure";

const BUILDER_MODIFIER: Option<fn(ClassBuilder) -> ClassBuilder> = None;
const EXTENDS: Option<fn() -> &'static ClassEntry> = None;
const IMPLEMENTS: &'static [fn() -> &'static ClassEntry] = &[];

fn get_metadata() -> &'static ClassMetadata<Self> {
&CLOSURE_META
}

fn get_properties<'a>() -> HashMap<&'static str, Property<'a, Self>> {
HashMap::new()
}

fn method_builders() -> Vec<(FunctionBuilder<'static>, MethodFlags)> {
unimplemented!()
}

fn constructor() -> Option<crate::class::ConstructorMeta<Self>> {
None
}

fn constants() -> &'static [(&'static str, &'static dyn crate::convert::IntoZvalDyn)] {
unimplemented!()
}
}

class_derives!(Closure);
Expand All @@ -171,6 +187,7 @@ class_derives!(Closure);
///
/// This trait is automatically implemented on functions with up to 8
/// parameters.
#[allow(clippy::missing_safety_doc)]
pub unsafe trait PhpClosure {
/// Invokes the closure.
fn invoke<'a>(&'a mut self, parser: ArgParser<'a, '_>, ret: &mut Zval);
Expand Down

0 comments on commit f605c54

Please sign in to comment.