Skip to content

Commit

Permalink
revert removing Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Nov 12, 2023
1 parent e84c617 commit 1795dad
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/QueryBuilder/AbstractDMLQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Yiisoft\Db\QueryBuilder;

use Generator;
use JsonException;
use Yiisoft\Db\Constraint\Constraint;
use Yiisoft\Db\Constraint\IndexConstraint;
Expand Down Expand Up @@ -50,7 +49,7 @@ public function __construct(
) {
}

public function batchInsert(string $table, array $columns, iterable|Generator $rows, array &$params = []): string
public function batchInsert(string $table, array $columns, iterable $rows, array &$params = []): string
{
if (empty($rows)) {
return '';
Expand Down
3 changes: 1 addition & 2 deletions src/QueryBuilder/AbstractQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Yiisoft\Db\QueryBuilder;

use Generator;
use Yiisoft\Db\Command\CommandInterface;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Query\QueryInterface;
Expand Down Expand Up @@ -109,7 +108,7 @@ public function alterColumn(string $table, string $column, ColumnInterface|strin
return $this->ddlBuilder->alterColumn($table, $column, $type);
}

public function batchInsert(string $table, array $columns, iterable|Generator $rows, array &$params = []): string
public function batchInsert(string $table, array $columns, iterable $rows, array &$params = []): string
{
return $this->dmlBuilder->batchInsert($table, $columns, $rows, $params);
}
Expand Down
5 changes: 2 additions & 3 deletions src/QueryBuilder/DMLQueryBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Yiisoft\Db\QueryBuilder;

use Generator;
use JsonException;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\InvalidArgumentException;
Expand Down Expand Up @@ -34,7 +33,7 @@ interface DMLQueryBuilderInterface
*
* @param string $table The table to insert new rows into.
* @param string[] $columns The column names of the table.
* @param Generator|iterable $rows The rows to batch-insert into the table.
* @param iterable $rows The rows to batch-insert into the table.
* @param array $params The binding parameters. This parameter exists.
*
* @throws Exception
Expand All @@ -49,7 +48,7 @@ interface DMLQueryBuilderInterface
* - That the values in each row must match the corresponding column names.
* - The method will escape the column names, and quote the values to insert.
*/
public function batchInsert(string $table, array $columns, iterable|Generator $rows, array &$params = []): string;
public function batchInsert(string $table, array $columns, iterable $rows, array &$params = []): string;

/**
* Creates a `DELETE` SQL statement.
Expand Down
3 changes: 1 addition & 2 deletions tests/AbstractQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Yiisoft\Db\Tests;

use Closure;
use Generator;
use JsonException;
use PHPUnit\Framework\TestCase;
use stdClass;
Expand Down Expand Up @@ -211,7 +210,7 @@ public function testAlterColumn(): void
*
* @psalm-param array<array-key, string> $columns
*/
public function testBatchInsert(string $table, array $columns, iterable|Generator $rows, string $expected): void
public function testBatchInsert(string $table, array $columns, iterable $rows, string $expected): void
{
$db = $this->getConnection();
Expand Down
3 changes: 1 addition & 2 deletions tests/Db/QueryBuilder/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Yiisoft\Db\Tests\Db\QueryBuilder;

use Generator;
use JsonException;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\InvalidArgumentException;
Expand Down Expand Up @@ -48,7 +47,7 @@ public function testAddDefaultValue(): void
/**
* @dataProvider \Yiisoft\Db\Tests\Provider\QueryBuilderProvider::batchInsert
*/
public function testBatchInsert(string $table, array $columns, iterable|Generator $rows, string $expected): void
public function testBatchInsert(string $table, array $columns, iterable $rows, string $expected): void
{
$db = $this->getConnection();

Expand Down

0 comments on commit 1795dad

Please sign in to comment.