Skip to content

Commit 6a587b8

Browse files
committed
Fix tests
1 parent 4ecb9f4 commit 6a587b8

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function configureSchema(Schema $schema, Connection $forConnection): void
122122
/**
123123
* {@inheritdoc}
124124
*/
125-
public function prune()
125+
public function prune(): bool
126126
{
127127
$deleteSql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol <= ?";
128128
$params = [time()];
@@ -145,7 +145,7 @@ public function prune()
145145
/**
146146
* {@inheritdoc}
147147
*/
148-
protected function doFetch(array $ids)
148+
protected function doFetch(array $ids): iterable
149149
{
150150
$now = time();
151151
$expired = [];
@@ -182,7 +182,7 @@ protected function doFetch(array $ids)
182182
/**
183183
* {@inheritdoc}
184184
*/
185-
protected function doHave(string $id)
185+
protected function doHave(string $id): bool
186186
{
187187
$sql = "SELECT 1 FROM $this->table WHERE $this->idCol = ? AND ($this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > ?)";
188188
$result = $this->conn->executeQuery($sql, [
@@ -199,7 +199,7 @@ protected function doHave(string $id)
199199
/**
200200
* {@inheritdoc}
201201
*/
202-
protected function doClear(string $namespace)
202+
protected function doClear(string $namespace): bool
203203
{
204204
if ('' === $namespace) {
205205
if ('sqlite' === $this->getPlatformName()) {
@@ -222,7 +222,7 @@ protected function doClear(string $namespace)
222222
/**
223223
* {@inheritdoc}
224224
*/
225-
protected function doDelete(array $ids)
225+
protected function doDelete(array $ids): bool
226226
{
227227
$sql = str_pad('', (\count($ids) << 1) - 1, '?,');
228228
$sql = "DELETE FROM $this->table WHERE $this->idCol IN ($sql)";
@@ -335,6 +335,11 @@ protected function doSave(array $values, int $lifetime)
335335
return $failed;
336336
}
337337

338+
/**
339+
* Compatible with in doctrine/dbal ^2.13 and ^3.0.
340+
*
341+
* @psalm-suppress UndefinedClass
342+
*/
338343
private function getPlatformName(): string
339344
{
340345
if (isset($this->platformName)) {
@@ -348,8 +353,6 @@ private function getPlatformName(): string
348353
case $driver instanceof \Doctrine\DBAL\Driver\AbstractMySQLDriver:
349354
return $this->platformName = 'mysql';
350355

351-
// Class exists in doctrine/dbal v2.13
352-
// @psalm-suppress UndefinedClass
353356
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver:
354357
case $driver instanceof \Doctrine\DBAL\Driver\PDO\SQLite\Driver:
355358
return $this->platformName = 'sqlite';

src/Symfony/Component/Cache/LockRegistry.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ final class LockRegistry
4343
__DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'CouchbaseCollectionAdapter.php',
4444
__DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'DoctrineAdapter.php',
4545
__DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'DoctrineDbalAdapter.php',
46+
__DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'DoctrineSchemaConfiguratorInterface.php',
4647
__DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'FilesystemAdapter.php',
4748
__DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'FilesystemTagAwareAdapter.php',
4849
__DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'MemcachedAdapter.php',

0 commit comments

Comments
 (0)