@@ -8,7 +8,8 @@ use crate::{
8
8
ffi:: zend_throw_exception_ex,
9
9
ffi:: zend_throw_exception_object,
10
10
flags:: ClassFlags ,
11
- zend:: { ce, ClassEntry } , types:: Zval ,
11
+ types:: Zval ,
12
+ zend:: { ce, ClassEntry } ,
12
13
} ;
13
14
14
15
/// Result type with the error variant as a [`PhpException`].
@@ -38,7 +39,12 @@ impl PhpException {
38
39
/// * `code` - Integer code to go inside the exception.
39
40
/// * `ex` - Exception type to throw.
40
41
pub fn new ( message : String , code : i32 , ex : & ' static ClassEntry ) -> Self {
41
- Self { message, code, ex, object : None , }
42
+ Self {
43
+ message,
44
+ code,
45
+ ex,
46
+ object : None ,
47
+ }
42
48
}
43
49
44
50
/// Creates a new default exception instance, using the default PHP
@@ -77,9 +83,7 @@ impl PhpException {
77
83
/// and an error otherwise.
78
84
pub fn throw ( self ) -> Result < ( ) > {
79
85
match self . object {
80
- Some ( object) => {
81
- throw_object ( object)
82
- } ,
86
+ Some ( object) => throw_object ( object) ,
83
87
None => throw_with_code ( self . ex , self . code , & self . message ) ,
84
88
}
85
89
}
@@ -166,7 +170,6 @@ pub fn throw_with_code(ex: &ClassEntry, code: i32, message: &str) -> Result<()>
166
170
Ok ( ( ) )
167
171
}
168
172
169
-
170
173
/// Throws an exception object.
171
174
///
172
175
/// Returns a result containing nothing if the exception was successfully
0 commit comments