Re: A validator module for PHP7
| From: | Rowan Collins | Date: | Wed, 06 Sep 2017 22:47:38 +0000 |
| Subject: | Re: A validator module for PHP7 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100426@lists.php.net to get a copy of this message | ||
On 6 September 2017 21:33:53 BST, Dan Ackroyd <danack@basereality.com> wrote:
>On 6 September 2017 at 13:31, Rowan Collins <rowan.collins@gmail.com>
>wrote:
>> I'm going to assume that the code you posted was something of a straw
>> man, and you're not actually advocating people copy 20 lines of code
>for
>> every variable they want to validate.
>
>You assume wrong. No it's not, and yes I am.
>
>I can point a junior developer at the function and they can understand
>it.
>
>If I ask that junior developer to add an extra rule that doesn't
>currently exist, they can without having to dive into a full library
>of validation code.
I can certainly agree that a complex DSL might be more pain than it's worth, but copying around
a regex and all its scaffolding is surely worse than a clearly named function like
validate_non_negative_int?
That's why I asked in my last email if you thought ext/filter should be removed, and perhaps
replaced by some more straightforward primitives, or just left as it is. If a broad strategic
question like that feels too much like "wasting time on the list designing features" to
you, I'm not sure what you would find acceptable discussion.
Regards,
--
Rowan Collins
[IMSoP]