@@ -43,7 +43,7 @@ class Cache
43
43
private $ namespace ;
44
44
45
45
46
- public function __construct (Storage $ storage , string $ namespace = null )
46
+ public function __construct (Storage $ storage , ? string $ namespace = null )
47
47
{
48
48
$ this ->storage = $ storage ;
49
49
$ this ->namespace = $ namespace . self ::NAMESPACE_SEPARATOR ;
@@ -83,7 +83,7 @@ public function derive(string $namespace)
83
83
* @param mixed $key
84
84
* @return mixed
85
85
*/
86
- public function load ($ key , callable $ generator = null )
86
+ public function load ($ key , ? callable $ generator = null )
87
87
{
88
88
$ storageKey = $ this ->generateKey ($ key );
89
89
$ data = $ this ->storage ->read ($ storageKey );
@@ -106,7 +106,7 @@ public function load($key, callable $generator = null)
106
106
/**
107
107
* Reads multiple items from the cache.
108
108
*/
109
- public function bulkLoad (array $ keys , callable $ generator = null ): array
109
+ public function bulkLoad (array $ keys , ? callable $ generator = null ): array
110
110
{
111
111
if (count ($ keys ) === 0 ) {
112
112
return [];
@@ -169,7 +169,7 @@ public function bulkLoad(array $keys, callable $generator = null): array
169
169
* @return mixed value itself
170
170
* @throws Nette\InvalidArgumentException
171
171
*/
172
- public function save ($ key , $ data , array $ dependencies = null )
172
+ public function save ($ key , $ data , ? array $ dependencies = null )
173
173
{
174
174
$ key = $ this ->generateKey ($ key );
175
175
@@ -263,7 +263,7 @@ public function remove($key): void
263
263
* - Cache::TAGS => (array) tags
264
264
* - Cache::ALL => true
265
265
*/
266
- public function clean (array $ conditions = null ): void
266
+ public function clean (? array $ conditions = null ): void
267
267
{
268
268
$ conditions = (array ) $ conditions ;
269
269
if (isset ($ conditions [self ::TAGS ])) {
@@ -294,7 +294,7 @@ public function call(callable $function)
294
294
/**
295
295
* Caches results of function/method calls.
296
296
*/
297
- public function wrap (callable $ function , array $ dependencies = null ): \Closure
297
+ public function wrap (callable $ function , ? array $ dependencies = null ): \Closure
298
298
{
299
299
return function () use ($ function , $ dependencies ) {
300
300
$ key = [$ function , $ args = func_get_args ()];
0 commit comments