improved the performance of the Twig loader by not registering a chain loader if not needed

When `twig.templates` is empty, there is no need to register the Twig array loader as it will never be used anyway.