Skip to content

Commit 47ab0de

Browse files
authored
Remove false from result of "returning" methods in CommandInterface (#372)
1 parent 9b544ae commit 47ab0de

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/Command.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,13 @@ final class Command extends AbstractPdoCommand
3333
ColumnType::BIGINT,
3434
];
3535

36-
public function insertReturningPks(string $table, array|QueryInterface $columns): array|false
36+
public function insertReturningPks(string $table, array|QueryInterface $columns): array
3737
{
3838
$tableSchema = $this->db->getSchema()->getTableSchema($table);
3939
$returnColumns = $tableSchema?->getPrimaryKey() ?? [];
4040

4141
if ($returnColumns === []) {
42-
if ($this->insert($table, $columns)->execute() === 0) {
43-
return false;
44-
}
45-
42+
$this->insert($table, $columns)->execute();
4643
return [];
4744
}
4845
/** @var TableSchema $tableSchema */
@@ -97,9 +94,7 @@ public function insertReturningPks(string $table, array|QueryInterface $columns)
9794

9895
unset($value);
9996

100-
if ($this->execute() === 0) {
101-
return false;
102-
}
97+
$this->execute();
10398

10499
$result = [];
105100

src/Schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ protected function loadTableIndexes(string $tableName): array
266266
$columnNames = [];
267267
}
268268

269-
/** @var string[] $columnNames */
269+
/** @var list<string> $columnNames */
270270
$result[$name] = new Index(
271271
$name,
272272
$columnNames,

0 commit comments

Comments
 (0)