Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelcom committed Mar 29, 2016
2 parents 9f5823e + 83bf24f commit 837760a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 1.1.0
- 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

Expand Down
2 changes: 1 addition & 1 deletion src/Element/PhpAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 2 additions & 8 deletions tests/Element/PhpAnnotationBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down Expand Up @@ -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());
}

Expand Down
7 changes: 2 additions & 5 deletions tests/Element/PhpAnnotationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 837760a

Please sign in to comment.