Skip to content

Commit 7920386

Browse files
committed
- Fixed PHPDoc for WHERE and HAVING to clarify the possibility to pass arrays as the first parameter
1 parent 5b80112 commit 7920386

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/Builder/Traits/HavingBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait HavingBuilder {
1111
private $having = array();
1212

1313
/**
14-
* @param string $expression
14+
* @param string|array $expression
1515
* @param mixed ...$param
1616
* @return $this
1717
*/

src/Builder/Traits/WhereBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait WhereBuilder {
1111
private $where = array();
1212

1313
/**
14-
* @param string $expression
14+
* @param string|array $expression
1515
* @param mixed ...$param
1616
* @return $this
1717
*/

tests/Builder/SelectTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ public function testWhere() {
7878
->where('a < ?', 1000)
7979
->asString();
8080
$this->assertEquals("SELECT\n\ta\nFROM\n\ttest t\nWHERE\n\t(a < '1000')\n", $str);
81+
}
8182

83+
public function testWhereAsArray() {
8284
$str = TestSelect::create()
8385
->field('a')
8486
->from('t', 'test')
@@ -331,11 +333,12 @@ public function testRequiredExpression() {
331333

332334
public function testSortSpecification() {
333335
$query = TestSelect::create()
334-
->field('t.field')
336+
->field('t.field1')
337+
->field('t.field2')
335338
->from('t', 'test')
336-
->orderBy(new DBExprOrderBySpec(['field1', 'field2'], [['field2', 'ASC'], ['field1', 'DESC'], ['field3' => 'ASC']]))
339+
->orderBy(new DBExprOrderBySpec(['field1', 'field2' => 'REVERSE(t.field2)'], [['field2', 'ASC'], ['field1', 'DESC'], ['field3' => 'ASC']]))
337340
->asString();
338341

339-
$this->assertEquals("SELECT\n\tt.field\nFROM\n\ttest t\nORDER BY\n\tfield2 ASC,\n\tfield1 DESC\n", $query);
342+
$this->assertEquals("SELECT\n\tt.field1,\n\tt.field2\nFROM\n\ttest t\nORDER BY\n\tREVERSE(t.field2) ASC,\n\tfield1 DESC\n", $query);
340343
}
341344
}

0 commit comments

Comments
 (0)