Просмотр исходного кода

Fixes #95 - Zend_CodeGenerator_Php_Docblock _docCommentize() produces unnecessary blank lines

Frank Brückner 12 лет назад
Родитель
Сommit
8be8b180d1

+ 7 - 4
library/Zend/CodeGenerator/Php/Docblock.php

@@ -206,10 +206,11 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
      */
     protected function _docCommentize($content)
     {
-        $indent = $this->getIndentation();
-        $output = $indent . '/**' . self::LINE_FEED;
+        $indent  = $this->getIndentation();
+        $output  = $indent . '/**' . self::LINE_FEED;
         $content = wordwrap($content, 80, self::LINE_FEED);
-        $lines = explode(self::LINE_FEED, $content);
+        $lines   = explode(self::LINE_FEED, $content);
+
         foreach ($lines as $line) {
             $output .= $indent . ' *';
             if ($line) {
@@ -217,8 +218,10 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
             }
             $output .= self::LINE_FEED;
         }
+
+        $output = rtrim($output, ' *' . self::LINE_FEED) . self::LINE_FEED;
+
         $output .= $indent . ' */' . self::LINE_FEED;
         return $output;
     }
-
 }

+ 0 - 9
tests/Zend/CodeGenerator/Php/FileTest.php

@@ -126,7 +126,6 @@ EOS;
  * File header here
  *
  * @author Ralph Schindler <ralph.schindler@zend.com>
- *
  */
 
 
@@ -136,7 +135,6 @@ EOS;
  * class docblock
  *
  * @package Zend_Reflection_TestSampleSingleClass
- *
  */
 class Zend_Reflection_TestSampleSingleClass
 {
@@ -145,7 +143,6 @@ class Zend_Reflection_TestSampleSingleClass
      * Enter description here...
      *
      * @return bool
-     *
      */
     public function someMethod()
     {
@@ -234,7 +231,6 @@ EOS;
  * File header here
  *
  * @author Ralph Schindler <ralph.schindler@zend.com>
- *
  */
 
 
@@ -244,7 +240,6 @@ EOS;
  * class docblock
  *
  * @package Zend_Reflection_TestClassWithCodeInMethod
- *
  */
 class Zend_Reflection_TestClassWithCodeInMethod
 {
@@ -253,7 +248,6 @@ class Zend_Reflection_TestClassWithCodeInMethod
      * Enter description here...
      *
      * @return bool
-     *
      */
     public function someMethod()
     {
@@ -305,7 +299,6 @@ EOS;
 <?php
 /**
  * For manipulating files.
- *
  */
 
 class Foo
@@ -344,13 +337,11 @@ EOS;
 <?php
 /**
  * For manipulating files.
- *
  */
 
 
 /**
  * Class Foo1
- *
  */
 class Foo1
 {

+ 0 - 1
tests/Zend/CodeGenerator/Php/MethodTest.php

@@ -99,7 +99,6 @@ class Zend_CodeGenerator_Php_MethodTest extends PHPUnit_Framework_TestCase
      * Enter description here...
      *
      * @return bool
-     *
      */
     public function someMethod()
     {