Restored some PHP 7.4 support

This commit is contained in:
2022-10-31 12:51:24 +01:00
parent fd2767b642
commit 4b9e6f4c29
3 changed files with 17 additions and 3 deletions

View File

@ -116,11 +116,21 @@ class Dataset
return $reader;
}
$ext = pathinfo($filename, PATHINFO_EXTENSION);
/*
return match ($ext) {
'json' => JsonReader::class,
'csv' => CsvReader::class,
default => throw new \RuntimeException("Unable to determine reader for dataset file")
};
*/
// PHP7.4 compat: use switch instead of match
switch ($ext) {
case 'json': return JsonReader::class;
case 'csv': return CsvReader::class;
default: throw new \RuntimeException("Unable to determine reader for dataset file");
}
}
}
}