Skip to content

Commit

Permalink
Component::createComponent() warns on non-presenter components [Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 19, 2021
1 parent 24984e4 commit 908a0db
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Application/UI/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ public function getUniqueId(): string
}



protected function createComponent(string $name): ?Nette\ComponentModel\IComponent
{
$res = parent::createComponent($name);
if (!$res instanceof SignalReceiver && !$res instanceof StatePersistent) {
$type = get_class($res);
trigger_error("It seems that component '$name' of type $type is not intended to for in the Presenter.", E_USER_NOTICE);
}
return $res;
}


protected function validateParent(Nette\ComponentModel\IContainer $parent): void
{
parent::validateParent($parent);
Expand Down

0 comments on commit 908a0db

Please sign in to comment.