1--TEST-- 2Attributes on promoted properties are assigned to both the property and parameter 3--FILE-- 4<?php 5 6class Test { 7 public function __construct( 8 #[NonNegative] 9 public int $num, 10 ) {} 11} 12 13$prop = new ReflectionProperty(Test::class, 'num'); 14var_dump($prop->getAttributes()[0]->getName()); 15 16$param = new ReflectionParameter([Test::class, '__construct'], 'num'); 17var_dump($param->getAttributes()[0]->getName()); 18 19?> 20--EXPECT-- 21string(11) "NonNegative" 22string(11) "NonNegative" 23