[CODE STYLE] Improved if/else structure (big PR)

New syntax is clearer and prevents indentation issues when using reformatting in IDEs like PhpStorm.

This is the same change in all files.