File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Referencing trait constants directly on calling \defined() returns false
3
+ --FILE--
4
+ <?php
5
+
6
+ trait TestTrait {
7
+ public const Constant = 42 ;
8
+ }
9
+
10
+ var_dump (\defined ('TestTrait::Constant ' ));
11
+ ?>
12
+ --EXPECTF--
13
+ bool(false)
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Referencing trait constants directly on calling \constant() causes a fatal error
3
+ --FILE--
4
+ <?php
5
+
6
+ trait TestTrait {
7
+ public const Constant = 42 ;
8
+ }
9
+
10
+ var_dump (\constant ('TestTrait::Constant ' ));
11
+ ?>
12
+ --EXPECTF--
13
+ Fatal error: Uncaught Error: Cannot access trait constant TestTrait::Constant directly in %s:%d
14
+ Stack trace:
15
+ #0 %s: constant('TestTrait::Cons...')
16
+ #1 {main}
17
+ thrown in %s on line %d
You can’t perform that action at this time.
0 commit comments