<?php #[\Attribute(\Attribute::TARGET_CLASS)] class TestAttribute { public function __construct( public readonly mixed $first, public readonly mixed $second, ) {} } #[TestAttribute(first: 1, second: 2, third: 3)] class TargetClass {} $reflection = new \ReflectionClass(TargetClass::class); $attributes = $reflection->getAttributes(); $instance = $attributes[0]->newInstance(); print_r($instance);
You have javascript disabled. You will not be able to edit any code.