Skip to content

Commit 14e52b2

Browse files
committed
Update pools
1 parent 089d8a1 commit 14e52b2

3 files changed

Lines changed: 27 additions & 20 deletions

File tree

composer.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Database/Adapter/Pool.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010

1111
class Pool extends Adapter
1212
{
13+
/**
14+
* @var UtopiaPool<covariant Adapter>
15+
*/
1316
protected UtopiaPool $pool;
1417

1518
/**
16-
* @param UtopiaPool $pool The pool to use for connections. Must contain instances of Adapter.
19+
* @param UtopiaPool<covariant Adapter> $pool The pool to use for connections. Must contain instances of Adapter.
1720
* @throws DatabaseException
1821
*/
1922
public function __construct(UtopiaPool $pool)

tests/e2e/Adapter/PoolTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
class PoolTest extends Base
2020
{
2121
public static ?Database $database = null;
22-
protected static ?UtopiaPool $pool = null;
22+
23+
/**
24+
* @var UtopiaPool<MySQL>
25+
*/
26+
protected static UtopiaPool $pool;
2327
protected static string $namespace;
2428

2529
/**
@@ -76,7 +80,7 @@ protected static function deleteColumn(string $collection, string $column): bool
7680
$sql = "ALTER TABLE {$sqlTable} DROP COLUMN `{$column}`";
7781

7882
self::$pool->use(function (Adapter $adapter) use ($sql) {
79-
// Hack to get adapter PDO
83+
// Hack to get adapter PDO reference
8084
$class = new ReflectionClass($adapter);
8185
$property = $class->getProperty('pdo');
8286
$property->setAccessible(true);
@@ -93,7 +97,7 @@ protected static function deleteIndex(string $collection, string $index): bool
9397
$sql = "DROP INDEX `{$index}` ON {$sqlTable}";
9498

9599
self::$pool->use(function (Adapter $adapter) use ($sql) {
96-
// Hack to get adapter PDO
100+
// Hack to get adapter PDO reference
97101
$class = new ReflectionClass($adapter);
98102
$property = $class->getProperty('pdo');
99103
$property->setAccessible(true);

0 commit comments

Comments
 (0)