PSR-2: The Second

151 views
Skip to first unread message

Nils Rückmann

unread,
Apr 14, 2015, 9:44:54 PM4/14/15
to joomla-dev...@googlegroups.com
2 Years ago i've already asked (https://groups.google.com/forum/#!topic/joomla-dev-framework/uMzwQBaYjCI/discussion), but what's the current state ? Does Joomla! Framework want to adopt PSR-2 ? It's just an opinion, but i'm a fan of PSR-2. I've never understood why every projects wants to have its own CS.

Michael Babker

unread,
Apr 14, 2015, 9:54:38 PM4/14/15
to joomla-dev...@googlegroups.com
Personally, I'd say no.  It's another major change in how our files are composed (last one being in late 2011 when the current rule set basically started being enforced), and on the CMS side we're still working to adopt our style rules fully.  I'd rather see Joomla as a whole stick to the rules we have now (and get in compliance fully) than implement another style that is a major change from what we have now (the brace styles and tab vs space intentions are really the big things here).


On Tuesday, April 14, 2015, Nils Rückmann <ma...@nueckman.de> wrote:
2 Years ago i've already asked (https://groups.google.com/forum/#!topic/joomla-dev-framework/uMzwQBaYjCI/discussion), but what's the current state ? Does Joomla! Framework want to adopt PSR-2 ? It's just an opinion, but i'm a fan of PSR-2. I've never understood why every projects wants to have its own CS.

--
Framework source code: https://github.com/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
---
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-frame...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.


--
- Michael

Please pardon any errors, this message was sent from my iPhone.

piotr_cz

unread,
Apr 16, 2015, 3:12:37 AM4/16/15
to joomla-dev...@googlegroups.com
I prefer current CS with Allman style braces an tabs,
but as most PHP projects use PSR-2 (just like Javascript applications, CSS/ Less ) this makes it a bit hard when switching back and forth.

At lease If/ when we upgrade our PHP_CodeSniffer rules to v2.x we well be able to automatically reformat any code whatever we use.


On Wednesday, April 15, 2015 at 3:54:38 AM UTC+2, Michael Babker wrote:
Personally, I'd say no.  It's another major change in how our files are composed (last one being in late 2011 when the current rule set basically started being enforced), and on the CMS side we're still working to adopt our style rules fully.  I'd rather see Joomla as a whole stick to the rules we have now (and get in compliance fully) than implement another style that is a major change from what we have now (the brace styles and tab vs space intentions are really the big things here).

On Tuesday, April 14, 2015, Nils Rückmann <ma...@nueckman.de> wrote:
2 Years ago i've already asked (https://groups.google.com/forum/#!topic/joomla-dev-framework/uMzwQBaYjCI/discussion), but what's the current state ? Does Joomla! Framework want to adopt PSR-2 ? It's just an opinion, but i'm a fan of PSR-2. I've never understood why every projects wants to have its own CS.

--
Framework source code: https://github.com/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
---
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-framework+unsub...@googlegroups.com.

Walt Sorensen

unread,
May 14, 2015, 9:25:17 AM5/14/15
to joomla-dev...@googlegroups.com
I agree we should stick to the current CS unless there is a compelling reason to adopt a different standard (like adopting the standard would improve compliance with the standard). 

I've started work on migrating the PHP_CodeSniffer rules to v2.x I'm also working on eliminating some of the custom sniffs that are identical to the source sniffs. It's still a work in progress, but it's some progress.

~Walt

Nils Rückmann

unread,
May 18, 2015, 10:30:39 AM5/18/15
to joomla-dev...@googlegroups.com
Am Donnerstag, 14. Mai 2015 15:25:17 UTC+2 schrieb Walt Sorensen:
I agree we should stick to the current CS unless there is a compelling reason to adopt a different standard (like adopting the standard would improve compliance with the standard). 

 Does a PSR-2 adoption not improve compliance with the standard?

Michael Babker

unread,
May 18, 2015, 11:32:33 AM5/18/15
to joomla-dev...@googlegroups.com
How does changing our project codestyle improve enforcing compliance with a codestyle standard?

--
Framework source code: https://github.com/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
---
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-frame...@googlegroups.com.

Don Gilbert

unread,
May 18, 2015, 11:44:39 AM5/18/15
to joomla-dev...@googlegroups.com
Well, I know you meant that rhetorically, but adoption PSR-2 would actually help with complaining with a code standard, because there are automated code style fixers available that can do it for us. One doesn't exist for Joomla's code style. 

Sent from my iPhone

Michael Babker

unread,
May 18, 2015, 12:00:45 PM5/18/15
to joomla-dev...@googlegroups.com
Personally, I see going through the entire project's repos and doing another major codestyle restructure as disruptive as executing a major organizational restructure.  If adopting PSR-2 is something folks are really eager for, it's a discussion to be had beyond this list I think.  The Framework code will be rather quick to adapt either way, but the rest of the project needs to be onboard too so we don't have the CMS doing one thing, the Framework another, and other support tools/teams yet another.

Nils Rückmann

unread,
May 18, 2015, 7:04:19 PM5/18/15
to joomla-dev...@googlegroups.com
Well, AFAIK the framework is independent from the CMS, so why do we have to bother about it ? I mean, i've always seen the framework as an opportunity to move forward (especially within a major release). At some point we have to change something, but if we wait until the framework has really been used to build something like a future CMS, the effort would be so high that Joomla will stick to it's own CS forever.

Walt Sorensen

unread,
May 18, 2015, 7:06:53 PM5/18/15
to joomla-dev...@googlegroups.com
In the changes I have worked on for "Remove sniffs in favor of built in ones" https://github.com/joomla/coding-standards/pull/102 I do use some of the PSR-2 standards since they are the same as the custom sniffs in the current Joomla standard. So in these cases we will get the code style fixers when migration the phpcs 2 is completed. I agree with Michael, we shouldn't adopt a change that differs from the existing code style as it could/would be disruptive even if we have fixers in place.

<!-- Include some additional sniffs from the PSR2 standard -->
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed">
<type>error</type>
</rule>

Michael Babker

unread,
May 18, 2015, 7:22:56 PM5/18/15
to joomla-dev...@googlegroups.com
The code is all Joomla, even if it's two different software projects with different aims.  Until someone makes a decision that I'm not going to and either forks it or demands it be rebranded, we all fly under one flag and we should all operate under the same rules.  Be it software development strategy or code style rules.

On Mon, May 18, 2015 at 7:04 PM, Nils Rückmann <ma...@nueckman.de> wrote:
Well, AFAIK the framework is independent from the CMS, so why do we have to bother about it ? I mean, i've always seen the framework as an opportunity to move forward (especially within a major release). At some point we have to change something, but if we wait until the framework has really been used to build something like a future CMS, the effort would be so high that Joomla will stick to it's own CS forever.

--

Andrew Eddie

unread,
May 18, 2015, 7:26:21 PM5/18/15
to joomla-dev...@googlegroups.com

 Does a PSR-2 adoption not improve compliance with the standard?

PSR-2 isn't a standard like HTTP or JSON. It's a collection of the things that about two-thirds of surveyed PHP projects had in common.

Regards,
Andrew Eddie 

Andrew Eddie

unread,
May 19, 2015, 7:33:03 AM5/19/15
to joomla-dev...@googlegroups.com
For what it's worth I'd be happy to +1 adopting PSR-2 (yes, you heard me right) in the Framework if it stop the question being asked because it is distraction to writing world-class code. Using a .editorconfig file these days makes it easy to get the basics right.

Regards
Andrew Eddie
Reply all
Reply to author
Forward
0 new messages