Skip to content

Commit 7b19c7c

Browse files
committed
added property typehints
1 parent 8c65f50 commit 7b19c7c

File tree

7 files changed

+16
-30
lines changed

7 files changed

+16
-30
lines changed

src/Iterators/CachingIterator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ class CachingIterator extends \CachingIterator implements \Countable
2828
{
2929
use Nette\SmartObject;
3030

31-
/** @var int */
32-
private $counter = 0;
31+
private int $counter = 0;
3332

3433

3534
public function __construct($iterator)

src/Utils/ArrayList.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
2020
{
2121
use Nette\SmartObject;
2222

23-
/** @var mixed[] */
24-
private $list = [];
23+
private array $list = [];
2524

2625

2726
/**

src/Utils/Html.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,9 @@ class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringab
238238
/** @var array<string, mixed> element's attributes */
239239
public $attrs = [];
240240

241-
/** @var bool use XHTML syntax? */
242-
public static $xhtml = false;
241+
public static bool $xhtml = false;
243242

244-
/** @var array<string, int> void elements */
243+
/** void elements */
245244
public static $emptyElements = [
246245
'img' => 1, 'hr' => 1, 'br' => 1, 'input' => 1, 'meta' => 1, 'area' => 1, 'embed' => 1, 'keygen' => 1,
247246
'source' => 1, 'base' => 1, 'col' => 1, 'link' => 1, 'param' => 1, 'basefont' => 1, 'frame' => 1,
@@ -251,11 +250,10 @@ class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringab
251250
/** @var array<int, HtmlStringable|string> nodes */
252251
protected $children = [];
253252

254-
/** @var string element's name */
255-
private $name;
253+
/** element's name */
254+
private string $name = '';
256255

257-
/** @var bool is element empty? */
258-
private $isEmpty;
256+
private bool $isEmpty = false;
259257

260258

261259
/**

src/Utils/Image.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ class Image
125125

126126
private const FORMATS = [self::JPEG => 'jpeg', self::PNG => 'png', self::GIF => 'gif', self::WEBP => 'webp', self::BMP => 'bmp'];
127127

128-
/** @var resource|\GdImage */
129-
private $image;
128+
private \GdImage $image;
130129

131130

132131
/**

src/Utils/Paginator.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,13 @@ class Paginator
3434
{
3535
use Nette\SmartObject;
3636

37-
/** @var int */
38-
private $base = 1;
37+
private int $base = 1;
3938

40-
/** @var int */
41-
private $itemsPerPage = 1;
39+
private int $itemsPerPage = 1;
4240

43-
/** @var int */
44-
private $page = 1;
41+
private int $page = 1;
4542

46-
/** @var int|null */
47-
private $itemCount;
43+
private ?int $itemCount = null;
4844

4945

5046
/**

src/Utils/Type.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@
1717
*/
1818
final class Type
1919
{
20-
/** @var array */
21-
private $types;
22-
23-
/** @var bool */
24-
private $single;
25-
26-
/** @var string |, & */
27-
private $kind;
20+
private array $types;
21+
private bool $single;
22+
private string $kind; // | &
2823

2924

3025
/**

tests/Utils/SmartObject.arrayProperty.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TestClass
1818
{
1919
use Nette\SmartObject;
2020

21-
private $items = [];
21+
private array $items = [];
2222

2323

2424
public function &getItems()

0 commit comments

Comments
 (0)