We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 308f3c5 commit 512ca9fCopy full SHA for 512ca9f
src/closure.rs
@@ -115,11 +115,16 @@ impl Closure {
115
/// function should only be called once inside your module startup
116
/// function.
117
///
118
+ /// If the class has already been built, this function returns early without
119
+ /// doing anything. This allows for safe repeated calls in test environments.
120
+ ///
121
/// # Panics
122
- /// Panics if the function is called more than once.
123
+ /// Panics if the `RustClosure` PHP class cannot be registered.
124
pub fn build() {
- assert!(!CLOSURE_META.has_ce(), "Closure class already built.");
125
+ if CLOSURE_META.has_ce() {
126
+ return;
127
+ }
128
129
ClassBuilder::new("RustClosure")
130
.method(
0 commit comments