• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

extphprs / ext-php-rs / 25379163335

05 May 2026 01:25PM UTC coverage: 72.479% (+6.2%) from 66.241%
25379163335

Pull #734

github

web-flow
Merge 889e3cde4 into 0912e7c24
Pull Request #734: feat!: PHP 8 union, intersection, DNF, and class-union type hints

2871 of 3074 new or added lines in 21 files covered. (93.4%)

3 existing lines in 2 files now uncovered.

11514 of 15886 relevant lines covered (72.48%)

33.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.96
/src/flags.rs
1
//! Flags and enums used in PHP and the Zend engine.
2

3
use bitflags::bitflags;
4

5
#[cfg(php81)]
6
use crate::ffi::ZEND_ACC_ENUM;
7
#[cfg(not(php82))]
8
use crate::ffi::ZEND_ACC_REUSE_GET_ITERATOR;
9
use crate::ffi::{
10
    _IS_BOOL, CONST_CS, CONST_DEPRECATED, CONST_NO_FILE_CACHE, CONST_PERSISTENT, E_COMPILE_ERROR,
11
    E_COMPILE_WARNING, E_CORE_ERROR, E_CORE_WARNING, E_DEPRECATED, E_ERROR, E_NOTICE, E_PARSE,
12
    E_RECOVERABLE_ERROR, E_STRICT, E_USER_DEPRECATED, E_USER_ERROR, E_USER_NOTICE, E_USER_WARNING,
13
    E_WARNING, GC_IMMUTABLE, IS_ARRAY, IS_CALLABLE, IS_CONSTANT_AST, IS_DOUBLE, IS_FALSE,
14
    IS_INDIRECT, IS_ITERABLE, IS_LONG, IS_MIXED, IS_NULL, IS_OBJECT, IS_PTR, IS_REFERENCE,
15
    IS_RESOURCE, IS_STRING, IS_TRUE, IS_TYPE_COLLECTABLE, IS_TYPE_REFCOUNTED, IS_UNDEF, IS_VOID,
16
    PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER, Z_TYPE_FLAGS_SHIFT,
17
    ZEND_ACC_ABSTRACT, ZEND_ACC_ANON_CLASS, ZEND_ACC_CALL_VIA_TRAMPOLINE, ZEND_ACC_CHANGED,
18
    ZEND_ACC_CLOSURE, ZEND_ACC_CONSTANTS_UPDATED, ZEND_ACC_CTOR, ZEND_ACC_DEPRECATED,
19
    ZEND_ACC_DONE_PASS_TWO, ZEND_ACC_EARLY_BINDING, ZEND_ACC_FAKE_CLOSURE, ZEND_ACC_FINAL,
20
    ZEND_ACC_GENERATOR, ZEND_ACC_HAS_FINALLY_BLOCK, ZEND_ACC_HAS_RETURN_TYPE,
21
    ZEND_ACC_HAS_TYPE_HINTS, ZEND_ACC_HEAP_RT_CACHE, ZEND_ACC_IMMUTABLE,
22
    ZEND_ACC_IMPLICIT_ABSTRACT_CLASS, ZEND_ACC_INTERFACE, ZEND_ACC_LINKED, ZEND_ACC_NEARLY_LINKED,
23
    ZEND_ACC_NEVER_CACHE, ZEND_ACC_NO_DYNAMIC_PROPERTIES, ZEND_ACC_PRELOADED, ZEND_ACC_PRIVATE,
24
    ZEND_ACC_PROMOTED, ZEND_ACC_PROTECTED, ZEND_ACC_PUBLIC, ZEND_ACC_RESOLVED_INTERFACES,
25
    ZEND_ACC_RESOLVED_PARENT, ZEND_ACC_RETURN_REFERENCE, ZEND_ACC_STATIC, ZEND_ACC_STRICT_TYPES,
26
    ZEND_ACC_TOP_LEVEL, ZEND_ACC_TRAIT, ZEND_ACC_TRAIT_CLONE, ZEND_ACC_UNRESOLVED_VARIANCE,
27
    ZEND_ACC_USE_GUARDS, ZEND_ACC_USES_THIS, ZEND_ACC_VARIADIC, ZEND_EVAL_CODE,
28
    ZEND_HAS_STATIC_IN_METHODS, ZEND_INTERNAL_FUNCTION, ZEND_USER_FUNCTION,
29
};
30

31
use crate::error::{Error, Result};
32

33
bitflags! {
34
    /// Flags used for setting the type of Zval.
35
    #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
36
    pub struct ZvalTypeFlags: u32 {
37
        /// Undefined
38
        const Undef = IS_UNDEF;
39
        /// Null
40
        const Null = IS_NULL;
41
        /// `false`
42
        const False = IS_FALSE;
43
        /// `true`
44
        const True = IS_TRUE;
45
        /// Integer
46
        const Long = IS_LONG;
47
        /// Floating point number
48
        const Double = IS_DOUBLE;
49
        /// String
50
        const String = IS_STRING;
51
        /// Array
52
        const Array = IS_ARRAY;
53
        /// Object
54
        const Object = IS_OBJECT;
55
        /// Resource
56
        const Resource = IS_RESOURCE;
57
        /// Reference
58
        const Reference = IS_REFERENCE;
59
        /// Callable
60
        const Callable = IS_CALLABLE;
61
        /// Constant expression
62
        const ConstantExpression = IS_CONSTANT_AST;
63
        /// Void
64
        const Void = IS_VOID;
65
        /// Pointer
66
        const Ptr = IS_PTR;
67
        /// Iterable
68
        const Iterable = IS_ITERABLE;
69

70
        /// Interned string extended
71
        const InternedStringEx = Self::String.bits();
72
        /// String extended
73
        const StringEx = Self::String.bits() | Self::RefCounted.bits();
74
        /// Array extended
75
        const ArrayEx = Self::Array.bits() | Self::RefCounted.bits() | Self::Collectable.bits();
76
        /// Object extended
77
        const ObjectEx = Self::Object.bits() | Self::RefCounted.bits() | Self::Collectable.bits();
78
        /// Resource extended
79
        const ResourceEx = Self::Resource.bits() | Self::RefCounted.bits();
80
        /// Reference extended
81
        const ReferenceEx = Self::Reference.bits() | Self::RefCounted.bits();
82
        /// Constant ast extended
83
        const ConstantAstEx = Self::ConstantExpression.bits() | Self::RefCounted.bits();
84

85
        /// Reference counted
86
        const RefCounted = (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT);
87
        /// Collectable
88
        const Collectable = (IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT);
89

90
        /// Immutable (used for the shared empty array)
91
        const Immutable = GC_IMMUTABLE;
92
    }
93
}
94

95
bitflags! {
96
    /// Flags for building classes.
97
    #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
98
    pub struct ClassFlags: u32 {
99
        /// Final class or method
100
        const Final = ZEND_ACC_FINAL;
101
        /// Abstract method
102
        const Abstract = ZEND_ACC_ABSTRACT;
103
        /// Immutable `op_array` and class_entries
104
        /// (implemented only for lazy loading of `op_array`s)
105
        const Immutable = ZEND_ACC_IMMUTABLE;
106
        /// Function has typed arguments / class has typed props
107
        const HasTypeHints = ZEND_ACC_HAS_TYPE_HINTS;
108
        /// Top-level class or function declaration
109
        const TopLevel = ZEND_ACC_TOP_LEVEL;
110
        /// op_array or class is preloaded
111
        const Preloaded = ZEND_ACC_PRELOADED;
112

113
        /// Class entry is an interface
114
        const Interface = ZEND_ACC_INTERFACE;
115
        /// Class entry is a trait
116
        const Trait = ZEND_ACC_TRAIT;
117
        /// Anonymous class
118
        const AnonymousClass = ZEND_ACC_ANON_CLASS;
119
        /// Class is an Enum
120
        #[cfg(php81)]
121
        const Enum = ZEND_ACC_ENUM;
122
        /// Class linked with parent, interfaces and traits
123
        const Linked = ZEND_ACC_LINKED;
124
        /// Class is abstract, since it is set by any abstract method
125
        const ImplicitAbstractClass = ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
126
        /// Class has magic methods `__get`/`__set`/`__unset`/`__isset` that use guards
127
        const UseGuards = ZEND_ACC_USE_GUARDS;
128

129
        /// Class constants updated
130
        const ConstantsUpdated = ZEND_ACC_CONSTANTS_UPDATED;
131
        /// Objects of this class may not have dynamic properties
132
        const NoDynamicProperties = ZEND_ACC_NO_DYNAMIC_PROPERTIES;
133
        /// User class has methods with static variables
134
        const HasStaticInMethods = ZEND_HAS_STATIC_IN_METHODS;
135
        /// Children must reuse parent `get_iterator()`
136
        #[cfg(not(php82))]
137
        const ReuseGetIterator = ZEND_ACC_REUSE_GET_ITERATOR;
138
        /// Parent class is resolved (CE)
139
        const ResolvedParent = ZEND_ACC_RESOLVED_PARENT;
140
        /// Interfaces are resolved (CE)
141
        const ResolvedInterfaces = ZEND_ACC_RESOLVED_INTERFACES;
142
        /// Class has unresolved variance obligations
143
        const UnresolvedVariance = ZEND_ACC_UNRESOLVED_VARIANCE;
144
        /// Class is linked apart from variance obligations
145
        const NearlyLinked = ZEND_ACC_NEARLY_LINKED;
146

147
        /// Class cannot be serialized or unserialized
148
        #[cfg(php81)]
149
        const NotSerializable = crate::ffi::ZEND_ACC_NOT_SERIALIZABLE;
150

151
        /// Readonly class (PHP 8.2+)
152
        /// All properties are implicitly readonly
153
        #[cfg(php82)]
154
        const ReadonlyClass = crate::ffi::ZEND_ACC_READONLY_CLASS;
155
    }
156
}
157

158
bitflags! {
159
    /// Flags for building methods.
160
    #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
161
    pub struct MethodFlags: u32 {
162
        /// Visibility public
163
        const Public = ZEND_ACC_PUBLIC;
164
        /// Visibility protected
165
        const Protected = ZEND_ACC_PROTECTED;
166
        /// Visibility private
167
        const Private = ZEND_ACC_PRIVATE;
168
        /// Method or property overrides private one
169
        const Changed = ZEND_ACC_CHANGED;
170
        /// Static method
171
        const Static = ZEND_ACC_STATIC;
172
        /// Final method
173
        const Final = ZEND_ACC_FINAL;
174
        /// Abstract method
175
        const Abstract = ZEND_ACC_ABSTRACT;
176
        /// Immutable `op_array` and class_entries
177
        /// (implemented only for lazy loading of op_arrays)
178
        const Immutable = ZEND_ACC_IMMUTABLE;
179
        /// Function has typed arguments / class has typed props
180
        const HasTypeHints = ZEND_ACC_HAS_TYPE_HINTS;
181
        /// Top-level class or function declaration
182
        const TopLevel = ZEND_ACC_TOP_LEVEL;
183
        /// `op_array` or class is preloaded
184
        const Preloaded = ZEND_ACC_PRELOADED;
185

186
        /// Deprecation flag
187
        const Deprecated = ZEND_ACC_DEPRECATED;
188
        /// Function returning by reference
189
        const ReturnReference = ZEND_ACC_RETURN_REFERENCE;
190
        /// Function has a return type
191
        const HasReturnType = ZEND_ACC_HAS_RETURN_TYPE;
192
        /// Function with variable number of arguments
193
        const Variadic = ZEND_ACC_VARIADIC;
194
        /// `op_array` has finally blocks (user only)
195
        const HasFinallyBlock = ZEND_ACC_HAS_FINALLY_BLOCK;
196
        /// "main" `op_array` with `ZEND_DECLARE_CLASS_DELAYED` opcodes
197
        const EarlyBinding = ZEND_ACC_EARLY_BINDING;
198
        /// Closure uses `$this`
199
        const UsesThis = ZEND_ACC_USES_THIS;
200
        /// Call through user function trampoline
201
        ///
202
        /// # Example
203
        /// - `__call`
204
        /// - `__callStatic`
205
        const CallViaTrampoline = ZEND_ACC_CALL_VIA_TRAMPOLINE;
206
        /// Disable inline caching
207
        const NeverCache = ZEND_ACC_NEVER_CACHE;
208
        /// `op_array` is a clone of trait method
209
        const TraitClone = ZEND_ACC_TRAIT_CLONE;
210
        /// Function is a constructor
211
        const IsConstructor = ZEND_ACC_CTOR;
212
        /// Function is a closure
213
        const Closure = ZEND_ACC_CLOSURE;
214
        /// Function is a fake closure
215
        const FakeClosure = ZEND_ACC_FAKE_CLOSURE;
216
        /// Function is a generator
217
        const Generator = ZEND_ACC_GENERATOR;
218
        /// Function was processed by pass two (user only)
219
        const DonePassTwo = ZEND_ACC_DONE_PASS_TWO;
220
        /// `run_time_cache` allocated on heap (user only)
221
        const HeapRTCache = ZEND_ACC_HEAP_RT_CACHE;
222
        /// `op_array` uses strict mode types
223
        const StrictTypes = ZEND_ACC_STRICT_TYPES;
224
    }
225
}
226

227
bitflags! {
228
    /// Flags for building properties.
229
    #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
230
    pub struct PropertyFlags: u32 {
231
        /// Visibility public
232
        const Public = ZEND_ACC_PUBLIC;
233
        /// Visibility protected
234
        const Protected = ZEND_ACC_PROTECTED;
235
        /// Visibility private
236
        const Private = ZEND_ACC_PRIVATE;
237
        /// Property or method overrides private one
238
        const Changed = ZEND_ACC_CHANGED;
239
        /// Static property
240
        const Static = ZEND_ACC_STATIC;
241
        /// Promoted property
242
        const Promoted = ZEND_ACC_PROMOTED;
243
    }
244
}
245

246
bitflags! {
247
    /// Flags for building constants.
248
    #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
249
    pub struct ConstantFlags: u32 {
250
        /// Visibility public
251
        const Public = ZEND_ACC_PUBLIC;
252
        /// Visibility protected
253
        const Protected = ZEND_ACC_PROTECTED;
254
        /// Visibility private
255
        const Private = ZEND_ACC_PRIVATE;
256
        /// Promoted constant
257
        const Promoted = ZEND_ACC_PROMOTED;
258
    }
259
}
260

261
bitflags! {
262
    /// Flags for building module global constants.
263
    #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
264
    pub struct GlobalConstantFlags: u32 {
265
        /// No longer used -- always case-sensitive
266
        #[deprecated(note = "No longer used -- always case-sensitive")]
267
        const CaseSensitive = CONST_CS;
268
        /// Persistent
269
        const Persistent = CONST_PERSISTENT;
270
        /// Can't be saved in file cache
271
        const NoFileCache = CONST_NO_FILE_CACHE;
272
        /// Deprecated (this flag is not deprecated, it literally means the constant is deprecated)
273
        const Deprecated = CONST_DEPRECATED;
274
    }
275
}
276

277
bitflags! {
278
    /// Represents the result of a function.
279
    #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
280
    pub struct ZendResult: i32 {
281
        /// Function call was successful.
282
        const Success = 0;
283
        /// Function call failed.
284
        const Failure = -1;
285
    }
286
}
287

288
bitflags! {
289
    /// Represents permissions for where a configuration setting may be set.
290
    pub struct IniEntryPermission: u32 {
291
        /// User
292
        const User = PHP_INI_USER;
293
        /// Per directory
294
        const PerDir = PHP_INI_PERDIR;
295
        /// System
296
        const System = PHP_INI_SYSTEM;
297
        /// All
298
        const All = PHP_INI_ALL;
299
    }
300
}
301

302
bitflags! {
303
    /// Represents error types when used via php_error_docref for example.
304
    pub struct ErrorType: u32 {
305
        /// Error
306
        const Error = E_ERROR;
307
        /// Warning
308
        const Warning = E_WARNING;
309
        /// Parse
310
        const Parse = E_PARSE;
311
        /// Notice
312
        const Notice = E_NOTICE;
313
        /// Core error
314
        const CoreError = E_CORE_ERROR;
315
        /// Core warning
316
        const CoreWarning = E_CORE_WARNING;
317
        /// Compile error
318
        const CompileError = E_COMPILE_ERROR;
319
        /// Compile warning
320
        const CompileWarning = E_COMPILE_WARNING;
321
        /// User error
322
        #[cfg_attr(php84, deprecated = "`E_USER_ERROR` is deprecated since PHP 8.4. Throw an exception instead.")]
323
        const UserError = E_USER_ERROR;
324
        /// User warning
325
        const UserWarning = E_USER_WARNING;
326
        /// User notice
327
        const UserNotice = E_USER_NOTICE;
328
        /// Strict
329
        const Strict = E_STRICT;
330
        /// Recoverable error
331
        const RecoverableError = E_RECOVERABLE_ERROR;
332
        /// Deprecated
333
        const Deprecated = E_DEPRECATED;
334
        /// User deprecated
335
        const UserDeprecated = E_USER_DEPRECATED;
336
    }
337
}
338

339
/// Represents the type of a function.
340
#[derive(PartialEq, Eq, Hash, Debug, Clone, Copy)]
341
pub enum FunctionType {
342
    /// Internal function
343
    Internal,
344
    /// User function
345
    User,
346
    /// Eval code
347
    Eval,
348
}
349

350
impl From<u8> for FunctionType {
351
    #[allow(clippy::bad_bit_mask)]
352
    fn from(value: u8) -> Self {
×
353
        match value.into() {
×
354
            ZEND_INTERNAL_FUNCTION => Self::Internal,
×
355
            ZEND_USER_FUNCTION => Self::User,
×
356
            ZEND_EVAL_CODE => Self::Eval,
×
357
            _ => panic!("Unknown function type: {value}"),
×
358
        }
359
    }
×
360
}
361

362
pub use ext_php_rs_types::DataType;
363

364
/// Returns the raw zval type-tag for `dt`.
365
///
366
/// Wraps the `IS_*` constants from `Zend/zend_types.h` so the rest of the
367
/// crate calls a typed helper instead of poking at FFI integers. Lives as a
368
/// free function in `crate::flags` rather than an inherent method on
369
/// [`DataType`] because [`DataType`] now lives in the
370
/// [`ext-php-rs-types`](https://crates.io/crates/ext-php-rs-types) workspace
371
/// member, where the FFI constants are not in scope.
372
#[must_use]
373
pub const fn data_type_as_u32(dt: &DataType) -> u32 {
694✔
374
    match dt {
694✔
NEW
375
        DataType::Undef => IS_UNDEF,
×
376
        DataType::Null => IS_NULL,
454✔
NEW
377
        DataType::False => IS_FALSE,
×
NEW
378
        DataType::True => IS_TRUE,
×
379
        DataType::Long => IS_LONG,
72✔
380
        DataType::Double => IS_DOUBLE,
4✔
381
        DataType::String => IS_STRING,
55✔
382
        DataType::Array => IS_ARRAY,
30✔
383
        DataType::Object(_) => IS_OBJECT,
6✔
NEW
384
        DataType::Resource | DataType::Reference => IS_RESOURCE,
×
NEW
385
        DataType::Indirect => IS_INDIRECT,
×
386
        DataType::Callable => IS_CALLABLE,
11✔
NEW
387
        DataType::ConstantExpression => IS_CONSTANT_AST,
×
388
        DataType::Void => IS_VOID,
17✔
389
        DataType::Mixed => IS_MIXED,
34✔
390
        DataType::Bool => _IS_BOOL,
11✔
NEW
391
        DataType::Ptr => IS_PTR,
×
NEW
392
        DataType::Iterable => IS_ITERABLE,
×
393
    }
394
}
694✔
395

396
/// Decodes a raw zval type-tag (`IS_*` constant) into a [`DataType`].
397
///
398
/// Replaces the previous `impl From<u32> for DataType`; orphan rules block
399
/// that impl now that [`DataType`] lives in `ext-php-rs-types`.
400
#[must_use]
401
#[allow(clippy::bad_bit_mask)]
402
pub fn data_type_from_raw(value: u32) -> DataType {
5,930✔
403
    macro_rules! contains {
404
        ($c: ident, $t: ident) => {
405
            if (value & $c) == $c {
406
                return DataType::$t;
407
            }
408
        };
409
    }
410

411
    contains!(IS_VOID, Void);
5,930✔
412
    contains!(IS_PTR, Ptr);
5,929✔
413
    contains!(IS_INDIRECT, Indirect);
5,928✔
414
    contains!(IS_CALLABLE, Callable);
5,927✔
415
    contains!(IS_CONSTANT_AST, ConstantExpression);
5,927✔
416
    contains!(IS_REFERENCE, Reference);
5,925✔
417
    contains!(IS_RESOURCE, Resource);
5,917✔
418
    contains!(IS_ARRAY, Array);
5,915✔
419
    contains!(IS_STRING, String);
5,728✔
420
    contains!(IS_DOUBLE, Double);
4,617✔
421
    contains!(IS_LONG, Long);
4,148✔
422
    contains!(IS_TRUE, True);
3,213✔
423
    contains!(IS_FALSE, False);
3,144✔
424
    contains!(IS_NULL, Null);
3,093✔
425

426
    if (value & IS_OBJECT) == IS_OBJECT {
59✔
427
        return DataType::Object(None);
34✔
428
    }
25✔
429

430
    contains!(IS_UNDEF, Undef);
25✔
431

NEW
432
    DataType::Mixed
×
433
}
5,930✔
434

435
/// Maps a [`ZvalTypeFlags`] bag onto the first matching [`DataType`].
436
///
437
/// Replaces the previous `impl TryFrom<ZvalTypeFlags> for DataType`.
438
///
439
/// # Errors
440
///
441
/// Returns [`Error::UnknownDatatype`] when no flag matches a known PHP type.
NEW
442
pub fn data_type_try_from_zvf(value: ZvalTypeFlags) -> Result<DataType> {
×
443
    macro_rules! contains {
444
        ($t: ident) => {
445
            if value.contains(ZvalTypeFlags::$t) {
446
                return Ok(DataType::$t);
447
            }
448
        };
449
    }
450

NEW
451
    contains!(Undef);
×
NEW
452
    contains!(Null);
×
NEW
453
    contains!(False);
×
NEW
454
    contains!(True);
×
NEW
455
    contains!(False);
×
NEW
456
    contains!(Long);
×
NEW
457
    contains!(Double);
×
NEW
458
    contains!(String);
×
NEW
459
    contains!(Array);
×
NEW
460
    contains!(Resource);
×
NEW
461
    contains!(Callable);
×
NEW
462
    contains!(ConstantExpression);
×
NEW
463
    contains!(Void);
×
464

NEW
465
    if value.contains(ZvalTypeFlags::Object) {
×
NEW
466
        return Ok(DataType::Object(None));
×
UNCOV
467
    }
×
468

NEW
469
    Err(Error::UnknownDatatype(0))
×
UNCOV
470
}
×
471

472
#[cfg(test)]
473
mod tests {
474
    use super::{DataType, data_type_from_raw};
475
    use crate::ffi::{
476
        IS_ARRAY, IS_ARRAY_EX, IS_CONSTANT_AST, IS_CONSTANT_AST_EX, IS_DOUBLE, IS_FALSE,
477
        IS_INDIRECT, IS_INTERNED_STRING_EX, IS_LONG, IS_NULL, IS_OBJECT, IS_OBJECT_EX, IS_PTR,
478
        IS_REFERENCE, IS_REFERENCE_EX, IS_RESOURCE, IS_RESOURCE_EX, IS_STRING, IS_STRING_EX,
479
        IS_TRUE, IS_UNDEF, IS_VOID,
480
    };
481

482
    #[test]
483
    fn test_datatype() {
1✔
484
        macro_rules! test {
485
            ($c: ident, $t: ident) => {
486
                assert_eq!(data_type_from_raw($c), DataType::$t);
487
            };
488
        }
489

490
        test!(IS_UNDEF, Undef);
1✔
491
        test!(IS_NULL, Null);
1✔
492
        test!(IS_FALSE, False);
1✔
493
        test!(IS_TRUE, True);
1✔
494
        test!(IS_LONG, Long);
1✔
495
        test!(IS_DOUBLE, Double);
1✔
496
        test!(IS_STRING, String);
1✔
497
        test!(IS_ARRAY, Array);
1✔
498
        assert_eq!(data_type_from_raw(IS_OBJECT), DataType::Object(None));
1✔
499
        test!(IS_RESOURCE, Resource);
1✔
500
        test!(IS_REFERENCE, Reference);
1✔
501
        test!(IS_CONSTANT_AST, ConstantExpression);
1✔
502
        test!(IS_INDIRECT, Indirect);
1✔
503
        test!(IS_VOID, Void);
1✔
504
        test!(IS_PTR, Ptr);
1✔
505

506
        test!(IS_INTERNED_STRING_EX, String);
1✔
507
        test!(IS_STRING_EX, String);
1✔
508
        test!(IS_ARRAY_EX, Array);
1✔
509
        assert_eq!(data_type_from_raw(IS_OBJECT_EX), DataType::Object(None));
1✔
510
        test!(IS_RESOURCE_EX, Resource);
1✔
511
        test!(IS_REFERENCE_EX, Reference);
1✔
512
        test!(IS_CONSTANT_AST_EX, ConstantExpression);
1✔
513
    }
1✔
514
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc