Skip to content

Commit 295bda5

Browse files
committed
cs nullable typehints
1 parent 8bec295 commit 295bda5

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/Bridges/CacheLatte/CacheMacro.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static function createCache(
108108
Nette\Caching\Storage $cacheStorage,
109109
string $key,
110110
?array &$parents,
111-
array $args = null
111+
?array $args = null
112112
) {
113113
if ($args) {
114114
if (array_key_exists('if', $args) && !$args['if']) {
@@ -135,7 +135,7 @@ public static function createCache(
135135
* Ends the output cache.
136136
* @param Nette\Caching\OutputHelper[] $parents
137137
*/
138-
public static function endCache(array &$parents, array $args = null): void
138+
public static function endCache(array &$parents, ?array $args = null): void
139139
{
140140
$helper = array_pop($parents);
141141
if (!$helper instanceof Nette\Caching\OutputHelper) {

src/Caching/Cache.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Cache
4343
private $namespace;
4444

4545

46-
public function __construct(Storage $storage, string $namespace = null)
46+
public function __construct(Storage $storage, ?string $namespace = null)
4747
{
4848
$this->storage = $storage;
4949
$this->namespace = $namespace . self::NAMESPACE_SEPARATOR;
@@ -83,7 +83,7 @@ public function derive(string $namespace)
8383
* @param mixed $key
8484
* @return mixed
8585
*/
86-
public function load($key, callable $generator = null)
86+
public function load($key, ?callable $generator = null)
8787
{
8888
$storageKey = $this->generateKey($key);
8989
$data = $this->storage->read($storageKey);
@@ -106,7 +106,7 @@ public function load($key, callable $generator = null)
106106
/**
107107
* Reads multiple items from the cache.
108108
*/
109-
public function bulkLoad(array $keys, callable $generator = null): array
109+
public function bulkLoad(array $keys, ?callable $generator = null): array
110110
{
111111
if (count($keys) === 0) {
112112
return [];
@@ -169,7 +169,7 @@ public function bulkLoad(array $keys, callable $generator = null): array
169169
* @return mixed value itself
170170
* @throws Nette\InvalidArgumentException
171171
*/
172-
public function save($key, $data, array $dependencies = null)
172+
public function save($key, $data, ?array $dependencies = null)
173173
{
174174
$key = $this->generateKey($key);
175175

@@ -263,7 +263,7 @@ public function remove($key): void
263263
* - Cache::TAGS => (array) tags
264264
* - Cache::ALL => true
265265
*/
266-
public function clean(array $conditions = null): void
266+
public function clean(?array $conditions = null): void
267267
{
268268
$conditions = (array) $conditions;
269269
if (isset($conditions[self::TAGS])) {
@@ -294,7 +294,7 @@ public function call(callable $function)
294294
/**
295295
* Caches results of function/method calls.
296296
*/
297-
public function wrap(callable $function, array $dependencies = null): \Closure
297+
public function wrap(callable $function, ?array $dependencies = null): \Closure
298298
{
299299
return function () use ($function, $dependencies) {
300300
$key = [$function, $args = func_get_args()];

src/Caching/Storages/FileStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class FileStorage implements Nette\Caching\Storage
6363
private $locks;
6464

6565

66-
public function __construct(string $dir, Journal $journal = null)
66+
public function __construct(string $dir, ?Journal $journal = null)
6767
{
6868
if (!is_dir($dir)) {
6969
throw new Nette\DirectoryNotFoundException("Directory '$dir' not found.");

src/Caching/Storages/MemcachedStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(
4949
string $host = 'localhost',
5050
int $port = 11211,
5151
string $prefix = '',
52-
Journal $journal = null
52+
?Journal $journal = null
5353
) {
5454
if (!static::isAvailable()) {
5555
throw new Nette\NotSupportedException("PHP extension 'memcached' is not loaded.");

0 commit comments

Comments
 (0)