(PHP 7, PHP 8)
ReflectionClass::isAnonymous — Checks if class is anonymous
This function has no parameters.
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)