From 064b4644484d38e9dce40aef7e8e0e8190e9d863 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 24 Mar 2020 13:18:28 +0100 Subject: Implement "Constructor Promotion" RFC RFC: https://wiki.php.net/rfc/constructor_promotion Closes GH-5291. --- ext/reflection/php_reflection.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ext/reflection/php_reflection.c') diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 6d4f257eb4..d986f828f5 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2870,6 +2870,22 @@ ZEND_METHOD(ReflectionParameter, isVariadic) } /* }}} */ +/* {{{ proto public bool ReflectionParameter::isPromoted() + Returns this constructor parameter has been promoted to a property */ +ZEND_METHOD(ReflectionParameter, isPromoted) +{ + reflection_object *intern; + parameter_reference *param; + + if (zend_parse_parameters_none() == FAILURE) { + RETURN_THROWS(); + } + GET_REFLECTION_OBJECT_PTR(param); + + RETVAL_BOOL(ZEND_ARG_IS_PROMOTED(param->arg_info)); +} +/* }}} */ + /* {{{ proto public bool ReflectionType::allowsNull() Returns whether parameter MAY be null */ ZEND_METHOD(ReflectionType, allowsNull) @@ -5461,6 +5477,14 @@ ZEND_METHOD(ReflectionProperty, isDefault) } /* }}} */ +/* {{{ proto public bool ReflectionProperty::isPromoted() + Returns whether this property has been promoted from a constructor */ +ZEND_METHOD(ReflectionProperty, isPromoted) +{ + _property_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_PROMOTED); +} +/* }}} */ + /* {{{ proto public int ReflectionProperty::getModifiers() Returns a bitfield of the access modifiers for this property */ ZEND_METHOD(ReflectionProperty, getModifiers) -- cgit v1.2.1