Skip to content

Commit 532981a

Browse files
authored
Merge pull request #113 from tyrsson/fix-connectioninterface
Fixes the param/return type for getLastGeneratedValue in ConnectionInterface
2 parents d01d3fe + e40e367 commit 532981a

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

src/Adapter/Driver/ConnectionInterface.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ public function getConnectionParameters(): array;
2323
/**
2424
* Get last generated id
2525
*
26-
* @param null $name Ignored (this is not ignored for PDO), imagine that...
27-
*
28-
* todo: narrow this to string|int|bool|null
29-
* until version bumps to PHP 8.2 minimum then narrow to string|int|false
26+
* $name Ignored (this is not ignored for PDO), imagine that...
3027
*/
31-
public function getLastGeneratedValue($name = null): string|int|bool|null;
28+
public function getLastGeneratedValue(?string $name = null): string|int|false|null;
3229

3330
/**
3431
* Get resource

test/unit/Adapter/Driver/Pdo/TestAsset/TestConnection.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@ private function buildDsn(): string
5252
};
5353
}
5454

55-
/**
56-
* @param string|null $name
57-
*/
55+
/** @phpstan-ignore return.unusedType */
5856
#[Override]
59-
public function getLastGeneratedValue($name = null): string|bool|null
57+
public function getLastGeneratedValue(?string $name = null): string|int|false
6058
{
6159
return $this->resource?->lastInsertId($name) ?? null;
6260
}

test/unit/TestAsset/ConnectionWrapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public function getCurrentSchema(): string
2929
return 'test_schema';
3030
}
3131

32-
public function getLastGeneratedValue(mixed $name = null): int|string|bool|null
32+
public function getLastGeneratedValue(?string $name = null): string|int|false
3333
{
34-
return null;
34+
return false;
3535
}
3636

3737
public function getNestedTransactionsCount(): int

0 commit comments

Comments
 (0)