public static function entityForm(EntityTypeInterface $entity_type, $replacement_class, $operation = 'default') {
    if (get_parent_class($replacement_class) == $entity_type->getFormClass($operation)) {
      $entity_type->setFormClass($operation, $replacement_class);
    }
  }
public static function entityForm(EntityTypeInterface $entity_type, $replacement_class, $operation = 'default') {
    if (get_parent_class($replacement_class) == $entity_type->getFormClass($operation)) {
      $entity_type->setFormClass($operation, $replacement_class);
    }
  }
public static function entityForm ( EntityTypeInterface $ entity_type , $ replacement_class , $ operation = 'default' ) { if ( get_parent_class ( $ replacement_class ) == $ entity_type -> getFormClass ( $ operation ) ) { $ entity_type -> setFormClass ( $ operation , $ replacement_class ) ; } }
Overrides the class used for an entity form.

The replacement class is only used if its immediate parent is the form
class used for the specified operation.

@param \Drupal\Core\Entity\EntityTypeInterface $entity_type
The entity type definition.
@param string $replacement_class
The class to use.
@param string $operation
(optional) The entity operation.
Overrides the class used for an entity form .