Skip to content

Commit e87ddcf

Browse files
committed
added property typehints
1 parent d372249 commit e87ddcf

File tree

13 files changed

+71
-121
lines changed

13 files changed

+71
-121
lines changed

src/Bridges/HttpDI/HttpExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
*/
1919
class HttpExtension extends Nette\DI\CompilerExtension
2020
{
21-
/** @var bool */
22-
private $cliMode;
21+
private bool $cliMode;
2322

2423

2524
public function __construct(bool $cliMode = false)

src/Bridges/HttpDI/SessionExtension.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919
*/
2020
class SessionExtension extends Nette\DI\CompilerExtension
2121
{
22-
/** @var bool */
23-
private $debugMode;
22+
private bool $debugMode;
2423

25-
/** @var bool */
26-
private $cliMode;
24+
private bool $cliMode;
2725

2826

2927
public function __construct(bool $debugMode = false, bool $cliMode = false)

src/Http/Context.php

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

22-
/** @var IRequest */
23-
private $request;
22+
private IRequest $request;
2423

25-
/** @var IResponse */
26-
private $response;
24+
private IResponse $response;
2725

2826

2927
public function __construct(IRequest $request, IResponse $response)

src/Http/FileUpload.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,15 @@ final class FileUpload
3030

3131
public const IMAGE_MIME_TYPES = ['image/gif', 'image/png', 'image/jpeg', 'image/webp'];
3232

33-
/** @var string */
34-
private $name;
33+
private string $name;
3534

36-
/** @var string|false|null */
37-
private $type;
35+
private string|false|null $type = null;
3836

39-
/** @var int */
40-
private $size;
37+
private int $size;
4138

42-
/** @var string */
43-
private $tmpName;
39+
private string $tmpName;
4440

45-
/** @var int */
46-
private $error;
41+
private int $error;
4742

4843

4944
public function __construct(?array $value)

src/Http/Request.php

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,23 @@ class Request implements IRequest
3333
{
3434
use Nette\SmartObject;
3535

36-
/** @var string */
37-
private $method;
36+
private string $method;
3837

39-
/** @var UrlScript */
40-
private $url;
38+
private UrlScript $url;
4139

42-
/** @var array */
43-
private $post;
40+
private array $post;
4441

45-
/** @var array */
46-
private $files;
42+
private array $files;
4743

48-
/** @var array */
49-
private $cookies;
44+
private array $cookies;
5045

51-
/** @var array */
52-
private $headers;
46+
private array $headers;
5347

54-
/** @var string|null */
55-
private $remoteAddress;
48+
private ?string $remoteAddress;
5649

57-
/** @var string|null */
58-
private $remoteHost;
50+
private ?string $remoteHost;
5951

60-
/** @var callable|null */
52+
/** @var ?callable */
6153
private $rawBodyCallback;
6254

6355

src/Http/RequestFactory.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,15 @@ class RequestFactory
2323
/** @internal */
2424
private const CHARS = '\x09\x0A\x0D\x20-\x7E\xA0-\x{10FFFF}';
2525

26-
/** @var array */
27-
public $urlFilters = [
26+
public array $urlFilters = [
2827
'path' => ['#/{2,}#' => '/'], // '%20' => ''
2928
'url' => [], // '#[.,)]$#D' => ''
3029
];
3130

32-
/** @var bool */
33-
private $binary = false;
31+
private bool $binary = false;
3432

3533
/** @var string[] */
36-
private $proxies = [];
34+
private array $proxies = [];
3735

3836

3937
/** @return static */

src/Http/Response.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@ final class Response implements IResponse
2222
{
2323
use Nette\SmartObject;
2424

25-
/** @var string The domain in which the cookie will be available */
26-
public $cookieDomain = '';
25+
/** The domain in which the cookie will be available */
26+
public string $cookieDomain = '';
2727

28-
/** @var string The path in which the cookie will be available */
29-
public $cookiePath = '/';
28+
/** The path in which the cookie will be available */
29+
public string $cookiePath = '/';
3030

31-
/** @var bool Whether the cookie is available only through HTTPS */
32-
public $cookieSecure = false;
31+
/** Whether the cookie is available only through HTTPS */
32+
public bool $cookieSecure = false;
3333

3434
/** @deprecated */
3535
public $cookieHttpOnly;
3636

37-
/** @var bool Whether warn on possible problem with data in output buffer */
38-
public $warnOnBuffer = true;
37+
/** Whether warn on possible problem with data in output buffer */
38+
public bool $warnOnBuffer = true;
3939

40-
/** @var bool Send invisible garbage for IE 6? */
41-
private static $fixIE = true;
40+
/** Send invisible garbage for IE 6? */
41+
private static bool $fixIE = true;
4242

43-
/** @var int HTTP response code */
44-
private $code = self::S200_OK;
43+
/** HTTP response code */
44+
private int $code = self::S200_OK;
4545

4646

4747
public function __construct()

src/Http/Session.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,26 @@ class Session
3131
'cookie_httponly' => true, // must be enabled to prevent Session Hijacking
3232
];
3333

34-
/** @var bool has been session ID regenerated? */
35-
private $regenerated = false;
34+
/** has been session ID regenerated? */
35+
private bool $regenerated = false;
3636

37-
/** @var bool has been session started by Nette? */
38-
private $started = false;
37+
/** has been session started by Nette? */
38+
private bool $started = false;
3939

40-
/** @var array default configuration */
41-
private $options = [
40+
/** default configuration */
41+
private array $options = [
4242
'cookie_samesite' => IResponse::SAME_SITE_LAX,
4343
'cookie_lifetime' => 0, // for a maximum of 3 hours or until the browser is closed
4444
'gc_maxlifetime' => self::DEFAULT_FILE_LIFETIME, // 3 hours
4545
];
4646

47-
/** @var IRequest */
48-
private $request;
47+
private IRequest $request;
4948

50-
/** @var IResponse */
51-
private $response;
49+
private IResponse $response;
5250

53-
/** @var \SessionHandlerInterface */
54-
private $handler;
51+
private ?\SessionHandlerInterface $handler = null;
5552

56-
/** @var bool */
57-
private $readAndClose = false;
53+
private bool $readAndClose = false;
5854

5955

6056
public function __construct(IRequest $request, IResponse $response)

src/Http/SessionSection.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@ class SessionSection implements \IteratorAggregate, \ArrayAccess
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var bool */
23-
public $warnOnUndefined = false;
22+
public bool $warnOnUndefined = false;
2423

25-
/** @var Session */
26-
private $session;
24+
private Session $session;
2725

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

3128

3229
/**

src/Http/Url.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,36 +45,27 @@ class Url implements \JsonSerializable
4545
{
4646
use Nette\SmartObject;
4747

48-
/** @var array */
49-
public static $defaultPorts = [
48+
public static array $defaultPorts = [
5049
'http' => 80,
5150
'https' => 443,
5251
'ftp' => 21,
5352
];
5453

55-
/** @var string */
56-
private $scheme = '';
54+
private string $scheme = '';
5755

58-
/** @var string */
59-
private $user = '';
56+
private string $user = '';
6057

61-
/** @var string */
62-
private $password = '';
58+
private string $password = '';
6359

64-
/** @var string */
65-
private $host = '';
60+
private string $host = '';
6661

67-
/** @var int|null */
68-
private $port;
62+
private ?int $port = null;
6963

70-
/** @var string */
71-
private $path = '';
64+
private string $path = '';
7265

73-
/** @var array */
74-
private $query = [];
66+
private array $query = [];
7567

76-
/** @var string */
77-
private $fragment = '';
68+
private string $fragment = '';
7869

7970

8071
/**

0 commit comments

Comments
 (0)