Php Framework Interoperability Group

Hi there,

I just bumped into this : https://github.com/php-fig/fig-standards .

I absolutely don’t know if this is a active community, since I’m not in the mailing list (for now), but I see all the main PHP frameworks (and others too) and not Yii. I think, as a professionnal framework, and if this ‘group’ is actually doing something, Yii should probably take part in it.

If it is not interresting for the Yii framework community to take part in this group, at least have a look at the coding standards they have proposed : https://github.com/php-fig/fig-standards/tree/master/accepted wich can be interresting (especially the idea of havin different levels of standard) to use in Yii.

Just dropping my 2 cents here…

Cheers!

It’s not that active but active enough. So far they’ve worked out three standards including very good PSR-0 that we’ll adopt in Yii2. PSR-1 and PSR-2 are a bit too subjective to be really considered a standard for Yii2 so’ve strucutered out own one after these but worked out our own rules.

Great, good to know!

In my opinion, coding standard should not be too restrictive, but must exist especially in a framework where contributor’s extensions or plugins play a important role.

In that way, the PSR-0 is a very good minimal coding standard. Maybe that minimal should be enforced in the extensions to ensure a minimal quality and coherence.

Cheers!

I’m interested to know how yii will differ from PSR-1, it seems pretty sensible and very minimal.

I suspect i’m almost certainly in the minority however i’d love to see yii embrace PSR-2 as well - while some of the decisions taken are perhaps not to everyones taste at least it does move towards parity with the PHP community at large.

The one thing that I hope does change in the new Yii standard is the introduction of a bit more whitespace - personally I find a lot of the current code difficult to follow with the eye.

The lack of spaces after commas in most cases being particularly irksome as it flies against the common usage in the english language :)

http://www.yiiframework.com/forum/index.php/topic/3667-coding-standard/page__st__60

I will never use brackets for single-line statements inside structures. Brackets for structures exist in order to wrap multiple lines, no multiple lines no brackets. Coding standards which use brackets for single-line statements are obtuse (this includes PSR-2).

From my perspective I actually find it easier to follow simply because the brackets are applied consistently regardless of the number of statements inside the structure.

Regardless, I suspect that the thread referenced by samdark above has already done this topic to death :)

yes there are already few topics on brackets issues… we decided for single command brackets mainly because this allows to set a debuger breakpoint on that line… if there are no brackets you cannot set a breakpoint on that line that in turn makes debugging very hard sometimes.

yeah I would like to see PSR-0,1 and 2 into yii2 it feels natural to me. but hey that’s just me! :)

+1 to these, also, following such standards is much easier on the eyes! especially when reading code you wrote a year ago, or someone else’s code they wrote 5 years ago.

Lots of time passed since last post in the topic. Changes since then:

  1. Yii is PHP-FIG member. I’m representative.

  2. Yii2 adopted PSR-1, PSR-2, PSR-4.