Skip to content

Commit 23cbbaf

Browse files
committed
added property typehints
1 parent d70a5eb commit 23cbbaf

File tree

6 files changed

+13
-22
lines changed

6 files changed

+13
-22
lines changed

src/Iterators/CachingIterator.php

+1-2
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

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
1919
{
2020
use Nette\SmartObject;
2121

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

2524

2625
/**

src/Utils/Html.php

+5-7
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, Html|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

+1-2
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

+4-8
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,13 @@ class Paginator
3232
{
3333
use Nette\SmartObject;
3434

35-
/** @var int */
36-
private $base = 1;
35+
private int $base = 1;
3736

38-
/** @var int */
39-
private $itemsPerPage = 1;
37+
private int $itemsPerPage = 1;
4038

41-
/** @var int */
42-
private $page = 1;
39+
private int $page = 1;
4340

44-
/** @var int|null */
45-
private $itemCount;
41+
private ?int $itemCount = null;
4642

4743

4844
/**

tests/Utils/SmartObject.arrayProperty.phpt

+1-1
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)