ZF-6982: "zf create action" automatic code formatting messed up
Description
When I create an action for an existing controller via "zf create action ", Zend_Tool creates an action method stub in the controller file.
The bad part of it: it also inserts a blank line after every line and messes with the indentation, indenting everything after the first line in every method. If you create subsequent actions, the effect accumulates. So after the creation of a few actions, your file consists of mostly blank lines with occasional code lines inbetween, and most of the code lines are indented by several tabs.
Thus, everytime I use the Zend_Tool via the CLI, I'll have to tidy up the mess, only to have it all scrambled up with the next action creation.
I'm on a Mac, so maybe part of the problem relates to different line break characters between Windows and Mac OS X. But that's just a shot from the hip.
I'm also using Zend Studio on Mac, if you want to know.
Best regards, Constantin
Comments
Posted by Wenbert Del Rosario (wenbert) on 2009-06-17T06:56:47.000+0000
I can confirm that this also happens on Windows.
Regards, Wenbert
Posted by Matt McCormick (mattmccor) on 2009-08-09T16:19:44.000+0000
I confirm that I also have this problem.
In addition, any constants defined in the class will be removed and any function that has type-hinted parameters eg
public function indexAction(MyObject $object)
will be replaced as
public function indexAction($)
Posted by Ten Ruslan (irt) on 2009-09-14T03:45:16.000+0000
I have same problem on Ubuntu 8.10.
Posted by Wesley Barbaresco (wbarbaresco) on 2009-09-28T05:22:59.000+0000
I resolve this proglem change the file
Zend \ Reflection \ Method.php
on line 153 i put this:
$tempLines = array_slice($lines, 0); $lines = array(); foreach( $tempLines as $line ){ array_push( $lines, rtrim($line) ); }
this script just remove the break line on the end. This work for me.
Wesley
Posted by Benjamin Eberlei (beberlei) on 2009-09-28T11:45:09.000+0000
Added to CodeGenerator also
Posted by Richard Naik (rmnd3b) on 2009-12-22T10:44:08.000+0000
As of 1.9.6, the extra line breaks have been fixed but the indentation problem remains.
Posted by Marc Hodgins (mjh_ca) on 2010-12-19T15:24:13.000+0000
Resolved in trunk in r23561, merged to 1.11 release branch in r23562.