- Output for 8.4.1 - 8.4.12
- array(1) { [0]=> object(ReflectionAttribute)#2 (1) { ["name"]=> string(6) "Inject" } }
- Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25
- array(1) { [0]=> object(ReflectionAttribute)#2 (0) { } }
<?php
class Service
{
}
#[Attribute]
class Inject{}
class InjectAttributePresenter
{
#[Inject]
public Service $service;
}
$reflector = new ReflectionProperty(InjectAttributePresenter::class, 'service');
var_dump($reflector->getAttributes(Inject::class));