$this->getNodeType(), 'type' => $this->getType(), 'name' => $this->getName(), ], // We (recursively) serialize all of the class’ properties and exclude the list provided. array_map( static function ($value) { if ($value instanceof JsonSerializable) { return $value->jsonSerialize(); } return $value; }, get_object_vars($this) ) ); } }