diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-13 09:25:32 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-13 09:25:32 +0100 |
commit | 2976b3910251b18a039b663433a95e2cccaec5e9 (patch) | |
tree | 664bcf92909a1a8ac75e89205ead992e4e5c4e33 | |
parent | c8aee70a0b9d4f873a7327c13bb6b4763a6299a3 (diff) | |
download | nextcloud-server-2976b3910251b18a039b663433a95e2cccaec5e9.tar.gz nextcloud-server-2976b3910251b18a039b663433a95e2cccaec5e9.zip |
Made AddSelect varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r-- | lib/private/DB/QueryBuilder/QueryBuilder.php | 8 | ||||
-rw-r--r-- | lib/public/DB/QueryBuilder/IQueryBuilder.php | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index c15470dcda8..4b3fd8449ce 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -452,12 +452,14 @@ class QueryBuilder implements IQueryBuilder { * ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id'); * </code> * - * @param mixed $select The selection expression. + * @param mixed ...$selects The selection expression. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. */ - public function addSelect($select = null) { - $selects = is_array($select) ? $select : func_get_args(); + public function addSelect(...$selects) { + if (count($selects) === 1 && is_array($selects[0])) { + $selects = $selects[0]; + } $this->queryBuilder->addSelect( $this->helper->quoteColumnNames($selects) diff --git a/lib/public/DB/QueryBuilder/IQueryBuilder.php b/lib/public/DB/QueryBuilder/IQueryBuilder.php index 70cc26f9a7e..760496064fd 100644 --- a/lib/public/DB/QueryBuilder/IQueryBuilder.php +++ b/lib/public/DB/QueryBuilder/IQueryBuilder.php @@ -344,12 +344,12 @@ interface IQueryBuilder { * ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id'); * </code> * - * @param mixed $select The selection expression. + * @param mixed ...$select The selection expression. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. * @since 8.2.0 */ - public function addSelect($select = null); + public function addSelect(...$select); /** * Turns the query being built into a bulk delete query that ranges over |