@@ -5282,6 +5282,8 @@ ZEND_API void zend_set_function_arg_flags(zend_function *func) /* {{{ */
52825282static zend_type zend_compile_typename (zend_ast * ast , zend_bool force_allow_null ) /* {{{ */
52835283{
52845284 zend_bool allow_null = force_allow_null ;
5285+ zend_ast_attr orig_ast_attr = ast -> attr ;
5286+ zend_type type ;
52855287 if (ast -> attr & ZEND_TYPE_NULLABLE ) {
52865288 allow_null = 1 ;
52875289 ast -> attr &= ~ZEND_TYPE_NULLABLE ;
@@ -5291,15 +5293,15 @@ static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null
52915293 return ZEND_TYPE_ENCODE (ast -> attr , allow_null );
52925294 } else {
52935295 zend_string * class_name = zend_ast_get_str (ast );
5294- zend_uchar type = zend_lookup_builtin_type_by_name (class_name );
5296+ zend_uchar type_code = zend_lookup_builtin_type_by_name (class_name );
52955297
5296- if (type != 0 ) {
5298+ if (type_code != 0 ) {
52975299 if ((ast -> attr & ZEND_NAME_NOT_FQ ) != ZEND_NAME_NOT_FQ ) {
52985300 zend_error_noreturn (E_COMPILE_ERROR ,
52995301 "Type declaration '%s' must be unqualified" ,
53005302 ZSTR_VAL (zend_string_tolower (class_name )));
53015303 }
5302- return ZEND_TYPE_ENCODE (type , allow_null );
5304+ type = ZEND_TYPE_ENCODE (type_code , allow_null );
53035305 } else {
53045306 uint32_t fetch_type = zend_get_class_fetch_type_ast (ast );
53055307 if (fetch_type == ZEND_FETCH_CLASS_DEFAULT ) {
@@ -5310,9 +5312,12 @@ static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null
53105312 zend_string_addref (class_name );
53115313 }
53125314
5313- return ZEND_TYPE_ENCODE_CLASS (class_name , allow_null );
5315+ type = ZEND_TYPE_ENCODE_CLASS (class_name , allow_null );
53145316 }
53155317 }
5318+
5319+ ast -> attr = orig_ast_attr ;
5320+ return type ;
53165321}
53175322/* }}} */
53185323
0 commit comments