<NME> ReturnTagTest.php
<BEF> <?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace ZendTest\Code\Generator\DocBlock\Tag;

use PHPUnit\Framework\TestCase;
use Zend\Code\Generator\DocBlock\Tag\ReturnTag;
use Zend\Code\Generator\DocBlock\TagManager;
use Zend\Code\Reflection\DocBlockReflection;

/**
 * @group Zend_Code_Generator
 * @group Zend_Code_Generator_Php
 */
class ReturnTagTest extends TestCase
{
    /**
     * @var ReturnTag
     */
    protected $tag;

    /**
     * @var TagManager
     */
    protected $tagmanager;

    protected function setUp() : void
    {
        $this->tag = new ReturnTag();
        $this->tagmanager = new TagManager();
        $this->tagmanager->initializeDefaultTags();
    }

    protected function tearDown() : void
    {
        $this->tag = null;
        $this->tagmanager = null;
    }

    public function testNameIsCorrect()
    {
        self::assertEquals('return', $this->tag->getName());
        $this->tag->setDescription('bar bar bar');
        $this->assertEquals('@return string bar bar bar', $this->tag->generate());
    }
}
        $tag = $this->tagmanager->createTagFromReflection($reflectionTag);
        self::assertInstanceOf(ReturnTag::class, $tag);
        self::assertEquals('The return', $tag->getDescription());
        self::assertEquals('int', $tag->getTypesAsString());
    }
}

<MSG> Merge pull request zendframework/zf2#4741 from zionsg/hotfix/4740

Hotfix/4740

<DFF> @@ -49,4 +49,15 @@ class ReturnTagTest extends \PHPUnit_Framework_TestCase
         $this->tag->setDescription('bar bar bar');
         $this->assertEquals('@return string bar bar bar', $this->tag->generate());
     }
+
+    public function testConstructorWithOptions()
+    {
+        $this->tag->setOptions(array(
+            'datatype' => 'string|null',
+        ));
+        $tagWithOptionsFromConstructor = new ReturnTag(array(
+            'datatype' => 'string|null',
+        ));
+        $this->assertEquals($this->tag->generate(), $tagWithOptionsFromConstructor->generate());
+    }
 }

Merge pull request zendframework/zf2#4741 from zionsg/hotfix/4740