Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 505778

Summary: Enable Keep 'else if' on one line' by default for PSR2
Product: z_Archived Reporter: Michal Niewrzal <wywrzal>
Component: PDTAssignee: PHP Core <php.core-inbox>
Status: CLOSED FIXED QA Contact: Sylvia Tancheva <silviya>
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
See Also: https://git.eclipse.org/r/83019
https://git.eclipse.org/c/pdt/org.eclipse.pdt.git/commit/?id=a229c7ad0e4dcb916d8c4637874dab83459fc55c
Whiteboard:

Description Michal Niewrzal CLA 2016-10-12 07:02:46 EDT
Option Keep 'else if' on one line' is disabled by default for PSR2 and in my opinion can be very irritating and it doesn't fit current style of programming.

Before formatting: 
<?php
function cmp_dept($a, $b)
{
    if ($a['dept'] > $b['dept']) {
        return 1;
    } else if ($a['dept'] < $b['dept']) {
        return false;
    } else if ($a['dept'] < $b['dept']) {
        return 0;
    }
}

Result:
<?php

function cmp_dept($a, $b)
{
    if ($a['dept'] > $b['dept']) {
        return 1;
    } else 
        if ($a['dept'] < $b['dept']) {
            return false;
        } else 
            if ($a['dept'] < $b['dept']) {
                return 0;
            }
}
Comment 1 Eclipse Genie CLA 2016-10-12 07:14:11 EDT
New Gerrit change created: https://git.eclipse.org/r/83019
Comment 3 Sylvia Tancheva CLA 2017-05-29 09:09:08 EDT
Verified, closing