Checks if class is anonymous

- « ReflectionClass::isAbstract

- ReflectionClass::isCloneable »

- PHP Manual
- ReflectionClass
- Checks if class is anonymous

# ReflectionClass::isAnonymous

(PHP 7, PHP 8)

ReflectionClass::isAnonymous — Checks if class is anonymous

### Description

public ReflectionClass::isAnonymous(): bool

Checks if a class is an anonymous class.

### Parameters

This function has no parameters.

### Return Values

Returns `true` on success or `false` on failure.

### Examples

Example #1 ReflectionClass::isAnonymous() example

    <?phpclass TestClass {}$anonClass = new class {};$normalClass = new ReflectionClass('TestClass');$anonClass  = new ReflectionClass($anonClass);var_dump($normalClass->isAnonymous());var_dump($anonClass->isAnonymous());?>

The above example will output:

    bool(false)
    bool(true)

### See Also

- ReflectionClass::isFinal() - Checks if class is final