This change addresses the following Twig deprecation:
Adding an if condition on a for tag is deprecated in Twig 2.10. Use a filter filter or an "if" condition inside the "for" body instead (if your condition depends on a variable updated inside the loop). https://twig.symfony.com/doc/2.x/deprecated.html
This change addresses the following Twig deprecation:
This solution uses a separate "if" block instead of a "filter", which requires Twig 1.41 or higher. (https://twig.symfony.com/doc/2.x/filters/filter.html)
A solution that does use "filter" can be found at https://github.com/symfony/swiftmailer-bundle/pull/282