xref: /PHP-8.2/Zend/tests/traits/constant_018.phpt (revision 3b62d660)
1--TEST--
2Referencing trait constants directly on calling \constant() causes a fatal error
3--FILE--
4<?php
5
6trait TestTrait {
7  public const Constant = 42;
8}
9
10var_dump(\constant('TestTrait::Constant'));
11?>
12--EXPECTF--
13Fatal error: Uncaught Error: Cannot access trait constant TestTrait::Constant directly in %s:%d
14Stack trace:
15#0 %s: constant('TestTrait::Cons...')
16#1 {main}
17  thrown in %s on line %d
18