You can change this to
```
false === key($this->errors)
```
and remove the `$invalid` property.