I don't know about everyone else, but I once a param is going to cross the 80
space limit I'll put it on a new line indented from the start of the
function declaration and continue as normal:
public function longMethodDeclaration(Zend_Controller_Front $front,
Zend_Cache $cache = null, Zend_Db_Table $databaseTable,
Zend_Feed $feed)
{
// much PHP
}
Where it makes sense, I'll follow a similar pattern for method calls. The
only hard rule I have is to keep both parameters and type hints paired at
all times.
Paddy
public function longMethodDeclaration(Zend_Class $zendClass
Trevor Johns wrote:
>
> Hi everyone,
> I just have a quick question regarding the ZF coding style:
>
> There's an 80 column line-length for code, so long method declarations/
> calls will need to be wrapped. This much is clear.
>
> However, what is convention as to how to indent method parameters
> after wrapping? Should parameters be aligned, or should they just be
> treated as a single long line?
>
> For example, which of these would be correct:
>
> $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
> $service, null,
> Zend_Gdata_ClientLogin::DEFAULT_SOURCE, null, null,
> Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, 'GOOGLE');
>
> (That's 2x4 spaces on the wrapped lines, whether this is correct
> indentation is also unclear from the style guide.)
>
> or
>
> $client = Zend_Gdata_ClientLogin::getHttpClient($user,
> $pass,
> $service,
> null,
>
> Zend_Gdata_ClientLogin::DEFAULT_SOURCE,
> null,
> null,
>
> Zend_Gdata_ClientLogin::CLIENTLOGIN_URI,
> 'GOOGLE');
>
> I've scanned over the ZF style guide at the below URL, but couldn't
> find any information that clarified this, so any input from the
> community would be appreciated.
>
> http://framework.zend.com/manual/en/coding-standard.html
>
> Thanks.
>
> --
> Trevor Johns
> http://tjohns.net
>
>
>
-----
Pádraic Brady
http://blog.astrumfutura.com
http://www.patternsforphp.com
OpenID Europe Foundation - Irish Representative
--
View this message in context:
http://www.nabble.com/ZF-Style-Guide-Clarification%3A-Method-Parameter-Indentation-tp18706711p18709298.html
Sent from the Zend Framework mailing list archive at Nabble.com.