Skip to content

Commit dc3f912

Browse files
committed
cs nullable typehints
1 parent 5d40430 commit dc3f912

26 files changed

+54
-54
lines changed

src/Application/ErrorPresenter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class ErrorPresenter implements Application\IPresenter
2626
private $logger;
2727

2828

29-
public function __construct(ILogger $logger = null)
29+
public function __construct(?ILogger $logger = null)
3030
{
3131
$this->logger = $logger;
3232
}

src/Application/LinkGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class LinkGenerator
3131
private $presenterFactory;
3232

3333

34-
public function __construct(Router $router, UrlScript $refUrl, IPresenterFactory $presenterFactory = null)
34+
public function __construct(Router $router, UrlScript $refUrl, ?IPresenterFactory $presenterFactory = null)
3535
{
3636
$this->router = $router;
3737
$this->refUrl = $refUrl;

src/Application/MicroPresenter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ final class MicroPresenter implements Application\IPresenter
3838

3939

4040
public function __construct(
41-
Nette\DI\Container $context = null,
42-
Http\IRequest $httpRequest = null,
43-
Router $router = null
41+
?Nette\DI\Container $context = null,
42+
?Http\IRequest $httpRequest = null,
43+
?Router $router = null
4444
) {
4545
$this->context = $context;
4646
$this->httpRequest = $httpRequest;
@@ -124,7 +124,7 @@ public function run(Application\Request $request): Application\Response
124124
/**
125125
* Template factory.
126126
*/
127-
public function createTemplate(string $class = null, callable $latteFactory = null): Application\UI\Template
127+
public function createTemplate(?string $class = null, ?callable $latteFactory = null): Application\UI\Template
128128
{
129129
$latte = $latteFactory
130130
? $latteFactory()

src/Application/PresenterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PresenterFactory implements IPresenterFactory
3535
/**
3636
* @param callable(string): IPresenter $factory
3737
*/
38-
public function __construct(callable $factory = null)
38+
public function __construct(?callable $factory = null)
3939
{
4040
$this->factory = $factory ?: function (string $class): IPresenter { return new $class; };
4141
}

src/Application/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ final class Request
6161
*/
6262
public function __construct(
6363
string $name,
64-
string $method = null,
64+
?string $method = null,
6565
array $params = [],
6666
array $post = [],
6767
array $files = [],
@@ -142,7 +142,7 @@ public function setPost(array $params)
142142
* If no key is passed, returns the entire array.
143143
* @return mixed
144144
*/
145-
public function getPost(string $key = null)
145+
public function getPost(?string $key = null)
146146
{
147147
return func_num_args() === 0
148148
? $this->post

src/Application/Responses/FileResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ final class FileResponse implements Nette\Application\Response
3737

3838
public function __construct(
3939
string $file,
40-
string $name = null,
41-
string $contentType = null,
40+
?string $name = null,
41+
?string $contentType = null,
4242
bool $forceDownload = true
4343
) {
4444
if (!is_file($file) || !is_readable($file)) {

src/Application/Responses/JsonResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class JsonResponse implements Nette\Application\Response
2626
private $contentType;
2727

2828

29-
public function __construct($payload, string $contentType = null)
29+
public function __construct($payload, ?string $contentType = null)
3030
{
3131
$this->payload = $payload;
3232
$this->contentType = $contentType ?: 'application/json';

src/Application/Routers/RouteList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RouteList extends Nette\Routing\RouteList implements Nette\Routing\Router,
2323
private $module;
2424

2525

26-
public function __construct(string $module = null)
26+
public function __construct(?string $module = null)
2727
{
2828
parent::__construct();
2929
$this->module = $module ? $module . ':' : null;

src/Application/UI/Component.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public function lazyLink(string $destination, $args = []): Link
289289
* @param array|mixed $args
290290
* @throws InvalidLinkException
291291
*/
292-
public function isLinkCurrent(string $destination = null, $args = []): bool
292+
public function isLinkCurrent(?string $destination = null, $args = []): bool
293293
{
294294
if ($destination !== null) {
295295
$args = func_num_args() < 3 && is_array($args)

src/Application/UI/ComponentReflection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class ComponentReflection extends \ReflectionClass
3636
* Returns array of classes persistent parameters. They have public visibility,
3737
* are non-static and have annotation @persistent.
3838
*/
39-
public function getPersistentParams(string $class = null): array
39+
public function getPersistentParams(?string $class = null): array
4040
{
4141
$class = $class ?? $this->getName();
4242
$params = &self::$ppCache[$class];
@@ -75,7 +75,7 @@ public function getPersistentParams(string $class = null): array
7575
}
7676

7777

78-
public function getPersistentComponents(string $class = null): array
78+
public function getPersistentComponents(?string $class = null): array
7979
{
8080
$class = $class ?? $this->getName();
8181
$components = &self::$pcCache[$class];

0 commit comments

Comments
 (0)