Skip to content

Commit 003ff34

Browse files
authored
Merge pull request #130 from tyrsson/align-driver-interface-getlastgeneratedvalue
Aligns remaining lastGeneratedValue(ish) methods
2 parents d6ef7fe + e3a8e08 commit 003ff34

4 files changed

Lines changed: 7 additions & 11 deletions

File tree

src/Adapter/Driver/DriverInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ public function getPrepareType(): string;
4646
/** Format parameter name */
4747
public function formatParameterName(string $name, ?string $type = null): string;
4848

49-
/**
50-
* Get last generated value
51-
*
52-
* todo: narrow this to int|string|false|null once 8.2 is minimum
53-
* */
54-
public function getLastGeneratedValue(): int|string|bool|null;
49+
/** Get last generated value */
50+
public function getLastGeneratedValue(): string|int|false|null;
5551
}

src/Adapter/Driver/Pdo/AbstractPdo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function formatParameterName(string|int $name, ?string $type = null): str
161161
* {@inheritDoc}
162162
*/
163163
#[Override]
164-
public function getLastGeneratedValue(?string $name = null): int|string|bool|null
164+
public function getLastGeneratedValue(?string $name = null): string|int|false|null
165165
{
166166
return $this->connection->getLastGeneratedValue($name);
167167
}

src/Adapter/Driver/Pdo/Result.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ class Result implements Iterator, ResultInterface
7878
*/
7979
protected $position = -1;
8080

81-
/** @var mixed */
81+
/** @var string|int|false|null */
8282
protected $generatedValue;
8383

8484
protected Closure|int $rowCount;
8585

8686
/**
8787
* Initialize
8888
*
89-
* @param mixed $generatedValue
89+
* @param string|int|false|null $generatedValue
9090
*/
9191
public function initialize(
9292
PDOStatement $resource,
@@ -287,7 +287,7 @@ public function getAffectedRows(): int
287287
}
288288

289289
#[Override]
290-
public function getGeneratedValue(): mixed
290+
public function getGeneratedValue(): string|int|false|null
291291
{
292292
return $this->generatedValue;
293293
}

src/Adapter/Driver/ResultInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getAffectedRows(): int;
3434
/**
3535
* Get generated value
3636
*/
37-
public function getGeneratedValue(): mixed;
37+
public function getGeneratedValue(): string|int|false|null;
3838

3939
/**
4040
* Get the resource

0 commit comments

Comments
 (0)