File tree Expand file tree Collapse file tree 3 files changed +30
-53
lines changed Expand file tree Collapse file tree 3 files changed +30
-53
lines changed Original file line number Diff line number Diff line change @@ -898,13 +898,6 @@ protected function checkTryCatch(TryCatch $node) {
898
898
}
899
899
900
900
protected function checkNamespace (Namespace_ $ node ) {
901
- if ($ node ->name && $ node ->name ->isSpecialClassName ()) {
902
- $ this ->emitError (new Error (
903
- sprintf ('Cannot use \'%s \' as namespace name ' , $ node ->name ),
904
- $ node ->name ->getAttributes ()
905
- ));
906
- }
907
-
908
901
if (null !== $ node ->stmts ) {
909
902
foreach ($ node ->stmts as $ stmt ) {
910
903
if ($ stmt instanceof Namespace_) {
Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ Keywords in namespaced name
3
3
<?php
4
4
namespace fn;
5
5
namespace fn\use;
6
+ namespace self;
7
+ namespace parent;
8
+ namespace static;
6
9
fn\use();
7
10
\fn\use();
8
11
namespace\fn\use();
@@ -25,6 +28,33 @@ array(
25
28
1: use
26
29
)
27
30
)
31
+ stmts: array(
32
+ )
33
+ )
34
+ 2: Stmt_Namespace(
35
+ name: Name(
36
+ parts: array(
37
+ 0: self
38
+ )
39
+ )
40
+ stmts: array(
41
+ )
42
+ )
43
+ 3: Stmt_Namespace(
44
+ name: Name(
45
+ parts: array(
46
+ 0: parent
47
+ )
48
+ )
49
+ stmts: array(
50
+ )
51
+ )
52
+ 4: Stmt_Namespace(
53
+ name: Name(
54
+ parts: array(
55
+ 0: static
56
+ )
57
+ )
28
58
stmts: array(
29
59
0: Stmt_Expression(
30
60
expr: Expr_FuncCall(
Original file line number Diff line number Diff line change 1
1
Invalid namespace names
2
2
-----
3
- <?php namespace self;
4
- -----
5
- Cannot use 'self' as namespace name from 1:17 to 1:20
6
- array(
7
- 0: Stmt_Namespace(
8
- name: Name(
9
- parts: array(
10
- 0: self
11
- )
12
- )
13
- stmts: array(
14
- )
15
- )
16
- )
17
- -----
18
- <?php namespace PARENT;
19
- -----
20
- Cannot use 'PARENT' as namespace name from 1:17 to 1:22
21
- array(
22
- 0: Stmt_Namespace(
23
- name: Name(
24
- parts: array(
25
- 0: PARENT
26
- )
27
- )
28
- stmts: array(
29
- )
30
- )
31
- )
32
- -----
33
- <?php namespace static;
34
- -----
35
- !!php7
36
- Cannot use 'static' as namespace name from 1:17 to 1:22
37
- array(
38
- 0: Stmt_Namespace(
39
- name: Name(
40
- parts: array(
41
- 0: static
42
- )
43
- )
44
- stmts: array(
45
- )
46
- )
47
- )
48
- -----
49
3
<?php use A as self;
50
4
-----
51
5
Cannot use A as self because 'self' is a special class name from 1:16 to 1:19
You can’t perform that action at this time.
0 commit comments