Add ClassTrait support and related tests