public static function entityClass(EntityTypeInterface $entity_type, $replacement_class) {
    if (get_parent_class($replacement_class) == $entity_type->getClass()) {
      $entity_type->setClass($replacement_class);
    }
  }
public static function entityClass(EntityTypeInterface $entity_type, $replacement_class) {
    if (get_parent_class($replacement_class) == $entity_type->getClass()) {
      $entity_type->setClass($replacement_class);
    }
  }
public static function entityClass ( EntityTypeInterface $ entity_type , $ replacement_class ) { if ( get_parent_class ( $ replacement_class ) == $ entity_type -> getClass ( ) ) { $ entity_type -> setClass ( $ replacement_class ) ; } }
Overrides the entity class for an entity type.

The replacement class is only used if its immediate parent is the class
specified by the entity type.

@param \Drupal\Core\Entity\EntityTypeInterface $entity_type
The entity type definition.
@param string $replacement_class
The class to use.
Overrides the entity class for an entity type .