Fixed many small phpcs issues

This pr fixes many small phpcs issues
Doctrine uses spaces around the negation operator currently (I would vote in favor of changing this to match the PSR-2 rule though, but it is not done currently, and I'm not the one taking this decision)