Skip to content

Commit 8f6bd18

Browse files
kikaravjikxepozz
authored
fixed generic of connection::transaction (#994)
Co-authored-by: Sergei Predvoditelev <sergei@predvoditelev.ru> Co-authored-by: Dmitrii Derepko <xepozz@list.ru>
1 parent 330830d commit 8f6bd18

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
- New #984: Add `createQuery()` and `select()` methods to `ConnectionInterface` (@Tigrov)
102102
- Chg #985: Rename `insertWithReturningPks()` to `insertReturningPks()` in `CommandInterface` and `DMLQueryBuilderInterface` (@Tigrov)
103103
- Enh #992: Add optional type casting to `DataReaderInterface` using columns (@Tigrov)
104+
- Enh #991: Improve types in `ConnectionInterface::transaction()` (@kikara)
104105

105106
## 1.3.0 March 21, 2024
106107

src/Connection/AbstractConnection.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ public function transaction(Closure $closure, ?string $isolationLevel = null): m
9393
$level = $transaction->getLevel();
9494

9595
try {
96-
/** @psalm-var mixed $result */
9796
$result = $closure($this);
9897

9998
if ($transaction->isActive() && $transaction->getLevel() === $level) {

src/Connection/ConnectionInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ public function setTablePrefix(string $value): void;
258258
*
259259
* @return mixed Result of callback function.
260260
*
261-
* @psalm-param Closure(ConnectionInterface):mixed|Closure(ConnectionInterface):void $closure
261+
* @psalm-template Result
262+
* @psalm-param Closure(ConnectionInterface): Result $closure
263+
* @psalm-return Result
262264
*/
263265
public function transaction(Closure $closure, ?string $isolationLevel = null): mixed;
264266
}

0 commit comments

Comments
 (0)