From 06aa063dc4daf75e22b8c109db12fbe362d8c9ce Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 1 Mar 2021 19:11:20 +0100 Subject: [PATCH] added property typehints --- src/ComponentModel/Component.php | 9 +++------ src/ComponentModel/Container.php | 6 ++---- tests/bootstrap.php | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/ComponentModel/Component.php b/src/ComponentModel/Component.php index e89c53b..6de545c 100644 --- a/src/ComponentModel/Component.php +++ b/src/ComponentModel/Component.php @@ -24,14 +24,11 @@ abstract class Component implements IComponent { use Nette\SmartObject; - /** @var IContainer|null */ - private $parent; - - /** @var string|null */ - private $name; + private ?IContainer $parent = null; + private ?string $name = null; /** @var array}> means [type => [obj, depth, path, [attached, detached]]] */ - private $monitors = []; + private array $monitors = []; /** diff --git a/src/ComponentModel/Container.php b/src/ComponentModel/Container.php index c2e7074..60ac0f8 100644 --- a/src/ComponentModel/Container.php +++ b/src/ComponentModel/Container.php @@ -22,10 +22,8 @@ class Container extends Component implements IContainer private const NameRegexp = '#^[a-zA-Z0-9_]+$#D'; /** @var IComponent[] */ - private $components = []; - - /** @var Container|null */ - private $cloning; + private array $components = []; + private ?Container $cloning = null; /********************* interface IContainer ****************d*g**/ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 49f8d6c..36d8dd2 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -17,7 +17,7 @@ class Notes { - public static $notes = []; + public static array $notes = []; public static function add($message): void