ReflectionClass::isAnonymous

(PHP 7)
Checks if class is anonymous
public bool ReflectionClass::isAnonymous ( void )

Checks if a class is an anonymous class.

Returns:

Returns TRUE on success or FALSE on failure.

Examples:
ReflectionClass::isAnonymous() example
<?php
class 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() -

doc_php
2016-02-24 16:13:23
Comments
Leave a Comment

Please login to continue.