Skip to content

Commit b0dc7c5

Browse files
committed
added property typehints
1 parent e2c471f commit b0dc7c5

34 files changed

+130
-234
lines changed

src/Application/Application.php

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ class Application
2121
{
2222
use Nette\SmartObject;
2323

24-
/** @var int */
25-
public $maxLoop = 20;
24+
public int $maxLoop = 20;
2625

27-
/** @var bool enable fault barrier? */
28-
public $catchExceptions;
26+
/** enable fault barrier? */
27+
public bool $catchExceptions = false;
2928

30-
/** @var string|null */
31-
public $errorPresenter;
29+
public ?string $errorPresenter = null;
3230

3331
/** @var array<callable(self): void> Occurs before the application loads presenter */
3432
public $onStartup = [];
@@ -49,22 +47,17 @@ class Application
4947
public $onError = [];
5048

5149
/** @var Request[] */
52-
private $requests = [];
50+
private array $requests = [];
5351

54-
/** @var IPresenter|null */
55-
private $presenter;
52+
private ?IPresenter $presenter = null;
5653

57-
/** @var Nette\Http\IRequest */
58-
private $httpRequest;
54+
private Nette\Http\IRequest $httpRequest;
5955

60-
/** @var Nette\Http\IResponse */
61-
private $httpResponse;
56+
private Nette\Http\IResponse $httpResponse;
6257

63-
/** @var IPresenterFactory */
64-
private $presenterFactory;
58+
private IPresenterFactory $presenterFactory;
6559

66-
/** @var Router */
67-
private $router;
60+
private Router $router;
6861

6962

7063
public function __construct(

src/Application/ErrorPresenter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ final class ErrorPresenter implements Application\IPresenter
2222
{
2323
use Nette\SmartObject;
2424

25-
/** @var ILogger|null */
26-
private $logger;
25+
private ?ILogger $logger;
2726

2827

2928
public function __construct(ILogger $logger = null)

src/Application/LinkGenerator.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,11 @@ final class LinkGenerator
2121
{
2222
use Nette\SmartObject;
2323

24-
/** @var Router */
25-
private $router;
24+
private Router $router;
2625

27-
/** @var UrlScript */
28-
private $refUrl;
26+
private UrlScript $refUrl;
2927

30-
/** @var IPresenterFactory|null */
31-
private $presenterFactory;
28+
private ?IPresenterFactory $presenterFactory;
3229

3330

3431
public function __construct(Router $router, UrlScript $refUrl, IPresenterFactory $presenterFactory = null)

src/Application/MicroPresenter.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ final class MicroPresenter implements Application\IPresenter
2424
{
2525
use Nette\SmartObject;
2626

27-
/** @var Nette\DI\Container|null */
28-
private $context;
27+
private ?Nette\DI\Container $context;
2928

30-
/** @var Nette\Http\IRequest|null */
31-
private $httpRequest;
29+
private ?Nette\Http\IRequest $httpRequest;
3230

33-
/** @var Router|null */
34-
private $router;
31+
private ?Router $router;
3532

36-
/** @var Application\Request|null */
37-
private $request;
33+
private ?Application\Request $request;
3834

3935

4036
public function __construct(

src/Application/PresenterFactory.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ class PresenterFactory implements IPresenterFactory
2020
use Nette\SmartObject;
2121

2222
/** @var array[] of module => splited mask */
23-
private $mapping = [
23+
private array $mapping = [
2424
'*' => ['', '*Module\\', '*Presenter'],
2525
'Nette' => ['NetteModule\\', '*\\', '*Presenter'],
2626
];
2727

28-
/** @var array */
29-
private $cache = [];
28+
private array $cache = [];
3029

3130
/** @var callable */
3231
private $factory;

src/Application/Request.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,17 @@ final class Request
3737
/** flag */
3838
public const VARYING = 'varying';
3939

40-
/** @var string|null */
41-
private $method;
40+
private ?string $method;
4241

43-
/** @var array */
44-
private $flags = [];
42+
private array $flags = [];
4543

46-
/** @var string */
47-
private $name;
44+
private string $name;
4845

49-
/** @var array */
50-
private $params;
46+
private array $params;
5147

52-
/** @var array */
53-
private $post;
48+
private array $post;
5449

55-
/** @var array */
56-
private $files;
50+
private array $files;
5751

5852

5953
/**

src/Application/Responses/FileResponse.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,15 @@ final class FileResponse implements Nette\Application\Response
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var bool */
23-
public $resuming = true;
22+
public bool $resuming = true;
2423

25-
/** @var string */
26-
private $file;
24+
private string $file;
2725

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

31-
/** @var string */
32-
private $name;
28+
private string $name;
3329

34-
/** @var bool */
35-
private $forceDownload;
30+
private bool $forceDownload;
3631

3732

3833
public function __construct(

src/Application/Responses/ForwardResponse.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ final class ForwardResponse implements Nette\Application\Response
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var Nette\Application\Request */
23-
private $request;
22+
private Nette\Application\Request $request;
2423

2524

2625
public function __construct(Nette\Application\Request $request)

src/Application/Responses/JsonResponse.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ final class JsonResponse implements Nette\Application\Response
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var mixed */
23-
private $payload;
22+
private mixed $payload;
2423

25-
/** @var string */
26-
private $contentType;
24+
private string $contentType;
2725

2826

2927
public function __construct($payload, string $contentType = null)

src/Application/Responses/RedirectResponse.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ final class RedirectResponse implements Nette\Application\Response
2020
{
2121
use Nette\SmartObject;
2222

23-
/** @var string */
24-
private $url;
23+
private string $url;
2524

26-
/** @var int */
27-
private $httpCode;
25+
private int $httpCode;
2826

2927

3028
public function __construct(string $url, int $httpCode = Http\IResponse::S302_FOUND)

0 commit comments

Comments
 (0)