You can remove the "else", just write 
```php
if ($originalClass->isInterface()) {
    // exception
}
$classGenerator->setExtendedClass($originalClass->getName());
```