dseguy / clearPHP

Reference for writing clear PHP code
Other
963 stars 101 forks source link

Whitespace #17

Open bueltge opened 9 years ago

bueltge commented 9 years ago

Currently are all examples, pattern without space between brackets and var. I think is also a good practice to write readable code. Maybe I would check all examples for this and send a pull request with the changes - if you like it?

Example:

if (!$foo) {

much better

if ( ! $foo ) {

Also I would add a chapter about space, whitespace in code for better legibility, if you like?

GaryJones commented 9 years ago

While WordPress folks like you and me may be more familiar with the more liberal use of whitespace, others may prefer PSR-2 or other standards, the most of which aren't so liberal. The code here isn't so critical that we can't spend a few extra moments to get accustomed to the coding style, which only serves as an example to the textual descriptions.

I think what's more important, is for this project to have a CONTRIBUTING.md which indicates which standard code snippets should follow, so that there's consistency within the project.

bueltge commented 9 years ago

A contributing guideline is much helpful, right. But not from my side, because my English is not really fine enough for this information. The whitespace is more possible on my side, because I can do it, if is god helpful for the authors here.

ArnaudLigny commented 9 years ago
joanhey commented 9 years ago

PSR-2 and possibility of add in house guideline