diff --git a/.github/workflows/bc.yml b/.github/workflows/bc.yml index 00041a9f4..5970206c9 100644 --- a/.github/workflows/bc.yml +++ b/.github/workflows/bc.yml @@ -1,25 +1,15 @@ on: pull_request: - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' + paths: + - 'src/**' + - '.github/workflows/bc.yml' + - 'composer.json' push: branches: ['master'] - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - '.gitignore' - - '.gitattributes' - - 'infection.json.dist' - - 'phpunit.xml.dist' - - 'psalm.xml' + paths: + - 'src/**' + - '.github/workflows/bc.yml' + - 'composer.json' name: backwards compatibility diff --git a/src/Query/Query.php b/src/Query/Query.php index 4ba681e7b..98e69b962 100644 --- a/src/Query/Query.php +++ b/src/Query/Query.php @@ -662,7 +662,7 @@ public function where(array|string|ExpressionInterface|null $condition, array $p return $this; } - public function withQuery(QueryInterface|string $query, ExpressionInterface|string $alias, bool $recursive = false): static + public function withQuery(QueryInterface|string $query, string $alias, bool $recursive = false): static { $this->withQueries[] = ['query' => $query, 'alias' => $alias, 'recursive' => $recursive]; return $this; diff --git a/src/Query/QueryPartsInterface.php b/src/Query/QueryPartsInterface.php index 8c3ddfd84..f6b9ca974 100644 --- a/src/Query/QueryPartsInterface.php +++ b/src/Query/QueryPartsInterface.php @@ -645,11 +645,10 @@ public function where(array|string|ExpressionInterface|null $condition, array $p * Prepends an SQL statement using `WITH` syntax. * * @param QueryInterface|string $query The SQL statement to append using `UNION`. - * @param ExpressionInterface|string $alias The query alias in `WITH` construction. - * To specify the alias in plain SQL, you may pass an instance of {@see ExpressionInterface}. + * @param string $alias The query alias in `WITH` construction. * @param bool $recursive Its `true` if using `WITH RECURSIVE` and `false` if using `WITH`. */ - public function withQuery(QueryInterface|string $query, ExpressionInterface|string $alias, bool $recursive = false): static; + public function withQuery(QueryInterface|string $query, string $alias, bool $recursive = false): static; /** * Specifies the `WITH` query clause for the query. diff --git a/src/QueryBuilder/AbstractDMLQueryBuilder.php b/src/QueryBuilder/AbstractDMLQueryBuilder.php index 1224e503f..9d07ccfa7 100644 --- a/src/QueryBuilder/AbstractDMLQueryBuilder.php +++ b/src/QueryBuilder/AbstractDMLQueryBuilder.php @@ -4,6 +4,7 @@ namespace Yiisoft\Db\QueryBuilder; +use Generator; use JsonException; use Yiisoft\Db\Constraint\Constraint; use Yiisoft\Db\Constraint\IndexConstraint; @@ -49,7 +50,7 @@ public function __construct( ) { } - public function batchInsert(string $table, array $columns, iterable $rows, array &$params = []): string + public function batchInsert(string $table, array $columns, iterable|Generator $rows, array &$params = []): string { if (empty($rows)) { return ''; diff --git a/src/QueryBuilder/AbstractQueryBuilder.php b/src/QueryBuilder/AbstractQueryBuilder.php index 53971f27b..f93c13bc9 100644 --- a/src/QueryBuilder/AbstractQueryBuilder.php +++ b/src/QueryBuilder/AbstractQueryBuilder.php @@ -4,6 +4,7 @@ namespace Yiisoft\Db\QueryBuilder; +use Generator; use Yiisoft\Db\Command\CommandInterface; use Yiisoft\Db\Expression\ExpressionInterface; use Yiisoft\Db\Query\QueryInterface; @@ -108,7 +109,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 $rows, array &$params = []): string + public function batchInsert(string $table, array $columns, iterable|Generator $rows, array &$params = []): string { return $this->dmlBuilder->batchInsert($table, $columns, $rows, $params); } diff --git a/src/QueryBuilder/DMLQueryBuilderInterface.php b/src/QueryBuilder/DMLQueryBuilderInterface.php index fdac752aa..3df1c2c8c 100644 --- a/src/QueryBuilder/DMLQueryBuilderInterface.php +++ b/src/QueryBuilder/DMLQueryBuilderInterface.php @@ -4,6 +4,7 @@ namespace Yiisoft\Db\QueryBuilder; +use Generator; use JsonException; use Yiisoft\Db\Exception\Exception; use Yiisoft\Db\Exception\InvalidArgumentException; @@ -33,7 +34,7 @@ interface DMLQueryBuilderInterface * * @param string $table The table to insert new rows into. * @param string[] $columns The column names of the table. - * @param iterable $rows The rows to batch-insert into the table. + * @param Generator|iterable $rows The rows to batch-insert into the table. * @param array $params The binding parameters. This parameter exists. * * @throws Exception @@ -48,7 +49,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 $rows, array &$params = []): string; + public function batchInsert(string $table, array $columns, iterable|Generator $rows, array &$params = []): string; /** * Creates a `DELETE` SQL statement. diff --git a/tests/AbstractQueryBuilderTest.php b/tests/AbstractQueryBuilderTest.php index d6de07f63..31de64c71 100644 --- a/tests/AbstractQueryBuilderTest.php +++ b/tests/AbstractQueryBuilderTest.php @@ -5,6 +5,7 @@ namespace Yiisoft\Db\Tests; use Closure; +use Generator; use JsonException; use PHPUnit\Framework\TestCase; use stdClass; @@ -210,7 +211,7 @@ public function testAlterColumn(): void * * @psalm-param array $columns */ - public function testBatchInsert(string $table, array $columns, iterable $rows, string $expected): void + public function testBatchInsert(string $table, array $columns, iterable|Generator $rows, string $expected): void { $db = $this->getConnection(); diff --git a/tests/Db/QueryBuilder/QueryBuilderTest.php b/tests/Db/QueryBuilder/QueryBuilderTest.php index 93356917f..79a1e382b 100644 --- a/tests/Db/QueryBuilder/QueryBuilderTest.php +++ b/tests/Db/QueryBuilder/QueryBuilderTest.php @@ -4,6 +4,7 @@ namespace Yiisoft\Db\Tests\Db\QueryBuilder; +use Generator; use JsonException; use Yiisoft\Db\Exception\Exception; use Yiisoft\Db\Exception\InvalidArgumentException; @@ -47,7 +48,7 @@ public function testAddDefaultValue(): void /** * @dataProvider \Yiisoft\Db\Tests\Provider\QueryBuilderProvider::batchInsert */ - public function testBatchInsert(string $table, array $columns, iterable $rows, string $expected): void + public function testBatchInsert(string $table, array $columns, iterable|Generator $rows, string $expected): void { $db = $this->getConnection();