Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<ReflectionReference::getIdReflectionAttribute::__construct>
^ReflectionLast updated: Mon, 26 Oct 2026

The ReflectionAttribute class

(PHP 8)

Introduction

The ReflectionAttribute class provides information about an Attribute.

Class synopsis

class ReflectionAttribute implements Reflector {
/* Constants */
public const int IS_INSTANCEOF;
/* Properties */
public string $name;
/* Methods */
private function __construct()
public function getArguments(): array
public function getName(): string
public function getTarget(): int
public function isRepeated(): bool
public function newInstance(): object
}

Properties

name

The name of the attribute.

Predefined Constants

ReflectionAttribute Flags

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.

Note:

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.

Changelog

Version Description
8.4.0 All class constants are now typed.
8.4.0 Added ReflectionAttribute::$name.

Table of Contents


<ReflectionReference::getIdReflectionAttribute::__construct>
^ReflectionLast updated: Mon, 26 Oct 2026