Fix static notice error thrown from Twig custom method