Re: A validator module for PHP7
| From: | Rowan Collins | Date: | Mon, 04 Sep 2017 12:53:14 +0000 |
| Subject: | Re: A validator module for PHP7 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100368@lists.php.net to get a copy of this message | ||
On 4 September 2017 07:33:41 BST, Yasuo Ohgaki <yohgaki@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]