@@ -34,32 +34,57 @@ bitflags! {
34
34
/// Flags used for setting the type of Zval.
35
35
#[ derive( PartialEq , Eq , PartialOrd , Ord , Hash , Debug , Clone , Copy ) ]
36
36
pub struct ZvalTypeFlags : u32 {
37
+ /// Undefined
37
38
const Undef = IS_UNDEF ;
39
+ /// Null
38
40
const Null = IS_NULL ;
41
+ /// `false`
39
42
const False = IS_FALSE ;
43
+ /// `true`
40
44
const True = IS_TRUE ;
45
+ /// Integer
41
46
const Long = IS_LONG ;
47
+ /// Floating point number
42
48
const Double = IS_DOUBLE ;
49
+ /// String
43
50
const String = IS_STRING ;
51
+ /// Array
44
52
const Array = IS_ARRAY ;
53
+ /// Object
45
54
const Object = IS_OBJECT ;
55
+ /// Resource
46
56
const Resource = IS_RESOURCE ;
57
+ /// Reference
47
58
const Reference = IS_REFERENCE ;
59
+ /// Callable
48
60
const Callable = IS_CALLABLE ;
61
+ /// Constant expression
49
62
const ConstantExpression = IS_CONSTANT_AST ;
63
+ /// Void
50
64
const Void = IS_VOID ;
65
+ /// Pointer
51
66
const Ptr = IS_PTR ;
67
+ /// Iterable
52
68
const Iterable = IS_ITERABLE ;
53
69
70
+ /// Interned string extended
54
71
const InternedStringEx = Self :: String . bits( ) ;
72
+ /// String extended
55
73
const StringEx = Self :: String . bits( ) | Self :: RefCounted . bits( ) ;
74
+ /// Array extended
56
75
const ArrayEx = Self :: Array . bits( ) | Self :: RefCounted . bits( ) | Self :: Collectable . bits( ) ;
76
+ /// Object extended
57
77
const ObjectEx = Self :: Object . bits( ) | Self :: RefCounted . bits( ) | Self :: Collectable . bits( ) ;
78
+ /// Resource extended
58
79
const ResourceEx = Self :: Resource . bits( ) | Self :: RefCounted . bits( ) ;
80
+ /// Reference extended
59
81
const ReferenceEx = Self :: Reference . bits( ) | Self :: RefCounted . bits( ) ;
82
+ /// Constant ast extended
60
83
const ConstantAstEx = Self :: ConstantExpression . bits( ) | Self :: RefCounted . bits( ) ;
61
84
85
+ /// Reference counted
62
86
const RefCounted = ( IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT ) ;
87
+ /// Collectable
63
88
const Collectable = ( IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT ) ;
64
89
}
65
90
}
@@ -68,29 +93,52 @@ bitflags! {
68
93
/// Flags for building classes.
69
94
#[ derive( PartialEq , Eq , PartialOrd , Ord , Hash , Debug , Clone , Copy ) ]
70
95
pub struct ClassFlags : u32 {
96
+ /// Final class or method
71
97
const Final = ZEND_ACC_FINAL ;
98
+ /// Abstract method
72
99
const Abstract = ZEND_ACC_ABSTRACT ;
100
+ /// Immutable `op_array` and class_entries
101
+ /// (implemented only for lazy loading of `op_array`s)
73
102
const Immutable = ZEND_ACC_IMMUTABLE ;
103
+ /// Function has typed arguments / class has typed props
74
104
const HasTypeHints = ZEND_ACC_HAS_TYPE_HINTS ;
105
+ /// Top-level class or function declaration
75
106
const TopLevel = ZEND_ACC_TOP_LEVEL ;
107
+ /// op_array or class is preloaded
76
108
const Preloaded = ZEND_ACC_PRELOADED ;
77
109
110
+ /// Class entry is an interface
78
111
const Interface = ZEND_ACC_INTERFACE ;
112
+ /// Class entry is a trait
79
113
const Trait = ZEND_ACC_TRAIT ;
114
+ /// Anonymous class
80
115
const AnonymousClass = ZEND_ACC_ANON_CLASS ;
116
+ /// Class linked with parent, interfaces and traits
81
117
const Linked = ZEND_ACC_LINKED ;
118
+ /// Class is abstract, since it is set by any abstract method
82
119
const ImplicitAbstractClass = ZEND_ACC_IMPLICIT_ABSTRACT_CLASS ;
120
+ /// Class has magic methods `__get`/`__set`/`__unset`/`__isset` that use guards
83
121
const UseGuards = ZEND_ACC_USE_GUARDS ;
122
+
123
+ /// Class constants updated
84
124
const ConstantsUpdated = ZEND_ACC_CONSTANTS_UPDATED ;
125
+ /// Objects of this class may not have dynamic properties
85
126
const NoDynamicProperties = ZEND_ACC_NO_DYNAMIC_PROPERTIES ;
127
+ /// User class has methods with static variables
86
128
const HasStaticInMethods = ZEND_HAS_STATIC_IN_METHODS ;
129
+ /// Children must reuse parent `get_iterator()`
87
130
#[ cfg( not( php82) ) ]
88
131
const ReuseGetIterator = ZEND_ACC_REUSE_GET_ITERATOR ;
132
+ /// Parent class is resolved (CE)
89
133
const ResolvedParent = ZEND_ACC_RESOLVED_PARENT ;
134
+ /// Interfaces are resolved (CE)
90
135
const ResolvedInterfaces = ZEND_ACC_RESOLVED_INTERFACES ;
136
+ /// Class has unresolved variance obligations
91
137
const UnresolvedVariance = ZEND_ACC_UNRESOLVED_VARIANCE ;
138
+ /// Class is linked apart from variance obligations
92
139
const NearlyLinked = ZEND_ACC_NEARLY_LINKED ;
93
140
141
+ /// Class cannot be serialized or unserialized
94
142
#[ cfg( php81) ]
95
143
const NotSerializable = crate :: ffi:: ZEND_ACC_NOT_SERIALIZABLE ;
96
144
}
@@ -100,34 +148,67 @@ bitflags! {
100
148
/// Flags for building methods.
101
149
#[ derive( PartialEq , Eq , PartialOrd , Ord , Hash , Debug , Clone , Copy ) ]
102
150
pub struct MethodFlags : u32 {
151
+ /// Visibility public
103
152
const Public = ZEND_ACC_PUBLIC ;
153
+ /// Visibility protected
104
154
const Protected = ZEND_ACC_PROTECTED ;
155
+ /// Visibility private
105
156
const Private = ZEND_ACC_PRIVATE ;
157
+ /// Method or property overrides private one
106
158
const Changed = ZEND_ACC_CHANGED ;
159
+ /// Static method
107
160
const Static = ZEND_ACC_STATIC ;
161
+ /// Final method
108
162
const Final = ZEND_ACC_FINAL ;
163
+ /// Abstract method
109
164
const Abstract = ZEND_ACC_ABSTRACT ;
165
+ /// Immutable `op_array` and class_entries
166
+ /// (implemented only for lazy loading of op_arrays)
110
167
const Immutable = ZEND_ACC_IMMUTABLE ;
168
+ /// Function has typed arguments / class has typed props
111
169
const HasTypeHints = ZEND_ACC_HAS_TYPE_HINTS ;
170
+ /// Top-level class or function declaration
112
171
const TopLevel = ZEND_ACC_TOP_LEVEL ;
172
+ /// `op_array` or class is preloaded
113
173
const Preloaded = ZEND_ACC_PRELOADED ;
114
174
175
+ /// Deprecation flag
115
176
const Deprecated = ZEND_ACC_DEPRECATED ;
177
+ /// Function returning by reference
116
178
const ReturnReference = ZEND_ACC_RETURN_REFERENCE ;
179
+ /// Function has a return type
117
180
const HasReturnType = ZEND_ACC_HAS_RETURN_TYPE ;
181
+ /// Function with variable number of arguments
118
182
const Variadic = ZEND_ACC_VARIADIC ;
183
+ /// `op_array` has finally blocks (user only)
119
184
const HasFinallyBlock = ZEND_ACC_HAS_FINALLY_BLOCK ;
185
+ /// "main" `op_array` with `ZEND_DECLARE_CLASS_DELAYED` opcodes
120
186
const EarlyBinding = ZEND_ACC_EARLY_BINDING ;
187
+ /// Closure uses `$this`
121
188
const UsesThis = ZEND_ACC_USES_THIS ;
189
+ /// Call through user function trampoline
190
+ ///
191
+ /// # Example
192
+ /// - `__call`
193
+ /// - `__callStatic`
122
194
const CallViaTrampoline = ZEND_ACC_CALL_VIA_TRAMPOLINE ;
195
+ /// Disable inline caching
123
196
const NeverCache = ZEND_ACC_NEVER_CACHE ;
197
+ /// `op_array` is a clone of trait method
124
198
const TraitClone = ZEND_ACC_TRAIT_CLONE ;
199
+ /// Function is a constructor
125
200
const IsConstructor = ZEND_ACC_CTOR ;
201
+ /// Function is a closure
126
202
const Closure = ZEND_ACC_CLOSURE ;
203
+ /// Function is a fake closure
127
204
const FakeClosure = ZEND_ACC_FAKE_CLOSURE ;
205
+ /// Function is a generator
128
206
const Generator = ZEND_ACC_GENERATOR ;
207
+ /// Function was processed by pass two (user only)
129
208
const DonePassTwo = ZEND_ACC_DONE_PASS_TWO ;
209
+ /// `run_time_cache` allocated on heap (user only)
130
210
const HeapRTCache = ZEND_ACC_HEAP_RT_CACHE ;
211
+ /// `op_array` uses strict mode types
131
212
const StrictTypes = ZEND_ACC_STRICT_TYPES ;
132
213
}
133
214
}
@@ -155,9 +236,13 @@ bitflags! {
155
236
/// Flags for building constants.
156
237
#[ derive( PartialEq , Eq , PartialOrd , Ord , Hash , Debug , Clone , Copy ) ]
157
238
pub struct ConstantFlags : u32 {
239
+ /// Visibility public
158
240
const Public = ZEND_ACC_PUBLIC ;
241
+ /// Visibility protected
159
242
const Protected = ZEND_ACC_PROTECTED ;
243
+ /// Visibility private
160
244
const Private = ZEND_ACC_PRIVATE ;
245
+ /// Promoted constant
161
246
const Promoted = ZEND_ACC_PROMOTED ;
162
247
}
163
248
}
@@ -166,9 +251,14 @@ bitflags! {
166
251
/// Flags for building module global constants.
167
252
#[ derive( PartialEq , Eq , PartialOrd , Ord , Hash , Debug , Clone , Copy ) ]
168
253
pub struct GlobalConstantFlags : u32 {
254
+ /// No longer used -- always case-sensitive
255
+ #[ deprecated( note = "No longer used -- always case-sensitive" ) ]
169
256
const CaseSensitive = CONST_CS ;
257
+ /// Persistent
170
258
const Persistent = CONST_PERSISTENT ;
259
+ /// Can't be saved in file cache
171
260
const NoFileCache = CONST_NO_FILE_CACHE ;
261
+ /// Deprecated (this flag is not deprecated, it literally means the constant is deprecated)
172
262
const Deprecated = CONST_DEPRECATED ;
173
263
}
174
264
}
@@ -177,46 +267,71 @@ bitflags! {
177
267
/// Represents the result of a function.
178
268
#[ derive( PartialEq , Eq , PartialOrd , Ord , Hash , Debug , Clone , Copy ) ]
179
269
pub struct ZendResult : i32 {
270
+ /// Function call was successful.
180
271
const Success = 0 ;
272
+ /// Function call failed.
181
273
const Failure = -1 ;
182
274
}
183
275
}
184
276
185
277
bitflags ! {
186
278
/// Represents permissions for where a configuration setting may be set.
187
279
pub struct IniEntryPermission : u32 {
280
+ /// User
188
281
const User = PHP_INI_USER ;
282
+ /// Per directory
189
283
const PerDir = PHP_INI_PERDIR ;
284
+ /// System
190
285
const System = PHP_INI_SYSTEM ;
286
+ /// All
191
287
const All = PHP_INI_ALL ;
192
288
}
193
289
}
194
290
195
291
bitflags ! {
196
292
/// Represents error types when used via php_error_docref for example.
197
293
pub struct ErrorType : u32 {
294
+ /// Error
198
295
const Error = E_ERROR ;
296
+ /// Warning
199
297
const Warning = E_WARNING ;
298
+ /// Parse
200
299
const Parse = E_PARSE ;
300
+ /// Notice
201
301
const Notice = E_NOTICE ;
302
+ /// Core error
202
303
const CoreError = E_CORE_ERROR ;
304
+ /// Core warning
203
305
const CoreWarning = E_CORE_WARNING ;
306
+ /// Compile error
204
307
const CompileError = E_COMPILE_ERROR ;
308
+ /// Compile warning
205
309
const CompileWarning = E_COMPILE_WARNING ;
310
+ /// User error
206
311
const UserError = E_USER_ERROR ;
312
+ /// User warning
207
313
const UserWarning = E_USER_WARNING ;
314
+ /// User notice
208
315
const UserNotice = E_USER_NOTICE ;
316
+ /// Strict
209
317
const Strict = E_STRICT ;
318
+ /// Recoverable error
210
319
const RecoverableError = E_RECOVERABLE_ERROR ;
320
+ /// Deprecated
211
321
const Deprecated = E_DEPRECATED ;
322
+ /// User deprecated
212
323
const UserDeprecated = E_USER_DEPRECATED ;
213
324
}
214
325
}
215
326
327
+ /// Represents the type of a function.
216
328
#[ derive( PartialEq , Eq , Hash , Debug , Clone , Copy ) ]
217
329
pub enum FunctionType {
330
+ /// Internal function
218
331
Internal ,
332
+ /// User function
219
333
User ,
334
+ /// Eval code
220
335
Eval ,
221
336
}
222
337
@@ -236,24 +351,43 @@ impl From<u8> for FunctionType {
236
351
#[ repr( C , u8 ) ]
237
352
#[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
238
353
pub enum DataType {
354
+ /// Undefined
239
355
Undef ,
356
+ /// `null`
240
357
Null ,
358
+ /// `false`
241
359
False ,
360
+ /// `true`
242
361
True ,
362
+ /// Integer (the irony)
243
363
Long ,
364
+ /// Floating point number
244
365
Double ,
366
+ /// String
245
367
String ,
368
+ /// Array
246
369
Array ,
370
+ /// Iterable
247
371
Iterable ,
372
+ /// Object
248
373
Object ( Option < & ' static str > ) ,
374
+ /// Resource
249
375
Resource ,
376
+ /// Reference
250
377
Reference ,
378
+ /// Callable
251
379
Callable ,
380
+ /// Constant expression
252
381
ConstantExpression ,
382
+ /// Void
253
383
Void ,
384
+ /// Mixed
254
385
Mixed ,
386
+ /// Boolean
255
387
Bool ,
388
+ /// Pointer
256
389
Ptr ,
390
+ /// Indirect (internal)
257
391
Indirect ,
258
392
}
259
393
0 commit comments