Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4669026yLooks like someone strictly following the PSR, except for the additional white space for args.
https://www.php-fig.org/psr/psr-2/ -
cursee165956yWell you are putting whitespace as far as you can 😆
Try to add it after function name as well 😛 -
I see this style a lot when working with WordPress. I adopted it for a little while but got lazy and went back to no space inside of parentheses (not counting spaces after commas).
-
Root797746yWhy all of the excessive newlines?
They absolutely detract from readability.
Also: `if` is a keyword, not a function. Add a space between it and its condition. They aren't arguments! -
Interior padding?
While I don’t naturally do it I have been known to do it when things get “thick” to help readability in Linq or method definition/calls. -
@Root subjective to personal preference. And this is actual php psr-2 standard compliant code.
I agree about the space between the if statements. Without them it does make them look like functions -
wizzzard8056y@Root I find it easier to read the flow of (and quickly scan) code when the curly braces are on their own line, and don't find it excessive at all. Imo, Allman style indenting/braces is far more readable than K&R. Whitespace is no longer a limited commodity - I don't print code on paper.
However, "no space after 'if'" is the essence of my post; I've been doing it for close to 20 years, and I don't know where I picked it up from, but by now I cannot stop doing it because everything else looks broken :/ -
Root797746y@wizzzard My coding style could be summarized as the exact opposite of everything you do. (Except spaces within parentheses)
-
dnaka911206yThat's what I love about Go language. Just one universal formatting style for everyone. No customization options nothing.
Not every freaking project has its own formatting style, everyone has to follow the one single style. Makes it much easier to read other people's code when everyone follows the same formatting. -
620hun81886yI’m so used to not having this kind of padding that it actually makes it less readable to me
-
C0D4669026yI’ve really never understood why you need all that extra white space though.
This for example, still covers all that but is quicker to read over and know what’s going on, plus extra padding in args drives me crazy 😂
*this is not my normal editor, but you can only do so much on an iPhone 😔 -
@gaaraDev
foobar
https://en.m.wikipedia.org/wiki/...
Alice and Bob
https://en.m.wikipedia.org/wiki/... -
I have a thing for hand-minified Javascript code.. You probably don't want to see that..
Related Rants
Is there a common style name/popular origin for the style of whitespace in code where you put spaces inside parentheses but not after keywords in control statements, or after function names? (See img)
This is my preferred whitespace method (in most languages), but I don't know where I adopted it from, if anywhere... ;P
question
whitespace
coding style