The ReflectionClass class

(PHP 5, PHP 7, PHP 8)

Introduction

The ReflectionClass class reports information about a class.

Class synopsis

classReflectionClassimplementsReflector {
publicconstintIS_FINAL;
publicconstintIS_READONLY;
public__construct(object|string$objectOrClass)
publicstaticexport(mixed$argument, bool$return = false): string
publicgetAttributes(?string$name = null, int$flags = 0): array
publicgetConstant(string$name): mixed
publicgetConstants(?int$filter = null): array
publicgetMethods(?int$filter = null): array
publicgetModifiers(): int
publicgetName(): string
publicgetProperties(?int$filter = null): array
publicgetStaticPropertyValue(string$name, mixed&$def_value = ?): mixed
publicgetTraits(): array
publichasConstant(string$name): bool
publichasMethod(string$name): bool
publichasProperty(string$name): bool
publicinNamespace(): bool
publicisAbstract(): bool
publicisAnonymous(): bool
publicisCloneable(): bool
publicisEnum(): bool
publicisFinal(): bool
publicisInstance(object$object): bool
publicisInterface(): bool
publicisInternal(): bool
publicisIterable(): bool
publicisReadOnly(): bool
publicisTrait(): bool
publicnewInstance(mixed...$args): object
publicnewInstanceArgs(array$args = []): ?object
}

Properties

name

Name of the class. Read-only, throws ReflectionException in attempt to write.

Predefined Constants

ReflectionClass Modifiers

ReflectionClass::IS_IMPLICIT_ABSTRACT

Indicates the class is abstract because it has some abstract methods.

ReflectionClass::IS_EXPLICIT_ABSTRACT

Indicates the class is abstract because of its definition.

ReflectionClass::IS_FINAL

Indicates the class is final.

ReflectionClass::IS_READONLY

Indicates the class is readonly.

Changelog

VersionDescription
8.0.0ReflectionClass::export() was removed.

Table of Contents

To Top