Note that if the decision is that PSR-2 does not enforce no blank lines at 
the start of control structures, it also does not enforce 0 or 1 blank 
lines, and so this would be valid code under PSR-2:

if ($foo) {


    echo $foo;
} else {





    echo $bar;
}

I use an extreme example here to show how relaxing coding standards can 
lead to unexpected results and thus inconsistency. It seems to me that 
developers relying on PHPCS to keep their code clean through checking and 
auto-fixing will now have to use custom rulesets to enforce what is a 
pretty standard rule. That feels like a big step backwards.

Right now, developers who do not want this rule enforced in any way can use 
a custom ruleset and exclude it pretty easily. Developers who want to 
enforce a single blank line at the start would need to write a custom sniff 
because none of the included coding standards have that rule. But that 
custom sniff could be contributed to the PHPCS project so it is available 
for everyone to use more easily.

Greg


On Sunday, 5 February 2017 06:41:39 UTC+11, Ryan R. wrote:
>
> Hello,
> I'd like to propose a change to the PSR-2 rule concerning the presence of 
> one (and only one) empty line after opening braces for conditional 
> statements.
>
> Indeed I believe allowing (enforcing ?) a single empty line at the 
> beginning of the conditional statement would enhance the readability of the 
> code, especially when multiple conditional statements are nested.
>
> i.e : 
>
> if ('string' === $dummy) { 
>   
>     if ('values' === $mergedOptions['some_default']) { 
>
>          return substr($dummy, 0, 5);
>     }
>
>     return ucwords($dummy);
> }
>
> instead of
>
> if ('string' === $dummy) { 
>     if ('values' === $mergedOptions['some_default']) { 
>          return substr($dummy, 0, 5);
>     }
>
>     return ucwords($dummy);
> }
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/5d658e29-39ac-4251-ab18-318a68e0b04f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to