Skip to content

Commit

Permalink
Component: Throw exception in case of signal method in Component or P…
Browse files Browse the repository at this point in the history
…resenter is private [Closes #263]
  • Loading branch information
janbarasek authored and dg committed Feb 5, 2021
1 parent fd61a36 commit 943e496
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Application/UI/Component.php
Expand Up @@ -103,7 +103,10 @@ protected function tryCall(string $method, array $params): bool
$rc = $this->getReflection();
if ($rc->hasMethod($method)) {
$rm = $rc->getMethod($method);
if ($rm->isPublic() && !$rm->isAbstract() && !$rm->isStatic()) {
if ($rm->isPrivate()) {
throw new Nette\InvalidStateException('Method ' . $rm->getName() . '() can not be called because it is private.');
}
if (!$rm->isAbstract() && !$rm->isStatic()) {
$this->checkRequirements($rm);
try {
$args = $rc->combineArgs($rm, $params);
Expand Down

0 comments on commit 943e496

Please sign in to comment.