Skip to content

Commit

Permalink
Renamed function tap because have conflict with laravel function. T…
Browse files Browse the repository at this point in the history
…hey incompatible. (#65)

* Renamed function `tap` because have conflict with laravel function. They incompatible.

* Fix by continuous-integration/styleci/pr

Co-authored-by: Volodymyr Razumniak <[email protected]>
  • Loading branch information
Volodymyr and Volodymyr Razumniak authored Nov 15, 2022
1 parent 1a1601e commit 05f63ce
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 65 deletions.
106 changes: 53 additions & 53 deletions src/Query/BaseBuilder.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Query/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct(BaseBuilder $query)
public function name($columnName): self
{
if ($columnName instanceof \Closure) {
$columnName = tap(new static($this->query), $columnName);
$columnName = tp(new static($this->query), $columnName);
}

if (is_string($columnName)) {
Expand Down Expand Up @@ -303,7 +303,7 @@ public function query($query = null)
}

if ($query instanceof \Closure) {
$query = tap($this->query->newQuery(), $query);
$query = tp($this->query->newQuery(), $query);
}

if ($query instanceof BaseBuilder) {
Expand Down
2 changes: 1 addition & 1 deletion src/Query/From.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function query($query = null)
}

if ($query instanceof \Closure) {
$query = tap($this->query->newQuery(), $query);
$query = tp($this->query->newQuery(), $query);
}

if ($query instanceof BaseBuilder) {
Expand Down
2 changes: 1 addition & 1 deletion src/Query/JoinClause.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function query($query = null)
}

if ($query instanceof Closure) {
$query = tap($this->query->newQuery(), $query);
$query = tp($this->query->newQuery(), $query);
}

if ($query instanceof BaseBuilder) {
Expand Down
4 changes: 2 additions & 2 deletions src/Query/TwoElementsLogicExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function concatOperator(string $operator)
public function firstElementQuery($query): self
{
if ($query instanceof \Closure) {
$query = tap($this->query->newQuery(), $query);
$query = tp($this->query->newQuery(), $query);
}

if ($query instanceof BaseBuilder) {
Expand All @@ -141,7 +141,7 @@ public function firstElementQuery($query): self
public function secondElementQuery($query): self
{
if ($query instanceof \Closure) {
$query = tap($this->query->newQuery(), $query);
$query = tp($this->query->newQuery(), $query);
}

if ($query instanceof BaseBuilder) {
Expand Down
4 changes: 2 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// @codeCoverageIgnoreStart
if (!function_exists('tap')) {
if (!function_exists('tp')) {
/**
* Call the given Closure with the given value then return the value.
*
Expand All @@ -10,7 +10,7 @@
*
* @return mixed
*/
function tap($value, $callback)
function tp($value, $callback)
{
$callback($value);

Expand Down
6 changes: 3 additions & 3 deletions tests/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ public function test_wheres_basic()
$element->firstElement('a');
$element->operator('=');
$element->secondElement('b');
$element->concatOperator(Operator:: OR);
$element->concatOperator(Operator::OR);

$builder->where($element);
$this->assertEquals('SELECT * WHERE \'a\' = \'b\'', $builder->toSql());
Expand All @@ -592,13 +592,13 @@ public function test_wheres_basic()
$element->firstElement('a');
$element->operator('=');
$element->secondElement('b');
$element->concatOperator(Operator:: OR);
$element->concatOperator(Operator::OR);

$element2 = new TwoElementsLogicExpression($builder);
$element2->firstElement('c');
$element2->operator('=');
$element2->secondElement('d');
$element2->concatOperator(Operator:: OR);
$element2->concatOperator(Operator::OR);

$builder->where($element, '=', $element2);
$this->assertEquals('SELECT * WHERE \'a\' = \'b\' = \'c\' = \'d\'', $builder->toSql());
Expand Down
2 changes: 1 addition & 1 deletion tests/FunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testTap()
$result = 2;
};

$returnedValue = tap($value, $callback);
$returnedValue = tp($value, $callback);

$this->assertEquals($value, $returnedValue);
$this->assertEquals(2, $result);
Expand Down

0 comments on commit 05f63ce

Please sign in to comment.