new Class().Function() pattern
Is this a typical way to write something like


If that’s all the information that is required – yes, why not? I see no problem at all with this approach.

On the other hand, if code lik this is prolific this is a sure sign that the original class design is broken. But from your code it looks like this is outside of your control anyway, since UserModel is a framework class.

In general, if a class is used in such a fashion then it is over-engineered: a static method could have been used just as well (on the other hand, this may make unit testing harder because it prevents mocking).