I believe it would be safer to user
```php
if (isset($type->type_alias))
```
here