Re: [RFC][DISCUSSION] Add validation functions to filter
| From: | Pierre Joye | Date: | Thu, 04 Aug 2016 04:23:15 +0000 |
| Subject: | Re: [RFC][DISCUSSION] Add validation functions to filter | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94821@lists.php.net to get a copy of this message | ||
Hi Yasuo,
On Wed, Aug 3, 2016 at 1:43 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Hi all,
>
> This RFC is to add validation functions and string validation filter.
>
> https://wiki.php.net/rfc/add_validate_functions_to_filter
>
> It also allows to define multiple filters for an input. i.e. You can
> apply multiple filter rules for an input.
>
> Comments are appreciated!
Thanks for this proposal :)
Some comments:
Exceptions are not exceptional in this case but if there are invalid
options or arguments but everything else is expected to succeed or
fail. So I am not in favor to have exception here.
Naming must have filter_ prefix
We do have array filters, validate or filtering functions already I am
not sure why we need another function to do very similar things. Most
if not all ext/filter users (libraries, components, frameworks)
implements their own userfriendly interfaces (classes) and use the
existing filter APIs. The developers I talked to prefer to have simple
functions but fast, high quality and safe rather than complex APIs for
a specific flow, which is most likely won't match their needs. Most of
these higher level APIs are also using different approaches and OO
based, which simplifies a lot their usage.
Cheers,
Pierre