PHP coding standards and Eclipse PDT

Author Message

Piotrek Karaś

Tuesday 01 January 2008 3:36:19 am

Hello everyone in 2008!

Few questions concerning PHP coding standard:

1) Is there an up-to-date standard description available anywhere? I have just found this:
http://ez.no/ezpublish/documentation/development/standards/php

2) There are two formatting problems that I have when I try to follow the coding style observed in the core eZ Publish PHP files, both in regard to indentation. Eclipse comes with this great formatting tool, but it doesn't seem to obey custom indentation (this is mainly problematic with large array declarations). The other one occurs when ommiting brackets in single-line if statements:

<?php
// automatic formatting works great for brackets:
if( $x )
{
    echo $y;
}
// but destroys indentation when brackets are missing:
else
echo $z; // this line should be indented, I think...
?>

Any suggestions?
Thanks,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Bartek Modzelewski

Tuesday 01 January 2008 10:50:44 am

Hello Piotrek,

Check out this doc: http://ez.no/services/eznetwork/development_guidelines
In points 4.3 and 4.4 you will find coding rules for extensions created for eZ Network.
I think the best idea is just to keep brackets even for single line if statements, not only because of Eclipse formating tools.

Bartek

P.S. Happy new 2008 year ! One of my wishes for this year is growing popularity of eZ Publish in Poland :)

Baobaz
http://www.baobaz.com

Piotrek Karaś

Tuesday 01 January 2008 11:30:27 am

Bartek,

Thanks a lot! I wonder if this is exactly up to date, though, as there's still Doxygen and I thought there was a decision to switch to PHPDoc... ;)
But this will be helpful, anyways!

The formatting tools are a serious reason to reconsider coding standards, but even without that problem I like to keep full 'bracketing' of my code, for a number of reasons...

As to the eZ in Poland - yup, same here ;)

Cheers,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.