-- Colin Guthrie <[EMAIL PROTECTED]> wrote
(on Tuesday, 29 July 2008, 04:51 PM +0100):
> Matthew Weier O'Phinney wrote:
>> -- Pádraic Brady <[EMAIL PROTECTED]> wrote
>> (on Tuesday, 29 July 2008, 03:32 AM -0700):
>>> 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)
>>>     {
>>
>> I'm going to make another note here. PEAR2 CS is proposing using the
>> following syntax when wrapping:
>>
>>     public function longMethodDeclaration(Zend_Controller_Front $front,
>>         Zend_Cache $cache = null, Zend_Db_Table $databaseTable,
>>         Zend_Feed $feed
>>     ) {
>
> Would that not make some editors folding options seem a bit odd?
>
> Probably not, but I personally always like to keep the open and close  
> braces inline for visual confirmation of matching code blocks. This all  
> falls down if you prefer your braces at the end of the control line of  
> course!

And having them at the end of the control line is simply unwieldy in the
above example

I use vim, and folding works fine in this case; I assume that if vim can
do it, more advanced IDEs can handle it.

> I know what you mean regarding reducing changeset size but it doesn't  
> work for function defintions as the , is needed anyway to extend it and  
> it stays with the argument before. Works for adding another condition in  
> a control statement assuming you like the && or || etc. at the start of  
> the line (which I personally do as it's easy to see them).

That argument was aimed primarily at control statements -- as you're
right, you can't terminate the function argument list with a comma.

> But overall this seems like bending over to suit this situation where  
> the real imporant thing should be on readable code over readable  
> changesets (not saying the latter isn't important, just that readability  
> of code is IMO more important).

It's for _maintainable_ code. It also helps prevent cases where you
forget to move the end paren to the next line. It's the same argument as
for defining arrays like this:

        $foo = array(
            $some,
            $thing,
            $added,
            $to,
            $the,
            $array,
        );

By putting the end paren on a line separate from the conditions, you
help prevent coding mistakes in the future.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to