In most cases users would like more than just valid/invalid, i. e. which particular rule(s) failed and also human-readable error messages. As of simple validation that is almost always at hand, filter_* functions do a good job, although I agree that they could be better. I, for one, would like to see a full-featured validation as part of PHP. However, this RFC only looks like a slightly better version of filter_* functions, that is, the new module will provide almost the same functionality but with a different interface. I would vote against it.
On Mon, Sep 4, 2017 at 2:54 PM Rowan Collins <rowan.coll...@gmail.com> wrote: > On 4 September 2017 07:33:41 BST, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: > >Hi all, > > > >I spent a little time for a new input validation module. It's not > >totally > >new module, but is based on Filter module's validation filter > >improvement > >RFC in many ways. [1] > > Hi Yasuo, > > Thanks for tackling this. I do think the current filter module is user > unfriendly and it would be great to have something better. A couple of > quick thoughts based on your README: > > - The use of nested arrays keeps things simple in one sense, but the deep > nesting can get confusing. I wonder if a ValidationRule class would make > the distinction between parameters and references to existing rules > clearer. This would also give you a natural home for validating the > validation rules themselves (probably by throwing an exception in the > constructor). > > - A minor point, but most style guides would suggest function names should > be verbs, not adjectives, so "validate()" rather than "valid()". > > - Is there a use case for valid_id() or is it a temporary debugging thing > that won't be in the final version? > > In general, I like the idea, but would have to play around a bit to see if > it felt easy to use in real world situations. > > Regards, > > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Best regards, Victor Bolshov