Skip to content

Commit 2abe85f

Browse files
author
Aleksandr Startsev
committed
refactor: Change parser function
1 parent 8b51437 commit 2abe85f

File tree

8 files changed

+227
-209
lines changed

8 files changed

+227
-209
lines changed

crates/macros/src/impl_.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ pub struct Constant<'a> {
160160
pub docs: Vec<String>,
161161
}
162162

163-
impl<'a> Constant<'a> {
164-
pub fn new(name: String, ident: &'a syn::Ident, docs: Vec<String>) -> Self {
165-
Self { name, ident, docs }
166-
}
167-
}
168-
169163
impl<'a> ParsedImpl<'a> {
170164
/// Create a new, empty parsed impl block.
171165
///

crates/macros/src/interface.rs

Lines changed: 219 additions & 191 deletions
Large diffs are not rendered by default.

src/builders/interface.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use crate::builders::FunctionBuilder;
2-
use crate::flags::{ClassFlags, MethodFlags};
3-
use crate::{builders::ClassBuilder, class::ClassEntryInfo, convert::IntoZvalDyn, describe::DocComments};
42
use crate::error::Result;
3+
use crate::flags::{ClassFlags, MethodFlags};
4+
use crate::{
5+
builders::ClassBuilder, class::ClassEntryInfo, convert::IntoZvalDyn, describe::DocComments,
6+
};
57

68
pub struct InterfaceBuilder {
79
class_builder: ClassBuilder,
@@ -42,4 +44,3 @@ impl InterfaceBuilder {
4244
self.class_builder
4345
}
4446
}
45-

src/builders/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ mod class;
55
#[cfg(feature = "enum")]
66
mod enum_builder;
77
mod function;
8-
mod interface;
98
#[cfg(all(php82, feature = "embed"))]
109
mod ini;
10+
mod interface;
1111
mod module;
1212
#[cfg(feature = "embed")]
1313
mod sapi;

src/builders/module.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use std::{convert::TryFrom, ffi::CString, mem, ptr};
22

33
use super::{ClassBuilder, FunctionBuilder};
4+
#[cfg(feature = "enum")]
5+
use crate::{builders::enum_builder::EnumBuilder, enum_::RegisteredEnum};
46
use crate::{
57
builders::interface::InterfaceBuilder,
68
class::RegisteredClass,
@@ -11,8 +13,6 @@ use crate::{
1113
zend::{FunctionEntry, ModuleEntry},
1214
PHP_DEBUG, PHP_ZTS,
1315
};
14-
#[cfg(feature = "enum")]
15-
use crate::{builders::enum_builder::EnumBuilder, enum_::RegisteredEnum};
1616

1717
/// Builds a Zend module extension to be registered with PHP. Must be called
1818
/// from within an external function called `get_module`, returning a mutable

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub mod flags;
2121
pub mod macros;
2222
pub mod boxed;
2323
pub mod class;
24-
pub mod interface;
2524
#[cfg(any(docs, feature = "closure"))]
2625
#[cfg_attr(docs, doc(cfg(feature = "closure")))]
2726
pub mod closure;
@@ -31,6 +30,7 @@ pub mod describe;
3130
pub mod embed;
3231
#[cfg(feature = "enum")]
3332
pub mod enum_;
33+
pub mod interface;
3434
#[doc(hidden)]
3535
pub mod internal;
3636
pub mod props;

tests/src/integration/interface/interface.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,4 @@ public function refToLikeThisClass(
2929

3030
assert(is_a($f, Throwable::class));
3131
assert($f->nonStatic('Rust') === 'Rust - TEST');
32-
assert(ExtPhpRs\Interface\EmptyObjectInterface::HELLO === "HELLO");
33-
assert($f::HELLO === "HELLO");
34-
assert(Test::HELLO === "HELLO");
3532
assert($f->refToLikeThisClass('TEST', $f) === 'TEST - TEST | TEST - TEST');

tests/src/integration/interface/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ use ext_php_rs::{php_module, prelude::ModuleBuilder};
99
#[php(extends(ce = ce::throwable, stub = "\\Throwable"))]
1010
#[php(name = "ExtPhpRs\\Interface\\EmptyObjectInterface")]
1111
pub trait EmptyObjectTrait {
12-
const HELLO: &'static str = "HELLO";
13-
1412
fn void();
1513

1614
fn non_static(&self, data: String) -> String;

0 commit comments

Comments
 (0)