- var_export: documentation ( source)
<?php
#[\Attribute(\Attribute::TARGET_PROPERTY)]
final class AutowireProperty {}
class A {
#[AutowireProperty]
protected string $foo;
}
class B extends A {
}
$fooA = new \ReflectionProperty(A::class, 'foo');
$fooB = new \ReflectionProperty(B::class, 'foo');
echo "Class A: ";
var_export($fooA->getAttributes()[0]->getName());
echo "\n";
echo "Class B: ";
var_export($fooA->getAttributes()[0]->getName());
echo "\n";