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
-
Well, you are close to psr-2 standard.
Class definitions and method braces go on a new line.
If else statements however, would require to be on the same line.
It ain't a crime to go against this. But, you know :P -
xewl41266yDepends on de amount of conditions how I do things... I always start checking all negative things though....
if(
idontlikethis
){
return fu..
}
if(
idontlikethiseither
){
return fu..
}
return whateverwhenilikeyou; -
fonz966yThere are bigger fish to fry than where the brackets are. It's normally all the shite inside them that pisses my off rather than the brackets themselves.
-
Reconfigure your phpcs and/or phpmd (i dont remember which). You can adept PSR for your needs, like I did. I heavly dislike some portions of PSR but love others.
-
Hazarth95306yI like #2 more too. I was raised on the C family, its what we do and for me at least code reads much cleaner with #2. #1 is more compact and looks fine, but #2 makes things very obviously separated into chunks and my eyes and brain have a better time reading and compiling it with those "mental" separators
-
zuley196yWhy do you prefer the second option? Also is the style called Allman or is that just something I heard?
-
@Lyniven What if I say no? Some PSR things are annoying me and I much prefer writing in coding standard that feels most readable?
-
rant1ng44626y
-
C0D4669026yI'm a top one guy.
It stops me from adding ; at the end of a if and executing the next line regardless.
But each to their own.
I do like a lot of the PSR's but something.... meh. -
@zuley That's Allman style, yes.
I usually use that bracing style, unless there's a coding style that says otherwise. For me it's easier to see how the code is structured that way. -
Lyniven44536y@DubbaThony if you don't respect the most widely used and recognized standards, I'll just assume you don't respect anything else in your code, write bad quality, unbearable shit code.
-
@Lyniven Assume what you want, I respect most of PSR but rest I change and stay consistant. For example:
if () {
or
if() {
One of them is PSR second not. Guess which drives me absolutely nuts?
Edit,
Oh, and Im also tab guy, not spaces guy. So thats another thing i change. That may be your shittieness measure, whatever. -
@C0D4 So you know, we are making shitty unmaintainable code, so here is that 😂😂😂
-
@C0D4 Does that mean we should fork PSR and fix it in some regards and call it "unmaintainable but treasure"?
-
@C0D4 oh ya. Definitely.
Or maybe simple tool that unfucks and fucks up code (changes between exacly user's favourite flavour of PSR to fully-fleded PSR just before push and reverse on pull)...
That's actually interesting idea and I guess its doable with existing tools so it would be simple bash script. hrmmm.... -
rant1ng44626y@DubbaThony
I'm in marketing 20 years
What you described would definitely be a hit/sell/famousgithub/ etc.
You should do it if you want those things, cuz it's guaranteed going to take off, especially if you consider that PSR can only become more nitty, not less. The timing is right on.
Related Rants
I'm a php developer
I don't like
If (something) {
//code here
}
I like
if (something)
{
//code here
}
Sorry.
EDIT:
However, in javascript, I'm fine with the first example. I may need professional help.
random
am i alone?
syntax
php