1--TEST-- 2Flattened trait constants are retrieved as members of the composing class via Reflection 3--FILE-- 4<?php 5 6trait TestTrait { 7 public const Constant = 42; 8} 9 10class TestClass { 11 use TestTrait; 12} 13 14$reflection = new \ReflectionClass(TestTrait::class); 15var_dump($reflection->getConstant('Constant')); 16var_dump($reflection->getReflectionConstant('Constant')->getDeclaringClass()->getName()); 17 18$reflection = new \ReflectionClass(TestClass::class); 19var_dump($reflection->getConstant('Constant')); 20var_dump($reflection->getReflectionConstant('Constant')->getDeclaringClass()->getName()); 21 22?> 23--EXPECTF-- 24int(42) 25string(9) "TestTrait" 26int(42) 27string(9) "TestClass" 28