[CODE STYLE] Improved if/else structure

New syntax is clearer and prevents indentation issues when using reformatting in IDEs like PhpStorm.