Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support marking classes as interfaces #155

Merged
merged 2 commits into from
Sep 30, 2022

Conversation

joehoyle
Copy link
Collaborator

This allows passing flags as part of #[php_class(flags=Interface] etc, which allows one to mark a class as being an interface.

When a class is an interface, it also shouldn't get a constructor created for it.

@striezel
Copy link
Contributor

@joehoyle: There are some problems with rustfmt:

 /home/runner/.cargo/bin/cargo fmt --all -- --check
Diff in /home/runner/work/ext-php-rs/ext-php-rs/crates/macros/src/class.rs at line 22:
     /// A function name called when creating the class entry. Given an instance
     /// of `ClassBuilder` and must return it.
     pub modifier: Option<String>,
-    pub flags: Option<String>
+    pub flags: Option<String>,
 }
 
 #[derive(Debug)]
Diff in /home/runner/work/ext-php-rs/ext-php-rs/crates/macros/src/class.rs at line 119:
     let ItemStruct { ident, .. } = &input;
     let class_name = args.name.unwrap_or_else(|| ident.to_string());
     let struct_path = ident.to_string();
-    let flags = args.flags.map(|flags|flags.to_token_stream().to_string());
+    let flags = args.flags.map(|flags| flags.to_token_stream().to_string());
     let class = Class {
         class_name,
         struct_path,
Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 1

Could you fix them, please?
It might also be advisable to rebase your changes on top of the current master branch to make the checks pass.

This allows passing flags as part of `#[php_class(flags=Interface]` etc, which allows one to mark a class as being an interface.

When a class is an interface, it also shouldn't get a constructor created for it.
@joehoyle joehoyle force-pushed the support-interface-flag branch from 7a9a197 to 7efb942 Compare September 30, 2022 10:05
@davidcole1340 davidcole1340 merged commit 5d1fda4 into davidcole1340:master Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants