I have a few class constants in my entity class, e.g.:
class Entity { const TYPE_PERSON = 0; const TYPE_COMPANY = 1; }
In normal PH
As of 1.12.1 you can read constants from object instances as well:
{% if var == constant('TYPE_PERSON', entity)