--TEST-- Closure in attribute may access private variables --EXTENSIONS-- reflection --FILE-- secret, PHP_EOL; })] class C { public function __construct( private string $secret, ) {} } foreach ((new ReflectionClass(C::class))->getAttributes() as $reflectionAttribute) { ($reflectionAttribute->newInstance()->value)(new C('secret')); } ?> --EXPECT-- secret