PHP: Hypertext Preprocessor (original) (raw)

The ReflectionClass class

(PHP 5, PHP 7, PHP 8)

Introduction

The ReflectionClass class reports information about a class.

Class synopsis

class **ReflectionClass implements Reflector {

/* Constants */

/* Properties */

/* Methods */

}

Predefined Constants

Table of Contents

Found A Problem?

danbettles at yahoo dot co dot uk

16 years ago

`To reflect on a namespaced class in PHP 5.3, you must always specify the fully qualified name of the class - even if you've aliased the containing namespace using a "use" statement.

So instead of:

You would type:

`

Anonymous

13 years ago

`Unserialized reflection class cause error.

ref=unserialize(serialize(ref = unserialize(serialize(ref=unserialize(serialize(ref)); var_dump($ref); var_dump($ref->getDocComment());// object(ReflectionClass)#2 (1) { // ["name"]=> // string(1) "a" // } // PHP Fatal error: ReflectionClass::getDocComment(): Internal error: Failed to retrieve the reflection object ?>

`

Anonymous

11 years ago

`Reflecting an alias will give you a reflection of the resolved class.

getName(); // X?>

`