Avoid code smell warnings by adding LogicExceptions

"Code smell" may sound harsh. I'm just quoting the term. ;-)

I'm aware this doesn't change anything. But since PHPStorm and other
static code ananlyis tools are complaining about "code smell" this
hopefully helps making the code more maintainable.