A bit hackish here :-). I'd better use the following:

```php
if ( substr( $templateName, -5 ) !== '.twig' )
{
    return;
}
```