Re: Ex. Why CamelCase over_underscores when _ have less "cognitive friction"? Both are easy to parse and easy to read. camelCase is easier and faster to type (also less chars)
Re: Ex. Why a blank line at the end of PHP documents? Definition of a line in POSIX standard <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206> : 3.206 Line: A sequence of zero or more non- <newline> characters plus a terminating <newline> character Otherwise, some programs might have problems processing the last line then. Many editors and tools (ex. git) show a warning message if there is no newline at the end of file. Re: Ex. Why curly brace on it's own line for classes and functions? Opening braces for classes/methods MUST go on the next line, and closing braces MUST go on the next line after the body. If you mean why on the next line? Because it's more readable. It gives grouping feeling for class/method body. It keeps parameters list separate and more obvious. public function methodName( $callable, $request, $response, $routeArguments ) { $bodyParam = ... } public function methodName( $callable, $request, $response, $routeArguments) { $bodyParam = ... } Ancient standards had different reasons to not recommending the most readable style. (ex. computers display was small, storage limitation, printer and paper tape etcetera.. ) On Tuesday, January 24, 2017 at 9:15:03 AM UTC+8, Spencer Hill wrote: > > I'm new to PHP-FIG and this Group, forgive me if this is not the > appropriate place to post my question. > > I come from a WordPress background - I'm sorry - haha. After reviewing the > PSR-2 standards I found myself with a lot of questions beginning with > "Why?" and struggling to find explanations. > > Ex. Why CamelCase over_underscores when _ have less "cognitive friction"? > Ex. Why a blank line at the end of PHP documents? > Ex. Why curly brace on it's own line for classes and functions? > > All of these things seem illogical to me and I would have never thought to > do them naturally. So I'm surprised they're standards. But, looking at the > list of Members in PHP-FIG I have to assume there are well-thought reasons > for this that don't come down to opinion. Could anyone educate me? > > Thank you all for your time! > -- 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/00e8993c-2623-4997-a0ca-f21361aba0ed%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
