You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (arg.type() == Type::Object) info->class_name = arg.classname();
172
179
else info->class_name = nullptr;
173
180
181
+
// whether or not we allow null
182
+
info->allow_null = arg.allowNull();
183
+
#endif
184
+
174
185
// set the correct type-hint
175
186
switch (arg.type())
176
187
{
188
+
#if PHP_VERSION_ID < 70200
177
189
case Type::Undefined: info->type_hint = IS_UNDEF; break; // undefined means we'll accept any type
178
190
case Type::Null: info->type_hint = IS_UNDEF; break; // this is likely an error, what good would accepting NULL be? accept anything
179
191
case Type::False: info->type_hint = _IS_BOOL; break; // accept true as well ;)
@@ -186,7 +198,23 @@ class Callable
186
198
case Type::Object: info->type_hint = IS_OBJECT; break; // must be an object of the given classname
187
199
case Type::Callable: info->type_hint = IS_CALLABLE; break; // anything that can be invoked
188
200
default: info->type_hint = IS_UNDEF; break; // if not specified we allow anything
189
-
201
+
#else
202
+
case Type::Undefined: info->type = ZEND_TYPE_ENCODE(IS_UNDEF, arg.allowNull()); break; // undefined means we'll accept any type
203
+
case Type::Null: info->type = ZEND_TYPE_ENCODE(IS_UNDEF, arg.allowNull()); break; // this is likely an error, what good would accepting NULL be? accept anything
204
+
case Type::False: info->type = ZEND_TYPE_ENCODE(_IS_BOOL, arg.allowNull()); break; // accept true as well ;)
205
+
case Type::True: info->type = ZEND_TYPE_ENCODE(_IS_BOOL, arg.allowNull()); break; // accept false as well
206
+
case Type::Bool: info->type = ZEND_TYPE_ENCODE(_IS_BOOL, arg.allowNull()); break; // any bool will do, true, false, the options are limitless
207
+
case Type::Numeric: info->type = ZEND_TYPE_ENCODE(IS_LONG, arg.allowNull()); break; // accept integers here
208
+
case Type::Float: info->type = ZEND_TYPE_ENCODE(IS_DOUBLE, arg.allowNull()); break; // floating-point values welcome too
209
+
case Type::String: info->type = ZEND_TYPE_ENCODE(IS_STRING, arg.allowNull()); break; // accept strings, should auto-cast objects with __toString as well
210
+
case Type::Array: info->type = ZEND_TYPE_ENCODE(IS_ARRAY, arg.allowNull()); break; // array of anything (individual members cannot be restricted)
211
+
case Type::Object: // if there is a classname and the argument is not nullable, it's simply the classname
212
+
if (!arg.classname()) info->type = ZEND_TYPE_ENCODE(IS_OBJECT, arg.allowNull());
0 commit comments