Skip to content

Commit 7c905f3

Browse files
committed
update comment and switch if logic to match other code
1 parent a289272 commit 7c905f3

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

phper/src/functions.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -647,22 +647,22 @@ impl ZFunc {
647647
}
648648
}
649649

650-
/// Get the type of the function (ZEND_USER_FUNCTION,
651-
/// ZEND_INTERNAL_FUNCTION, etc).
652-
pub fn get_type(&self) -> u8 {
653-
unsafe { self.inner.type_ }
650+
/// Get the type of the function (sys::ZEND_USER_FUNCTION,
651+
/// sys::ZEND_INTERNAL_FUNCTION, or sys::ZEND_EVAL_CODE).
652+
pub fn get_type(&self) -> u32 {
653+
unsafe { self.inner.type_ as u32 }
654654
}
655655

656656
/// For a user function or eval'd code, get the filename from op_array.
657657
pub fn get_filename(&self) -> Option<&ZStr> {
658658
unsafe {
659659
match u32::from(self.inner.type_) {
660660
ZEND_USER_FUNCTION | ZEND_EVAL_CODE => {
661-
let filename_ptr = self.inner.op_array.filename;
662-
if !filename_ptr.is_null() {
663-
ZStr::try_from_ptr(filename_ptr)
664-
} else {
661+
let ptr = self.inner.op_array.filename;
662+
if ptr.is_null() {
665663
None
664+
} else {
665+
ZStr::try_from_ptr(ptr)
666666
}
667667
}
668668
_ => None,

phper/src/values.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ impl ExecuteData {
138138
match u32::from((*self.inner.func).type_) {
139139
ZEND_USER_FUNCTION | ZEND_EVAL_CODE => {
140140
let opline = self.inner.opline;
141-
if !opline.is_null() {
142-
Some((*opline).lineno)
143-
} else {
141+
if opline.is_null() {
144142
None
143+
} else {
144+
Some((*opline).lineno)
145145
}
146146
}
147147
_ => None,

0 commit comments

Comments
 (0)