Skip to content

Commit d07e7fb

Browse files
committed
Component::createComponent() warns on non-presenter components [Closes nette/forms#147]
1 parent d6989a2 commit d07e7fb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Application/UI/Component.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ public function getUniqueId(): string
7373
}
7474

7575

76+
protected function createComponent(string $name): ?Nette\ComponentModel\IComponent
77+
{
78+
$res = parent::createComponent($name);
79+
if (!$res instanceof SignalReceiver && !$res instanceof StatePersistent) {
80+
$type = get_class($res);
81+
trigger_error("It seems that component '$name' of type $type is not intended to for in the Presenter.", E_USER_NOTICE);
82+
}
83+
return $res;
84+
}
85+
86+
7687
protected function validateParent(Nette\ComponentModel\IContainer $parent): void
7788
{
7889
parent::validateParent($parent);

0 commit comments

Comments
 (0)