diff --git a/lib/runner.php b/lib/runner.php index 4b06819..bb6f8f1 100644 --- a/lib/runner.php +++ b/lib/runner.php @@ -120,15 +120,15 @@ function export_docblock( $element ) { } $output = array( - 'description' => $docblock->getShortDescription(), - 'long_description' => $docblock->getLongDescription()->getFormattedContents(), + 'description' => preg_replace( '/[\n\r]+/', ' ', $docblock->getShortDescription() ), + 'long_description' => preg_replace( '/[\n\r]+/', ' ', $docblock->getLongDescription()->getFormattedContents() ), 'tags' => array(), ); foreach ( $docblock->getTags() as $tag ) { $t = array( 'name' => $tag->getName(), - 'content' => $tag->getDescription(), + 'content' => preg_replace( '/[\n\r]+/', ' ', $tag->getDescription() ), ); if ( method_exists( $tag, 'getTypes' ) ) { $t['types'] = $tag->getTypes(); diff --git a/tests/phpunit/tests/export/docblocks.inc b/tests/phpunit/tests/export/docblocks.inc new file mode 100644 index 0000000..3e0e8b5 --- /dev/null +++ b/tests/phpunit/tests/export/docblocks.inc @@ -0,0 +1,64 @@ +assertStringMatchesFormat( + '%s' + , $this->export_data['classes'][0]['doc']['long_description'] + ); + } +}