diff --git a/hamcrest/Hamcrest/Description.php b/hamcrest/Hamcrest/Description.php index 266bc1c44..b09554b28 100644 --- a/hamcrest/Hamcrest/Description.php +++ b/hamcrest/Hamcrest/Description.php @@ -19,7 +19,7 @@ interface Description * * @param string $text * - * @return \Hamcrest\Description + * @return static */ public function appendText($text); @@ -29,7 +29,7 @@ public function appendText($text); * * @param \Hamcrest\SelfDescribing $value * - * @return \Hamcrest\Description + * @return static */ public function appendDescriptionOf(SelfDescribing $value); @@ -38,7 +38,7 @@ public function appendDescriptionOf(SelfDescribing $value); * * @param mixed $value * - * @return \Hamcrest\Description + * @return static */ public function appendValue($value); @@ -50,7 +50,7 @@ public function appendValue($value); * @param string $end * @param array|\IteratorAggregate|\Iterator $values * - * @return \Hamcrest\Description + * @return static */ public function appendValueList($start, $separator, $end, $values); @@ -64,7 +64,7 @@ public function appendValueList($start, $separator, $end, $values); * @param array|\\IteratorAggregate|\\Iterator $values * must be instances of {@link Hamcrest\SelfDescribing} * - * @return \Hamcrest\Description + * @return static */ public function appendList($start, $separator, $end, $values); } diff --git a/tests/Hamcrest/StringDescriptionTest.php b/tests/Hamcrest/StringDescriptionTest.php index b42b9b469..4a403e994 100644 --- a/tests/Hamcrest/StringDescriptionTest.php +++ b/tests/Hamcrest/StringDescriptionTest.php @@ -162,4 +162,10 @@ public function testSelfDescribingObjectsCanBeAppendedAsIterators() $this->_description->appendList('@start@', '@sep@ ', '@end@', $items->getIterator()); $this->assertEquals('@start@foo@sep@ bar@end@', (string) $this->_description); } + + public function testToStringAppendsSelfDescribing() + { + $description = $this->_description->toString(new \Hamcrest\SampleSelfDescriber('foo')); + $this->assertEquals('foo', $description); + } }