Give the gift of Drupal. All merchandise is 50% off through 2016.
Updated: Comment #N
added a new interface for setting errors, while we still are calling procedural functions.
Switch function calls to method calls.
User interface changes
FormBase::setFormError() proxies through to FormErrorInterface::setErrorByName()