xref: /PHP-8.2/Zend/tests/traits/constant_004.phpt (revision 3b62d660)
1--TEST--
2Trying to access a constant on trait via the name of trait causes a Fatal error
3--FILE--
4<?php
5trait Foo {
6    const A = 42;
7}
8
9class Bar {
10    use Foo;
11}
12
13echo Foo::A, PHP_EOL;
14?>
15--EXPECTF--
16Fatal error: Uncaught Error: Cannot access trait constant Foo::A directly in %s:%d
17Stack trace:
18#0 {main}
19  thrown in %s on line %d
20