I think that the problem was not use a strict comparison ===
fix comparison must be strict
Does this check/message make any sense here?
yes, so, we can do
see issue #4926
Problem was in typecasting and not in the validation. lines 94-96 are useless.
I think you better create PR if you have better suggestion, thanks.