[ticket/15214] Move setting $priority_key to a more appropriate place

It doesn't need to be set at the top and makes more sense to set it
at the bottom where it's used. Also removes a redundant check

PHPBB3-15214
This commit is contained in:
toxyy 2023-12-04 15:31:13 -05:00
parent 8d6d016a5a
commit 31fb27e8d8

View file

@ -52,11 +52,6 @@ class event extends \Twig\Node\Node
{
$ext_namespace = str_replace('/', '_', $ext_namespace);
if (isset($this->template_event_priority_array[$ext_namespace][$location]))
{
$priority_key = $this->template_event_priority_array[$ext_namespace][$location];
}
$compiler_calls = [];
if ($this->environment->isDebug())
@ -99,8 +94,10 @@ class event extends \Twig\Node\Node
if (!empty($compiler_calls))
{
if (isset($priority_key))
if (isset($this->template_event_priority_array[$ext_namespace][$location]))
{
$priority_key = $this->template_event_priority_array[$ext_namespace][$location];
if (array_key_exists($priority_key, $compiler_steps))
{
array_splice($compiler_steps, $priority_key, 0, [$compiler_calls]);