We don't really have the same kind of code in legacy. The closest thing is the upload of files where PHP handles the temporary file on its own. We also have the settings site.ini/[FileSettings]/TemporaryDir and image.ini/[FileSettings]/TemporaryDir which are almost not used in legacy... Note, that if you really want to customize the temporary dir, it is still possible by modifying the TMPDIR env variable (for instance in the Apache configuration). So I guess using sys_get_temp_dir() is OK for now, no ?