@@ -122,7 +122,7 @@ public function configureSchema(Schema $schema, Connection $forConnection): void
122
122
/**
123
123
* {@inheritdoc}
124
124
*/
125
- public function prune ()
125
+ public function prune (): bool
126
126
{
127
127
$ deleteSql = "DELETE FROM $ this ->table WHERE $ this ->lifetimeCol + $ this ->timeCol <= ? " ;
128
128
$ params = [time ()];
@@ -145,7 +145,7 @@ public function prune()
145
145
/**
146
146
* {@inheritdoc}
147
147
*/
148
- protected function doFetch (array $ ids )
148
+ protected function doFetch (array $ ids ): iterable
149
149
{
150
150
$ now = time ();
151
151
$ expired = [];
@@ -182,7 +182,7 @@ protected function doFetch(array $ids)
182
182
/**
183
183
* {@inheritdoc}
184
184
*/
185
- protected function doHave (string $ id )
185
+ protected function doHave (string $ id ): bool
186
186
{
187
187
$ sql = "SELECT 1 FROM $ this ->table WHERE $ this ->idCol = ? AND ( $ this ->lifetimeCol IS NULL OR $ this ->lifetimeCol + $ this ->timeCol > ?) " ;
188
188
$ result = $ this ->conn ->executeQuery ($ sql , [
@@ -199,7 +199,7 @@ protected function doHave(string $id)
199
199
/**
200
200
* {@inheritdoc}
201
201
*/
202
- protected function doClear (string $ namespace )
202
+ protected function doClear (string $ namespace ): bool
203
203
{
204
204
if ('' === $ namespace ) {
205
205
if ('sqlite ' === $ this ->getPlatformName ()) {
@@ -222,7 +222,7 @@ protected function doClear(string $namespace)
222
222
/**
223
223
* {@inheritdoc}
224
224
*/
225
- protected function doDelete (array $ ids )
225
+ protected function doDelete (array $ ids ): bool
226
226
{
227
227
$ sql = str_pad ('' , (\count ($ ids ) << 1 ) - 1 , '?, ' );
228
228
$ sql = "DELETE FROM $ this ->table WHERE $ this ->idCol IN ( $ sql) " ;
@@ -335,6 +335,11 @@ protected function doSave(array $values, int $lifetime)
335
335
return $ failed ;
336
336
}
337
337
338
+ /**
339
+ * Compatible with in doctrine/dbal ^2.13 and ^3.0.
340
+ *
341
+ * @psalm-suppress UndefinedClass
342
+ */
338
343
private function getPlatformName (): string
339
344
{
340
345
if (isset ($ this ->platformName )) {
@@ -348,8 +353,6 @@ private function getPlatformName(): string
348
353
case $ driver instanceof \Doctrine \DBAL \Driver \AbstractMySQLDriver:
349
354
return $ this ->platformName = 'mysql ' ;
350
355
351
- // Class exists in doctrine/dbal v2.13
352
- // @psalm-suppress UndefinedClass
353
356
case $ driver instanceof \Doctrine \DBAL \Driver \PDOSqlite \Driver:
354
357
case $ driver instanceof \Doctrine \DBAL \Driver \PDO \SQLite \Driver:
355
358
return $ this ->platformName = 'sqlite ' ;
0 commit comments