You probably meant:
```php
if ($expectClass !== null && $expectClass !== get_class($instance))
```
but I don't think you need this check anyway.