(PHP 7)
ReflectionClass::isAnonymous — Checks if class is anonymous
public ReflectionClass::isAnonymous ( ) : bool
Checks if a class is an anonymous class.
This function has no parameters.
Returns true on success or false on failure.
Example #1 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)
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/reflectionclass.isanonymous.php