File tree Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Expand file tree Collapse file tree 3 files changed +20
-16
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-11152: Allow aliasing namespaces containing reserved class names
3
+ --FILE--
4
+ <?php
5
+
6
+ namespace string ;
7
+
8
+ use string as StringAlias ;
9
+
10
+ class C {}
11
+
12
+ function test (StringAlias \C $ o ) {
13
+ var_dump ($ o ::class);
14
+ }
15
+
16
+ test (new C ());
17
+
18
+ ?>
19
+ --EXPECT--
20
+ string(8) "string\C"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -8237,12 +8237,6 @@ static void zend_compile_use(zend_ast *ast) /* {{{ */
8237
8237
zend_string * old_name = zend_ast_get_str (old_name_ast );
8238
8238
zend_string * new_name , * lookup_name ;
8239
8239
8240
- /* Check that we are not attempting to alias a built-in type */
8241
- if (type == ZEND_SYMBOL_CLASS && zend_is_reserved_class_name (old_name )) {
8242
- zend_error_noreturn (E_COMPILE_ERROR ,
8243
- "Cannot alias '%s' as it is a built-in type" , ZSTR_VAL (old_name ));
8244
- }
8245
-
8246
8240
if (new_name_ast ) {
8247
8241
new_name = zend_string_copy (zend_ast_get_str (new_name_ast ));
8248
8242
} else {
You can’t perform that action at this time.
0 commit comments