- is_subclass_of: documentation ( source)
<?php
interface proxy {}
class finalfoo
{
public function __construct()
{
if (is_subclass_of($this, __CLASS__, false)) {
throw new \Exception('Nein! Class is final!');
}
}
}
class fooproxy extends finalfoo implements proxy
{
}
class naughtyfoo
{
}
new finalfoo;
new fooproxy;
new naughtyfoo;