- Output for 8.2.29, 8.3.5 - 8.3.25, 8.4.8 - 8.4.12
- bool(true) bool(false)
<?php
enum Marker {}
#[Marker]
class C {}
class D {}
function has_marker(string $class) {
return !empty((new ReflectionClass($class))->getAttributes(Marker::class));
}
var_dump(has_marker(C::class));
var_dump(has_marker(D::class));