New Validator rules format + tests. (#5127)

Same as  #5136 but with tests, better empty rules handling, tests and commited to 4.2.
If you, accepting arrays and strings, that parameter should be renamed to the plural.