Skip to content

Commit f9147f8

Browse files
committed
Make Database::{use,transaction} methods return static
1 parent 93030bc commit f9147f8

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/Database.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,13 @@ public function error() : ?string
340340
* @param string $schema
341341
*
342342
* @throws mysqli_sql_exception if schema is unknown
343+
*
344+
* @return static
343345
*/
344-
public function use(string $schema) : void
346+
public function use(string $schema) : static
345347
{
346348
$this->mysqli->select_db($schema);
349+
return $this;
347350
}
348351

349352
/**
@@ -641,8 +644,10 @@ public function prepare(#[Language('SQL')] string $statement) : PreparedStatemen
641644
*
642645
* @throws Exception if statements fail
643646
* @throws LogicException if transaction already is active
647+
*
648+
* @return static
644649
*/
645-
public function transaction(callable $statements) : void
650+
public function transaction(callable $statements) : static
646651
{
647652
if ($this->inTransaction) {
648653
throw new LogicException('Transaction already is active');
@@ -659,6 +664,7 @@ public function transaction(callable $statements) : void
659664
} finally {
660665
$this->inTransaction = false;
661666
}
667+
return $this;
662668
}
663669

664670
/**

0 commit comments

Comments
 (0)