PHP 7.2 real app usage:
public function jsonSerialize()
{
$m1 = memory_get_usage();
$json_class = new class implements SpecExportInterface {
public $id;
public $status;
public $code;
public $title;