Skip to content

Commit 82b622f

Browse files
committed
added property typehints
1 parent e6fcf78 commit 82b622f

File tree

11 files changed

+22
-48
lines changed

11 files changed

+22
-48
lines changed

src/Bridges/CacheDI/CacheExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
*/
1818
final class CacheExtension extends Nette\DI\CompilerExtension
1919
{
20-
/** @var string */
21-
private $tempDir;
20+
private string $tempDir;
2221

2322

2423
public function __construct(string $tempDir)

src/Bridges/CacheLatte/CacheMacro.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ final class CacheMacro implements Latte\IMacro
2121
{
2222
use Nette\SmartObject;
2323

24-
/** @var bool */
25-
private $used;
24+
private bool $used;
2625

2726

2827
/**

src/Caching/Cache.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,8 @@ class Cache
5050
NamespaceSeparator = "\x00",
5151
NAMESPACE_SEPARATOR = self::NamespaceSeparator;
5252

53-
/** @var Storage */
54-
private $storage;
55-
56-
/** @var string */
57-
private $namespace;
53+
private Storage $storage;
54+
private string $namespace;
5855

5956

6057
public function __construct(Storage $storage, ?string $namespace = null)

src/Caching/OutputHelper.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,9 @@ class OutputHelper
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var array */
23-
public $dependencies = [];
24-
25-
/** @var Cache|null */
26-
private $cache;
27-
28-
/** @var string */
29-
private $key;
22+
public array $dependencies = [];
23+
private ?Cache $cache;
24+
private mixed $key;
3025

3126

3227
public function __construct(Cache $cache, $key)

src/Caching/Storages/FileStorage.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,14 @@ class FileStorage implements Nette\Caching\Storage
4747
File = 'file',
4848
Handle = 'handle';
4949

50-
/** @var float probability that the clean() routine is started */
51-
public static $gcProbability = 0.001;
50+
/** probability that the clean() routine is started */
51+
public static float $gcProbability = 0.001;
5252

5353
/** @deprecated */
5454
public static $useDirectories = true;
55-
56-
/** @var string */
57-
private $dir;
58-
59-
/** @var Journal */
60-
private $journal;
61-
62-
/** @var array */
63-
private $locks;
55+
private string $dir;
56+
private ?Journal $journal;
57+
private array $locks;
6458

6559

6660
public function __construct(string $dir, ?Journal $journal = null)

src/Caching/Storages/MemcachedStorage.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,9 @@ class MemcachedStorage implements Nette\Caching\Storage, Nette\Caching\BulkReade
2626
MetaData = 'data',
2727
MetaDelta = 'delta';
2828

29-
/** @var \Memcached */
30-
private $memcached;
31-
32-
/** @var string */
33-
private $prefix;
34-
35-
/** @var Journal */
36-
private $journal;
29+
private \Memcached $memcached;
30+
private string $prefix;
31+
private ?Journal $journal;
3732

3833

3934
/**

src/Caching/Storages/MemoryStorage.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class MemoryStorage implements Nette\Caching\Storage
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var array */
23-
private $data = [];
22+
private array $data = [];
2423

2524

2625
public function read(string $key)

src/Caching/Storages/SQLiteJournal.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ class SQLiteJournal implements Journal
2222

2323
/** @string */
2424
private $path;
25-
26-
/** @var \PDO */
27-
private $pdo;
25+
private \PDO $pdo;
2826

2927

3028
public function __construct(string $path)
@@ -67,7 +65,7 @@ private function open(): void
6765

6866
public function write(string $key, array $dependencies): void
6967
{
70-
if (!$this->pdo) {
68+
if (!isset($this->pdo)) {
7169
$this->open();
7270
}
7371

@@ -96,7 +94,7 @@ public function write(string $key, array $dependencies): void
9694

9795
public function clean(array $conditions): ?array
9896
{
99-
if (!$this->pdo) {
97+
if (!isset($this->pdo)) {
10098
$this->open();
10199
}
102100

src/Caching/Storages/SQLiteStorage.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class SQLiteStorage implements Nette\Caching\Storage, Nette\Caching\BulkReader
2020
{
2121
use Nette\SmartObject;
2222

23-
/** @var \PDO */
24-
private $pdo;
23+
private \PDO $pdo;
2524

2625

2726
public function __construct(string $path)

tests/Caching/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class TestStorage implements IStorage
99
{
10-
private $data = [];
10+
private array $data = [];
1111

1212

1313
public function read(string $key)

0 commit comments

Comments
 (0)