Skip to content

Commit

Permalink
added property typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 4, 2021
1 parent 22bc087 commit a17fa67
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
3 changes: 1 addition & 2 deletions src/Iterators/CachingIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class CachingIterator extends \CachingIterator implements \Countable
{
use Nette\SmartObject;

/** @var int */
private $counter = 0;
private int $counter = 0;


public function __construct($iterator)
Expand Down
3 changes: 1 addition & 2 deletions src/Utils/ArrayList.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
{
use Nette\SmartObject;

/** @var mixed[] */
private $list = [];
private array $list = [];


/**
Expand Down
12 changes: 5 additions & 7 deletions src/Utils/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,9 @@ class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringab
/** @var array<string, mixed> element's attributes */
public $attrs = [];

/** @var bool use XHTML syntax? */
public static $xhtml = false;
public static bool $xhtml = false;

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

/** @var string element's name */
private $name;
/** element's name */
private string $name = '';

/** @var bool is element empty? */
private $isEmpty;
private bool $isEmpty = false;


/**
Expand Down
3 changes: 1 addition & 2 deletions src/Utils/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ class Image

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

/** @var resource|\GdImage */
private $image;
private \GdImage $image;


/**
Expand Down
12 changes: 4 additions & 8 deletions src/Utils/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ class Paginator
{
use Nette\SmartObject;

/** @var int */
private $base = 1;
private int $base = 1;

/** @var int */
private $itemsPerPage = 1;
private int $itemsPerPage = 1;

/** @var int */
private $page = 1;
private int $page = 1;

/** @var int|null */
private $itemCount;
private ?int $itemCount = null;


/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Utils/SmartObject.arrayProperty.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TestClass
{
use Nette\SmartObject;

private $items = [];
private array $items = [];


public function &getItems()
Expand Down

0 comments on commit a17fa67

Please sign in to comment.