Skip to content

Commit 64934aa

Browse files
committed
added property typehints
1 parent f66b8f9 commit 64934aa

File tree

11 files changed

+22
-39
lines changed

11 files changed

+22
-39
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ class Cache
3636
/** @internal */
3737
public const NAMESPACE_SEPARATOR = "\x00";
3838

39-
/** @var Storage */
40-
private $storage;
39+
private Storage $storage;
4140

42-
/** @var string */
43-
private $namespace;
41+
private string $namespace;
4442

4543

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

src/Caching/OutputHelper.php

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

22-
/** @var array */
23-
public $dependencies = [];
22+
public array $dependencies = [];
2423

25-
/** @var Cache|null */
26-
private $cache;
24+
private ?Cache $cache;
2725

28-
/** @var string */
29-
private $key;
26+
private mixed $key;
3027

3128

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

src/Caching/Storages/FileStorage.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,17 @@ 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;
5555

56-
/** @var string */
57-
private $dir;
56+
private string $dir;
5857

59-
/** @var Journal */
60-
private $journal;
58+
private ?Journal $journal;
6159

62-
/** @var array */
63-
private $locks;
60+
private array $locks;
6461

6562

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

src/Caching/Storages/MemcachedStorage.php

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

29-
/** @var \Memcached */
30-
private $memcached;
29+
private \Memcached $memcached;
3130

32-
/** @var string */
33-
private $prefix;
31+
private string $prefix;
3432

35-
/** @var Journal */
36-
private $journal;
33+
private ?Journal $journal;
3734

3835

3936
/**

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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ class SQLiteJournal implements Journal
2323
/** @string */
2424
private $path;
2525

26-
/** @var \PDO */
27-
private $pdo;
26+
private \PDO $pdo;
2827

2928

3029
public function __construct(string $path)
@@ -66,7 +65,7 @@ private function open(): void
6665

6766
public function write(string $key, array $dependencies): void
6867
{
69-
if (!$this->pdo) {
68+
if (!isset($this->pdo)) {
7069
$this->open();
7170
}
7271

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

9695
public function clean(array $conditions): ?array
9796
{
98-
if (!$this->pdo) {
97+
if (!isset($this->pdo)) {
9998
$this->open();
10099
}
101100

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)