{%- block form_widget_simple -%}
{%- set type = type|default('text') -%}
{%- if attr.class is not defined -%}
{%- set attr = attr|merge({'class': 'my-class'}) -%}
{%- endif -%}
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
{%- endblock form_widget_simple -%}
Или если нужно всегда добавлять класс:
{%- block form_widget_simple -%}
{%- set type = type|default('text') -%}
{%- set attr = attr|merge({'class': (attr.class|default ~ ' my-class')|trim}) -%}
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
{%- endblock form_widget_simple -%}