Merge cases for numbers and string in output

Also removed initial `$ret = 'unknown';` since it won't be used due to `\LogicException`.