Sarke Posted October 19, 2017 Share Posted October 19, 2017 I like my braces style and I like my tabs. But I also realize there is benefit to using PSR-2 for more standard code when it comes to collaborating and contributing to open-source (some of which demand it). What compelling arguments can you make that I should switch to PSR-2 for all my PHP coding? Quote Link to comment https://forums.phpfreaks.com/topic/305395-i-like-allman-style-and-tabs-convince-me-to-use-psr-2/ Share on other sites More sharing options...
requinix Posted October 19, 2017 Share Posted October 19, 2017 The easy and less rude (to PHP-FIG) way to answer that is that (a) they're recommendations for a standard and (b) they're aimed towards establishing a common practice for open-source projects and not necessarily for individuals. Personally I don't care for all their standards either. Especially about code style. They're not official and they don't even represent the PHP community as a whole. Quote Link to comment https://forums.phpfreaks.com/topic/305395-i-like-allman-style-and-tabs-convince-me-to-use-psr-2/#findComment-1552824 Share on other sites More sharing options...
benanamen Posted October 19, 2017 Share Posted October 19, 2017 Use what you like. The more important thing is to be consistent. I also do not care for some of the PSR standards, particularly camelCase. I prefer under_score. The only place I do camelCase is for Classes. My code style preference is Whitesmiths. Quote Link to comment https://forums.phpfreaks.com/topic/305395-i-like-allman-style-and-tabs-convince-me-to-use-psr-2/#findComment-1552851 Share on other sites More sharing options...
Sarke Posted October 19, 2017 Author Share Posted October 19, 2017 Thanks for your input. I will continue to use my style of choice. My code style preference is Whitesmiths. Weirdo... Quote Link to comment https://forums.phpfreaks.com/topic/305395-i-like-allman-style-and-tabs-convince-me-to-use-psr-2/#findComment-1552860 Share on other sites More sharing options...
gizmola Posted October 20, 2017 Share Posted October 20, 2017 The cool folks over at Sensio Labs have a tool you can use to format your existing code: http://cs.sensiolabs.org/ So even if you don't want to code in a particular style there's an option to let them format it for you. Also gives you an easy way to mod things and see how they look in different style. Quote Link to comment https://forums.phpfreaks.com/topic/305395-i-like-allman-style-and-tabs-convince-me-to-use-psr-2/#findComment-1552864 Share on other sites More sharing options...
kon Posted October 21, 2017 Share Posted October 21, 2017 (edited) The coding indentation style is something like which side of the road you are driving. It doesn’t make any difference except if you are driving opposite in others in this road. Yes there are numerous studies that suggest the one side of the road over the other as I guess there could be with indentation style. That means that if you have any important reason to have your code PSR-2 “compliant” then you should abandon Allman style and use their rules. Allman style is wired in my brain , even in some projects that I had to write in K&R , I eventually wrote in Allman and then had a second IDE (Eclipse) with K&R configurations to change it and make the commits and updates in SVN. I really can’t understand why people prefer other indention style but equally I can’t understand why some people think the blue color relates to sadness and therefore dislike it. I can be friend and coworker with a person that hates blue , it is a matter of taste. So yes I can work in a non Allman style environment, but my taste in coding indention probably wont change. Many things have being wrote about Allman vs everything else, many times when I talk to a person that is strongly opposed to Allman I ask “in how many OOP languages do you write code this epoch ? ”. The answer is usually from none to one. I were a Java enthusiastic at mid 90’s , all the official books from Sun were in Allman , luckily this went well with my previous programming indentation style experience in C and C++. When PHP became really OOP (after version 5) I jumped in. I can see that Allman is in decline in amateurs code, that’s sad for me , but again it is a matter of taste. Edited October 21, 2017 by kon 1 Quote Link to comment https://forums.phpfreaks.com/topic/305395-i-like-allman-style-and-tabs-convince-me-to-use-psr-2/#findComment-1552925 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.