public function checkMethodAllowed($obj, $method, int $lineno = -1, ?Source $source = null) : void { if ($this->isSandboxed($source)) { try { $this->policy ->checkMethodAllowed($obj, $method); } catch (SecurityNotAllowedMethodError $e) { $e->setSourceContext($source); $e->setTemplateLine($lineno); throw $e; } } }