Skip to content

Commit f187118

Browse files
committed
improved phpDoc
1 parent 5388c34 commit f187118

9 files changed

Lines changed: 21 additions & 4 deletions

File tree

src/Bridges/CacheLatte/Runtime.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function initialize(Latte\Runtime\Template $template): void
4545

4646
/**
4747
* Starts the output cache. Returns true if buffering was started.
48+
* @param array<string, mixed>|null $args {if?: bool, tags?: string[], expire?: string, expiration?: string, dependencies?: callable}
4849
*/
4950
public function createCache(string $key, ?array $args = null): bool
5051
{

src/Bridges/Psr/PsrCacheAdapter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function setMultiple(iterable $values, null|int|DateInterval $ttl = null)
8181
}
8282

8383

84+
/** @param iterable<string> $keys */
8485
public function deleteMultiple(iterable $keys): bool
8586
{
8687
foreach ($keys as $value) {

src/Caching/BulkReader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ interface BulkReader
1717
{
1818
/**
1919
* Reads from cache in bulk.
20-
* @return array key => value pairs, missing items are omitted
20+
* @param string[] $keys
21+
* @return array<string, mixed> key => value pairs, missing items are omitted
2122
*/
2223
function bulkRead(array $keys): array;
2324
}

src/Caching/BulkWriter.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ interface BulkWriter
1717
{
1818
/**
1919
* Writes to cache in bulk.
20-
* @param array{string, mixed} $items
20+
* @param array<string, mixed> $items
21+
* @param array<string, mixed> $dependencies
2122
*/
2223
function bulkWrite(array $items, array $dependencies): void;
2324

2425
/**
25-
* Removes multiple items from cache
26+
* Removes multiple items from cache.
27+
* @param string[] $keys
2628
*/
2729
function bulkRemove(array $keys): void;
2830
}

src/Caching/OutputHelper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
class OutputHelper
1919
{
20+
/** @var array<string, mixed> */
2021
public array $dependencies = [];
2122

2223

@@ -30,6 +31,7 @@ public function __construct(
3031

3132
/**
3233
* Stops and saves the cache.
34+
* @param array<string, mixed> $dependencies
3335
*/
3436
public function end(array $dependencies = []): void
3537
{

src/Caching/Storage.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function lock(string $key): void;
2828

2929
/**
3030
* Writes item into the cache.
31+
* @param array<string, mixed> $dependencies
3132
*/
3233
function write(string $key, $data, array $dependencies): void;
3334

@@ -38,6 +39,7 @@ function remove(string $key): void;
3839

3940
/**
4041
* Removes items from the cache by conditions.
42+
* @param array<string, mixed> $conditions
4143
*/
4244
function clean(array $conditions): void;
4345
}

src/Caching/Storages/FileStorage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class FileStorage implements Nette\Caching\Storage
5252

5353
private string $dir;
5454
private ?Journal $journal;
55+
56+
/** @var array<string, resource> key => file handle */
5557
private array $locks;
5658

5759

@@ -136,6 +138,7 @@ public function lock(string $key): void
136138
}
137139

138140

141+
/** @param array<string, mixed> $dp */
139142
public function write(string $key, $data, array $dp): void
140143
{
141144
$meta = [
@@ -224,6 +227,7 @@ public function remove(string $key): void
224227
}
225228

226229

230+
/** @param array<string, mixed> $conditions */
227231
public function clean(array $conditions): void
228232
{
229233
$all = !empty($conditions[Cache::All]);
@@ -293,6 +297,7 @@ public function clean(array $conditions): void
293297

294298
/**
295299
* Reads cache data from disk.
300+
* @return array<string, mixed>|null meta data with 'file' and 'handle' keys added, or null if not found
296301
*/
297302
protected function readMetaAndLock(string $file, int $lock): ?array
298303
{

src/Caching/Storages/Journal.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ interface Journal
1717
{
1818
/**
1919
* Writes entry information into the journal.
20+
* @param array<string, mixed> $dependencies {Cache::Tags => string[], Cache::Priority => int}
2021
*/
2122
function write(string $key, array $dependencies): void;
2223

2324
/**
2425
* Cleans entries from journal.
25-
* @return array|null of removed items or null when performing a full cleanup
26+
* @param array<string, mixed> $conditions {Cache::Tags => string[], Cache::Priority => int, Cache::All => bool}
27+
* @return string[]|null array of removed keys or null when performing a full cleanup
2628
*/
2729
function clean(array $conditions): ?array;
2830
}

src/Caching/Storages/MemoryStorage.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
class MemoryStorage implements Nette\Caching\Storage
1919
{
20+
/** @var array<string, mixed> key => cached value */
2021
private array $data = [];
2122

2223

0 commit comments

Comments
 (0)