Skip to content

Commit e93d2e3

Browse files
committed
strict type fixes
1 parent 70d22b1 commit e93d2e3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/Caching/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public function start($key)
323323
*/
324324
protected function generateKey($key)
325325
{
326-
return $this->namespace . md5(is_scalar($key) ? $key : serialize($key));
326+
return $this->namespace . md5(is_scalar($key) ? (string) $key : serialize($key));
327327
}
328328

329329

tests/Storages/FileStorage.sliding.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $cache->save($key, $value, [
2525
]);
2626

2727

28-
for ($i = 0; $i < 5; $i++) {
28+
for ($i = '0'; $i < '5'; $i++) {
2929
// Sleeping 1 second
3030
sleep(1);
3131
clearstatcache();

tests/Storages/FileStorage.stress.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Test: Nette\Caching\Storages\FileStorage sliding expiration test.
4+
* Test: Nette\Caching\Storages\FileStorage atomicity test.
55
* @multiple 5
66
*/
77

@@ -36,25 +36,25 @@ $storage = new FileStorage(TEMP_DIR);
3636

3737
// clear playground
3838
for ($i = 0; $i <= COUNT_FILES; $i++) {
39-
$storage->write($i, randomStr(), []);
39+
$storage->write((string) $i, randomStr(), []);
4040
}
4141

4242

4343
// test loop
4444
$hits = ['ok' => 0, 'notfound' => 0, 'error' => 0, 'cantwrite' => 0, 'cantdelete' => 0];
4545
for ($counter = 0; $counter < 1000; $counter++) {
4646
// write
47-
$ok = $storage->write(rand(0, COUNT_FILES), randomStr(), []);
47+
$ok = $storage->write((string) rand(0, COUNT_FILES), randomStr(), []);
4848
if ($ok === FALSE) {
4949
$hits['cantwrite']++;
5050
}
5151

5252
// remove
53-
//$ok = $storage->remove(rand(0, COUNT_FILES));
53+
//$ok = $storage->remove((string) rand(0, COUNT_FILES));
5454
//if (!$ok) $hits['cantdelete']++;
5555

5656
// read
57-
$res = $storage->read(rand(0, COUNT_FILES));
57+
$res = $storage->read((string) rand(0, COUNT_FILES));
5858

5959
// compare
6060
if ($res === NULL) {

0 commit comments

Comments
 (0)