[ticket/11582] Move global declaration to beginning of block

PHPBB3-11582