So instead of validating input into a function, I should write a test, a factory and a bunch of other shit?
No thanks.
No thanks.
And, you should write a test. Period. A factory isn't needed and the bunch of shit is only if you're using version < 3.0.
Did you really miss this in the post? That's good input, thanks, and thanks for reading!
Not validating input to a function, in general cases, is a bad idea, imho - tests or no tests - but that might be a matter of style or preference?
Well, I know better than to get into discussions about style !