php-rql icon indicating copy to clipboard operation
php-rql copied to clipboard

Rdb multiple args

Open Geekimo opened this issue 7 years ago • 1 comments

Adding php-rql multiple (>2) arguments support for the following API functions:

  • rOr
  • rAnd
  • contains

Plus a few enhancements for PSR-2 support.

Geekimo avatar Aug 28 '16 12:08 Geekimo

Cool, thanks for the pull request @Geekimo . I'll see to get this into the next version.

A bit of background: So far I've restrained from introducing variadic functions into PHP-ReQL, for the reason that it creates ambiguities whenever a ReQL term accepts optional arguments. Since optional (named) arguments in PHP-ReQL are just passed in as an object, we have to be able to distinguish whether a given argument is a set of options, or just an object that should be converted to a ReQL datum. If all functions have a fixed number of arguments, this is easy, since the optional argument object has a fixed position too (always the last argument). With variadic functions this no longer works, and things get hacky and potentially ambiguous.

For the particular cases of rOr, rAnd and contains, I think this is reasonable though. None of these take optional arguments, and I don't expect them to start taking optional arguments in a future version of ReQL. So again, thanks for working on this.

danielmewes avatar Sep 07 '16 17:09 danielmewes