Instance d'opérateur dans Twig / Symfony 2?

J'ai une matrice mixte comme celui-ci (numéros de téléphone mobile et entités):

$targets = array();

$targets[] = '+32647651212';
$targets[] = new Customer();

Dans mon template Twig, j'ai appeler getMobile() si target est un Customer ou simplement imprimer le numéro, si c'est un nombre (string).

Est là quelque chose comme instanceof opérateur dans Twig?

<ul>
{% for target in targets %}
   <li>{{ target instance of MyEntity ? target.getMobile : target }}</li>
   {% else %}
       <li>Nothing found.</li>
</ul>

source d'informationauteur gremo