From 6a98f0391d24e8a654bfa8b97c79334986d12cb2 Mon Sep 17 00:00:00 2001 From: Ilya Antipenko Date: Wed, 13 May 2015 14:03:50 +0300 Subject: [PATCH 1/2] Add return to removeMethodTemplate --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index ec83c4e4949..0a209bff7a0 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -277,10 +277,12 @@ public function ($) * * * @param $ + * + * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. */ public function ($) { -$this->->removeElement($); +return $this->->removeElement($); }'; /** From 60b80c95cc0b80c34a7fbfc2a696776b9812b9c2 Mon Sep 17 00:00:00 2001 From: Ilya Antipenko Date: Sat, 17 Oct 2015 17:14:56 +0300 Subject: [PATCH 2/2] Add phpdoc tests for addXxx() and removeXxx() methods Add tests for return types for addXxx() and removeXxx() methods --- tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index 28cd75ad603..05965f97545 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -263,10 +263,10 @@ public function testGeneratedEntityClass() $this->assertEquals($author, $book->getAuthor()); $comment = new EntityGeneratorComment(); - $book->addComment($comment); + $this->assertInstanceOf($metadata->name, $book->addComment($comment)); $this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $book->getComments()); $this->assertEquals(new \Doctrine\Common\Collections\ArrayCollection(array($comment)), $book->getComments()); - $book->removeComment($comment); + $this->assertInternalType('boolean', $book->removeComment($comment)); $this->assertEquals(new \Doctrine\Common\Collections\ArrayCollection(array()), $book->getComments()); $this->newInstance($isbnMetadata); @@ -363,7 +363,9 @@ public function testMethodDocBlockShouldStartWithBackSlash() $this->assertPhpDocVarType('\Doctrine\Common\Collections\Collection', new \ReflectionProperty($book, 'comments')); $this->assertPhpDocReturnType('\Doctrine\Common\Collections\Collection', new \ReflectionMethod($book, 'getComments')); $this->assertPhpDocParamType('\Doctrine\Tests\ORM\Tools\EntityGeneratorComment', new \ReflectionMethod($book, 'addComment')); + $this->assertPhpDocReturnType('EntityGeneratorBook', new \ReflectionMethod($book, 'addComment')); $this->assertPhpDocParamType('\Doctrine\Tests\ORM\Tools\EntityGeneratorComment', new \ReflectionMethod($book, 'removeComment')); + $this->assertPhpDocReturnType('boolean', new \ReflectionMethod($book, 'removeComment')); $this->assertPhpDocVarType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor', new \ReflectionProperty($book, 'author')); $this->assertPhpDocReturnType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor', new \ReflectionMethod($book, 'getAuthor'));