diff --git a/src/Application/UI/Component.php b/src/Application/UI/Component.php index 5db344c5f..49eee4e3e 100644 --- a/src/Application/UI/Component.php +++ b/src/Application/UI/Component.php @@ -89,7 +89,8 @@ public function addComponent( protected function createComponent(string $name): ?Nette\ComponentModel\IComponent { if (method_exists($this, $method = 'createComponent' . $name)) { - (new AccessPolicy(new \ReflectionMethod($this, $method)))->checkAccess($this); + $rm = new \ReflectionMethod($this, $method); + (new AccessPolicy($rm))->checkAccess($this); $this->checkRequirements($rm); } return parent::createComponent($name);