From 382039712704a99ce30e777ef7cb77624e54db3e Mon Sep 17 00:00:00 2001 From: Mikael DELSOL Date: Tue, 29 Mar 2016 18:49:59 +0200 Subject: [PATCH 1/3] isue #5 - don't wrap content as soon as the annotation used a tag --- src/Element/PhpAnnotation.php | 2 +- tests/Element/PhpAnnotationBlockTest.php | 10 ++-------- tests/Element/PhpAnnotationTest.php | 7 ++----- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/Element/PhpAnnotation.php b/src/Element/PhpAnnotation.php index 8a1a065..4caf34c 100755 --- a/src/Element/PhpAnnotation.php +++ b/src/Element/PhpAnnotation.php @@ -64,7 +64,7 @@ protected function getPhpContent() $content = array( $fullContent, ); - if (strlen($fullContent) > $this->getMaxLength()) { + if ($this->getPhpName() === '' && strlen($fullContent) > $this->getMaxLength()) { $content = explode(self::BREAK_LINE_CHAR, wordwrap($fullContent, $this->getMaxLength(), self::BREAK_LINE_CHAR, true)); } return array_map(function ($element) { diff --git a/tests/Element/PhpAnnotationBlockTest.php b/tests/Element/PhpAnnotationBlockTest.php index 164a5ff..2ff675e 100755 --- a/tests/Element/PhpAnnotationBlockTest.php +++ b/tests/Element/PhpAnnotationBlockTest.php @@ -48,10 +48,7 @@ public function testGetSeveralLinesWithNameToString() )); $this->assertSame("/**\n" . - " * @description This sample annotation is on one line This sample annotation is on\n" . - " * one line This sample annotation is on one line This sample annotation is on one\n" . - " * line This sample annotation is on one line This sample annotation is on one line\n" . - " * This sample annotation is on one line\n" . + " * @description This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line\n" . " */", $annotationBlock->toString()); } @@ -96,10 +93,7 @@ public function testToStringSeveralLinesWithNameToString() )); $this->assertSame("/**\n" . - " * @description This sample annotation is on one line This sample annotation is on\n" . - " * one line This sample annotation is on one line This sample annotation is on one\n" . - " * line This sample annotation is on one line This sample annotation is on one line\n" . - " * This sample annotation is on one line\n" . + " * @description This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line\n" . " */", $annotationBlock->toString()); } diff --git a/tests/Element/PhpAnnotationTest.php b/tests/Element/PhpAnnotationTest.php index e06ab08..c83ff3d 100755 --- a/tests/Element/PhpAnnotationTest.php +++ b/tests/Element/PhpAnnotationTest.php @@ -35,15 +35,12 @@ public function testGetSeveralLinesWithNamePhpDeclaration() { $annotation = new PhpAnnotation('description', str_repeat('This sample annotation is on one line ', 7)); - $this->assertSame(" * @description This sample annotation is on one line This sample annotation is on\n" . - " * one line This sample annotation is on one line This sample annotation is on one\n" . - " * line This sample annotation is on one line This sample annotation is on one line\n" . - " * This sample annotation is on one line", $annotation->getPhpDeclaration()); + $this->assertSame(" * @description This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line", $annotation->getPhpDeclaration()); } public function testGetSeveralLinesLargerWithNamePhpDeclaration() { - $annotation = new PhpAnnotation('description', str_repeat('This sample annotation is on one line ', 7), 300); + $annotation = new PhpAnnotation('description', str_repeat('This sample annotation is on one line ', 7)); $this->assertSame(" * @description This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line This sample annotation is on one line", $annotation->getPhpDeclaration()); } From 59d8fce9d7fa4c1c0958d17370a18f10618b3cce Mon Sep 17 00:00:00 2001 From: Mikael DELSOL Date: Tue, 29 Mar 2016 18:50:41 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0f3c6b..427e9af 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## WIP +- issue #5 - No autocomplete because of return type on a new line after @return in annotation + ## 1.0.1 - issue #4 - Cyrillic alphabet is not handled well From 83bf24f66ae2ae09a7785815fce10980ac3c3462 Mon Sep 17 00:00:00 2001 From: Mikael DELSOL Date: Tue, 29 Mar 2016 19:07:39 +0200 Subject: [PATCH 3/3] udpate changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 427e9af..7753514 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## WIP +## 1.1.0 - issue #5 - No autocomplete because of return type on a new line after @return in annotation ## 1.0.1