xref: /PHP-8.4/Zend/tests/traits/constant_006.phpt (revision 3b62d660)
1--TEST--
2Conflicting constants in composing classes with different values should result in a fatal error, since this indicates that the code is incompatible.
3--FILE--
4<?php
5
6trait TestTrait {
7  public const Constant = 123;
8}
9
10echo "PRE-CLASS-GUARD\n";
11
12class ComposingClass {
13    use TestTrait;
14    public const Constant = 456;
15}
16
17echo "POST-CLASS-GUARD\n";
18?>
19--EXPECTF--
20PRE-CLASS-GUARD
21
22Fatal error: ComposingClass and TestTrait define the same constant (Constant) in the composition of ComposingClass. However, the definition differs and is considered incompatible. Class was composed in %s on line %d
23