On Sunday, 21 April 2019 15:48:22 UTC+3, Alexander Makarov wrote:
>
> Readability-wise using same braces style as we're using for classes and 
> methods would be beneficial for control structures i.e.
>
> if ($foo)
> {
>     doFoo();
> }
> elseif ($bar)
> {
>     doBar();
> }
> else
> {
>     doSomethingElse();
> }
>
> Clear code blocks, vertically aligned braces.
>
>>
>>>>
This is basically style called Allman-8 which I'd personally much prefer 
over current PSR style. The Allman-8 is used in many universities teaching 
computer programming because it's probably the most clear way to format 
your code. I see no reason to reduce whitespace from that style and I guess 
nobody is going to argue that they intentionally use hard to follow style 
for teaching.

The only argument against Allman-8 is that it has too much horizontal 
whitespace (tab or 8 space indent for everything) but that's just another 
code smell issue for me. If you feel that 8 space indent is making your 
code too much to the right, the code probably needs splitting to multiple 
methods/functions anyway.

If your only argument for PSR style is consistency, why not switch to 
Allman-8 now instead of waiting for more code to appear which will make the 
switchover even harder? Then you could have have both consistency and 
readability.

-- 
Mikko

-- 
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 php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/fdecdc6b-efd7-455d-ab99-946d7d9a782e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Re: PSR-12 &q... alexey . borzov
    • Re: PSR-... 'Alexander Makarov' via PHP Framework Interoperability Group
      • Re: ... alexey . borzov
        • ... Woody Gilk
          • ... alexey . borzov
          • ... 'Alexander Makarov' via PHP Framework Interoperability Group
          • ... Robert Korulczyk
          • ... 'Alexander Makarov' via PHP Framework Interoperability Group
          • ... alexey . borzov
          • ... 'Alexander Makarov' via PHP Framework Interoperability Group
          • ... Mikko Rantalainen
          • ... Joe T.
          • ... Joe T.
          • ... Josh Bruce
          • ... Ben Ramsey
          • ... Josh Bruce
          • ... Josh Bruce
          • ... alexey . borzov
          • ... Woody Gilk
          • ... alexey . borzov
          • ... Ben Ramsey

Reply via email to