Skip to content

Commit

Permalink
Rename Sql::_and(), _or() to and(), or()
Browse files Browse the repository at this point in the history
  • Loading branch information
emonkak committed Jun 18, 2020
1 parent 6661bdd commit d7439be
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/DeleteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function where($arg1, $arg2 = null, $arg3 = null, $arg4 = null): self
{
$condition = $this->grammar->condition(...func_get_args());
$cloned = clone $this;
$cloned->where = $this->where ? Sql::_and($this->where, $condition) : $condition;
$cloned->where = $this->where ? Sql::and($this->where, $condition) : $condition;
return $cloned;
}

Expand All @@ -97,7 +97,7 @@ public function orWhere($arg1, $arg2 = null, $arg3 = null, $arg4 = null): self
{
$condition = $this->grammar->condition(...func_get_args());
$cloned = clone $this;
$cloned->where = $this->where ? Sql::_or($this->where, $condition) : $condition;
$cloned->where = $this->where ? Sql::or($this->where, $condition) : $condition;
return $cloned;
}

Expand Down
8 changes: 4 additions & 4 deletions src/SelectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function where($arg1, $arg2 = null, $arg3 = null, $arg4 = null): self
{
$condition = $this->grammar->condition(...func_get_args());
$cloned = clone $this;
$cloned->where = $this->where ? Sql::_and($this->where, $condition) : $condition;
$cloned->where = $this->where ? Sql::and($this->where, $condition) : $condition;
return $cloned;
}

Expand All @@ -289,7 +289,7 @@ public function orWhere($arg1, $arg2 = null, $arg3 = null, $arg4 = null): self
{
$condition = $this->grammar->condition(...func_get_args());
$cloned = clone $this;
$cloned->where = $this->where ? Sql::_or($this->where, $condition) : $condition;
$cloned->where = $this->where ? Sql::or($this->where, $condition) : $condition;
return $cloned;
}

Expand Down Expand Up @@ -348,7 +348,7 @@ public function having($arg1, $arg2 = null, $arg3 = null, $arg4 = null): self
{
$condition = $this->grammar->condition(...func_get_args());
$cloned = clone $this;
$cloned->having = $this->having ? Sql::_and($this->having, $condition) : $condition;
$cloned->having = $this->having ? Sql::and($this->having, $condition) : $condition;
return $cloned;
}

Expand All @@ -362,7 +362,7 @@ public function orHaving($arg1, $arg2 = null, $arg3 = null, $arg4 = null): self
{
$condition = $this->grammar->condition(...func_get_args());
$cloned = clone $this;
$cloned->having = $this->having ? Sql::_or($this->having, $condition) : $condition;
$cloned->having = $this->having ? Sql::or($this->having, $condition) : $condition;
return $cloned;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function values(array $values): self
return new Sql($sql, $values);
}

public static function _and(Sql $lhs, Sql ...$rest): self
public static function and(Sql $lhs, Sql ...$rest): self
{
$tmpSql = $lhs->sql;
$tmpBindings = [$lhs->bindings];
Expand All @@ -91,7 +91,7 @@ public static function _and(Sql $lhs, Sql ...$rest): self
return new Sql($tmpSql, $bindings);
}

public static function _or(Sql $lhs, Sql ...$rest): self
public static function or(Sql $lhs, Sql ...$rest): self
{
$tmpSql = $lhs->sql;
$tmpBindings = [$lhs->bindings];
Expand Down
4 changes: 2 additions & 2 deletions src/UpdateBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function where($arg1, $arg2 = null, $arg3 = null, $arg4 = null): self
{
$condition = $this->grammar->condition(...func_get_args());
$cloned = clone $this;
$cloned->where = $this->where ? Sql::_and($this->where, $condition) : $condition;
$cloned->where = $this->where ? Sql::and($this->where, $condition) : $condition;
return $cloned;
}

Expand All @@ -130,7 +130,7 @@ public function orWhere($arg1, $arg2 = null, $arg3 = null, $arg4 = null): self
{
$condition = $this->grammar->condition(...func_get_args());
$cloned = clone $this;
$cloned->where = $this->where ? Sql::_or($this->where, $condition) : $condition;
$cloned->where = $this->where ? Sql::or($this->where, $condition) : $condition;
return $cloned;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/SqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public function testValues(): void

public function testAnd(): void
{
$query = Sql::_and(
Sql::_or(
$query = Sql::and(
Sql::or(
new Sql('foo = ?', [1]),
new Sql('bar = ?', [2])
),
Expand Down

0 comments on commit d7439be

Please sign in to comment.