diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-04 17:33:12 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-04 17:33:12 +0200 |
commit | 51f1d74a2279276ce762056856767b7dc140dd5b (patch) | |
tree | d8a2421ad165438814b64e2c219f001e4c20cf12 /src/argument.cpp | |
parent | 2eb4e891d9b2d3c71a2b1d7367d85b22f4ecc9cf (diff) |
fixes to make the library compile for php 5.6 environments (problem discovered in issue #59)
Diffstat (limited to 'src/argument.cpp')
-rw-r--r-- | src/argument.cpp | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/src/argument.cpp b/src/argument.cpp index 8690a5c..a2aa8d5 100644 --- a/src/argument.cpp +++ b/src/argument.cpp @@ -28,13 +28,32 @@ Argument::Argument(const char *name, Type type, bool required, bool byref) // fill members _info->name = name; _info->name_len = strlen(name); -#if PHP_VERSION_ID >= 50400 + +#if PHP_VERSION_ID >= 50400 + + // since php 5.4 there is a type-hint _info->type_hint = (unsigned char)(type == Type::Array || type == Type::Callable ? type : Type::Null); + +# if PHP_VERSION_ID >= 50600 + + // from PHP 5.6 and onwards, an is_variadic property can be set, this + // specifies whether this argument is the first argument that specifies + // the type for a variable length list of arguments. For now we only + // support methods and functions with a fixed number of arguments. + _info->is_variadic = false; + +# endif + #else + + // php 5.3 code _info->array_type_hint = type == Type::Array; _info->return_reference = false; _info->required_num_args = 0; // @todo is this correct? + #endif + + // this parameter is a regular type _info->class_name = NULL; _info->class_name_len = 0; _info->allow_null = false; @@ -60,9 +79,32 @@ Argument::Argument(const char *name, const char *classname, bool nullable, bool // fill members _info->name = name; _info->name_len = strlen(name); -#if PHP_VERSION_ID >= 50400 + +#if PHP_VERSION_ID >= 50400 + + // since php 5.4 there is a type hint _info->type_hint = (unsigned char)Type::Object; + +# if PHP_VERSION_ID >= 50600 + + // from PHP 5.6 and onwards, an is_variadic property can be set, this + // specifies whether this argument is the first argument that specifies + // the type for a variable length list of arguments. For now we only + // support methods and functions with a fixed number of arguments. + _info->is_variadic = false; + +# endif + +#else + + // php 5.3 code + _info->array_type_hint = false; + _info->return_reference = false; + _info->required_num_args = 0; // @todo is this correct? + #endif + + // the parameter is a class _info->class_name = classname; _info->class_name_len = strlen(classname); _info->allow_null = nullable; |