(PHP 8)
The ReflectionAttribute class provides information about an Attribute.
The name of the attribute.
ReflectionAttribute::IS_INSTANCEOF
int
Retrieve attributes using an
instanceof check.
Used as the flags argument of
ReflectionClass::getAttributes() and the
equivalent methods of the other reflection classes. When set, the
name argument matches attributes whose class is
the given class or a subclass of it, or implements the given
interface, instead of only matching the exact class name.
Nota:
Quando viene usato
ReflectionAttribute::IS_INSTANCEOF, il nome di classe specificato danameviene caricato automaticamente prima che venga esaminato qualsiasi attributo. Se non può essere caricato, l'errore o l'eccezione lanciati durante il caricamento vengono propagati. Se la classe non esiste, viene lanciato un Error.PHP carica automaticamente anche la classe di ogni attributo dichiarato sull'elemento oggetto di reflection, inclusi gli attributi che non corrispondono al filtro, perché usa
instanceofper filtrarli. Un attributo la cui classe non esiste viene ignorato. Se viene lanciato un errore o un'eccezione durante il caricamento di una classe di attributo, ad esempio perché manca una classe genitore o il suo file contiene un errore di sintassi, questo viene propagato, anche se l'attributo non corrisponde al filtro.
Nota:
The values of these constants may change between PHP versions. It is recommended to always use the constants and not rely on the values directly.
| Versione | Descrizione |
|---|---|
| 8.4.0 | All class constants are now typed. |
| 8.4.0 | Added ReflectionAttribute::$name. |