@@ -3,76 +3,8 @@ Aliasing built-in types
3
3
--FILE--
4
4
<?php
5
5
6
- /* Taken from zend_compile.c reserved_class_names[] struct */
7
- /* array and list are also added as they are language constructs */
8
- $ types = [
9
- "bool " ,
10
- "false " ,
11
- "float " ,
12
- "int " ,
13
- "null " ,
14
- "parent " ,
15
- "self " ,
16
- "static " ,
17
- "string " ,
18
- "true " ,
19
- "void " ,
20
- "never " ,
21
- "iterable " ,
22
- "object " ,
23
- "mixed " ,
24
- "array " ,
25
- "list " ,
26
- ];
27
-
28
- foreach ($ types as $ type ) {
29
- try {
30
- eval ("use $ type as A; " );
31
- } catch (\Throwable $ e ) {
32
- echo $ e ::class, ': ' , $ e ->getMessage (), PHP_EOL ;
33
- }
34
- try {
35
- eval ("use $ type as A; function foo $ type(A \$v): A { return \$v; } " );
36
- } catch (\Throwable $ e ) {
37
- echo $ e ::class, ': ' , $ e ->getMessage (), PHP_EOL ;
38
- }
39
- }
6
+ use bool as A ;
40
7
41
8
?>
42
- DONE
43
- --EXPECT--
44
- CompileError: Cannot alias 'bool' as it is a built-in type
45
- CompileError: Cannot alias 'bool' as it is a built-in type
46
- CompileError: Cannot alias 'false' as it is a built-in type
47
- CompileError: Cannot alias 'false' as it is a built-in type
48
- CompileError: Cannot alias 'float' as it is a built-in type
49
- CompileError: Cannot alias 'float' as it is a built-in type
50
- CompileError: Cannot alias 'int' as it is a built-in type
51
- CompileError: Cannot alias 'int' as it is a built-in type
52
- CompileError: Cannot alias 'null' as it is a built-in type
53
- CompileError: Cannot alias 'null' as it is a built-in type
54
- CompileError: Cannot alias 'parent' as it is a built-in type
55
- CompileError: Cannot alias 'parent' as it is a built-in type
56
- CompileError: Cannot alias 'self' as it is a built-in type
57
- CompileError: Cannot alias 'self' as it is a built-in type
58
- ParseError: syntax error, unexpected token "static"
59
- ParseError: syntax error, unexpected token "static"
60
- CompileError: Cannot alias 'string' as it is a built-in type
61
- CompileError: Cannot alias 'string' as it is a built-in type
62
- CompileError: Cannot alias 'true' as it is a built-in type
63
- CompileError: Cannot alias 'true' as it is a built-in type
64
- CompileError: Cannot alias 'void' as it is a built-in type
65
- CompileError: Cannot alias 'void' as it is a built-in type
66
- CompileError: Cannot alias 'never' as it is a built-in type
67
- CompileError: Cannot alias 'never' as it is a built-in type
68
- CompileError: Cannot alias 'iterable' as it is a built-in type
69
- CompileError: Cannot alias 'iterable' as it is a built-in type
70
- CompileError: Cannot alias 'object' as it is a built-in type
71
- CompileError: Cannot alias 'object' as it is a built-in type
72
- CompileError: Cannot alias 'mixed' as it is a built-in type
73
- CompileError: Cannot alias 'mixed' as it is a built-in type
74
- ParseError: syntax error, unexpected token "array"
75
- ParseError: syntax error, unexpected token "array"
76
- ParseError: syntax error, unexpected token "list"
77
- ParseError: syntax error, unexpected token "list"
78
- DONE
9
+ --EXPECTF--
10
+ Fatal error: Cannot alias 'bool' as it is a built-in type in %s on line %d
0 commit comments