http://symfony.com/doc/current/book/templating.html#syntax-checking
You can check for syntax errors in Twig templates using the twig:lint console command:
# You can check by filename: $ php app/console twig:lint src/Acme/ArticleBundle/Resources/views/Article/recentList.html.twig # or by directory: $ php app/console twig:lint src/Acme/ArticleBundle/Resources/views # or using the bundle name: $ php app/console twig:lint @AcmeArticleBundle