--TEST-- Test variations of getting typed class constant values --FILE-- getValue()); echo $rc; $rc = new ReflectionClassConstant(B::class, 'CONST1'); try { $rc->getValue(); } catch (TypeError $e) { echo $e->getMessage() . "\n"; } try { echo $rc; } catch (TypeError $e) { echo $e->getMessage() . "\n"; } ?> --EXPECT-- object(stdClass)#1 (0) { } Constant [ public object CONST1 ] { Object } Cannot assign stdClass to class constant B::CONST1 of type array Cannot assign stdClass to class constant B::CONST1 of type array