write($object, $names); $writer->close(); } function __construct($output=null) { $this->writer = writer::with($output); } /** @var IWriter */ protected $writer; function close(): void { $this->writer->close(); } }