Am 24.07.2017 um 09:19 schrieb Henrique Rodrigues:
> Original Pattern
>
> if ($a === $b) {
> bar();
> } elseif ($a > $b) {
> $foo->bar($arg1);
> } else {
> BazClass::bar($arg2, $arg3);
> }
>
> Template that I use
>
> if ($a === $b) {
> bar();}
> elseif ($a > $b) {
> $foo->bar($arg1);}
> else {
> BazClass::bar($arg2, $arg3);}
>
> The original standard in my view on files that have thousands of lines of
> code gets a bit confusing and not organized in my opinion, I would like to
> know from the community what you think of this?
First, there are good reasons for the placing of the curly braces - you
see the start and the end of a block immediately without wasting lines.
Actually the current PSR provides better readability than your approach
requiring just one extra line (I, personally, would prefer to require
curly braces to always be on their own line).
On the other hand, if you have files with thousands of lines, you're
simply doing wrong. Methods should always fit on the screen, a class
should not have more than a few methods, and each class shoud live in
its own file. So, in the worst situation, you'd encounter files with a
few hundred lines.
You will get familiar with the PSR very fast, and it will feel natural
after some time. Just give it a chance.
Regards,
Niels
--
| New Stars on the Horizon: GreenCape · nibralab · laJoom |
|
http://www.bsds.de · BSDS Braczek Software- und DatenSysteme |
| Webdesign · Webhosting · e-Commerce · Joomla! Content Management |
------------------------------------------------------------------