Skip to content

Commit 3425b60

Browse files
authored
Merge pull request #33 from Usuyuki/php81
Add #[\ReturnTypeWillChange] for PHP 8.1 support
2 parents 3be4c68 + a8b60ef commit 3425b60

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/FakePdoStatementTrait.php

+2
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ public function rowCount() : int
331331
* @param int $cursor_orientation
332332
* @param int $cursor_offset
333333
*/
334+
#[\ReturnTypeWillChange]
334335
public function fetch(
335336
$fetch_style = -123,
336337
$cursor_orientation = \PDO::FETCH_ORI_NEXT,
@@ -391,6 +392,7 @@ public function fetch(
391392
* @param int $column
392393
* @return null|scalar
393394
*/
395+
#[\ReturnTypeWillChange]
394396
public function fetchColumn($column = 0)
395397
{
396398
/** @var array<int, scalar>|false $row */

src/FakePdoTrait.php

+7
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function __construct(string $dsn, string $username = '', string $passwd =
6363
$this->server = Server::getOrCreate('primary');
6464
}
6565

66+
#[\ReturnTypeWillChange]
6667
public function setAttribute($key, $value)
6768
{
6869
if ($key === \PDO::ATTR_EMULATE_PREPARES) {
@@ -132,6 +133,7 @@ public function useStrictMode() : bool
132133
return $this->strict_mode;
133134
}
134135

136+
#[\ReturnTypeWillChange]
135137
public function beginTransaction()
136138
{
137139
if (Server::hasSnapshot('transaction')) {
@@ -142,11 +144,13 @@ public function beginTransaction()
142144
return true;
143145
}
144146

147+
#[\ReturnTypeWillChange]
145148
public function commit()
146149
{
147150
return Server::deleteSnapshot('transaction');
148151
}
149152

153+
#[\ReturnTypeWillChange]
150154
public function rollback()
151155
{
152156
if (!Server::hasSnapshot('transaction')) {
@@ -157,6 +161,7 @@ public function rollback()
157161
return true;
158162
}
159163

164+
#[\ReturnTypeWillChange]
160165
public function inTransaction()
161166
{
162167
return Server::hasSnapshot('transaction');
@@ -166,6 +171,7 @@ public function inTransaction()
166171
* @param string $statement
167172
* @return int|false
168173
*/
174+
#[\ReturnTypeWillChange]
169175
public function exec($statement)
170176
{
171177
$statement = trim($statement);
@@ -188,6 +194,7 @@ public function exec($statement)
188194
* @param int $parameter_type
189195
* @return string
190196
*/
197+
#[\ReturnTypeWillChange]
191198
public function quote($string, $parameter_type = \PDO::PARAM_STR)
192199
{
193200
// @see https://github.com/php/php-src/blob/php-8.0.2/ext/mysqlnd/mysqlnd_charset.c#L860-L878

src/Php8/FakePdo.php

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class FakePdo extends PDO implements FakePdoInterface
1414
* @param array $options
1515
* @return FakePdoStatement
1616
*/
17+
#[\ReturnTypeWillChange]
1718
public function prepare($statement, array $options = [])
1819
{
1920
return new FakePdoStatement($this, $statement, $this->real);
@@ -25,6 +26,7 @@ public function prepare($statement, array $options = [])
2526
* @param mixed ...$fetchModeArgs
2627
* @return FakePdoStatement
2728
*/
29+
#[\ReturnTypeWillChange]
2830
public function query(string $statement, ?int $mode = PDO::ATTR_DEFAULT_FETCH_MODE, mixed ...$fetchModeArgs)
2931
{
3032
$sth = $this->prepare($statement);

src/Php8/FakePdoStatement.php

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class FakePdoStatement extends \PDOStatement
1010
* @param ?array $params
1111
* @return bool
1212
*/
13+
#[\ReturnTypeWillChange]
1314
public function execute(?array $params = null)
1415
{
1516
return $this->universalExecute($params);
@@ -41,6 +42,7 @@ public function setFetchMode(int $mode, ...$args) : bool
4142
* @param array|null $ctorArgs
4243
* @return false|T
4344
*/
45+
#[\ReturnTypeWillChange]
4446
public function fetchObject(?string $class = \stdClass::class, ?array $ctorArgs = null)
4547
{
4648
return $this->universalFetchObject($class, $ctorArgs);

0 commit comments

Comments
 (0)