<NME> TagManager.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 Zend\Code\Reflection\DocBlock;

use Zend\Code\Generic\Prototype\PrototypeClassFactory;
use Zend\Code\Reflection\DocBlock\Tag\TagInterface;

class TagManager extends PrototypeClassFactory
{
    /**
     * @return void
     */
    public function initializeDefaultTags()
    {
        $this->addPrototype(new Tag\ParamTag());
        $this->addPrototype(new Tag\ReturnTag());
        $this->addPrototype(new Tag\MethodTag());
        $this->addPrototype(new Tag\PropertyTag());
        $this->addPrototype(new Tag\AuthorTag());
        $this->addPrototype(new Tag\LicenseTag());
        $this->addPrototype(new Tag\ThrowsTag());
        $this->addPrototype(new Tag\VarTag());
        $this->setGenericPrototype(new Tag\GenericTag());
    }

    public function addTagPrototype(Tag\TagInterface $tag)
    {
        $tagName = strtolower(str_replace(array('-', '_'), '', $tag->getName()));

        if (in_array($tagName, $this->tagNames)) {
            throw new Exception\InvalidArgumentException('A tag with this name already exists in this manager');
    {
        /* @var TagInterface $newTag */
        $newTag = $this->getClonedPrototype($tagName);

        if ($content) {
            $newTag->initialize($content);
        }

        return $newTag;
    }
    public function hasTag($tagName)
    {
        // otherwise, only if its name exists as a key
        return in_array(strtolower(str_replace(array('-', '_'), '', $tagName)), $this->tagNames);
    }

    public function createTag($tagName, $content = null)
    {
        $tagName = strtolower(str_replace(array('-', '_'), '', $tagName));

        if (!$this->hasTag($tagName) && !isset($this->genericTag)) {
            throw new Exception\RuntimeException('This tag name is not supported by this tag manager');

<MSG> Converting $tagName to lower case was causing unit test failures when
retrieving params like exampleTag by name.
<DFF> @@ -32,7 +32,7 @@ class TagManager
 
     public function addTagPrototype(Tag\TagInterface $tag)
     {
-        $tagName = strtolower(str_replace(array('-', '_'), '', $tag->getName()));
+        $tagName = str_replace(array('-', '_'), '', $tag->getName());
 
         if (in_array($tagName, $this->tagNames)) {
             throw new Exception\InvalidArgumentException('A tag with this name already exists in this manager');
@@ -49,12 +49,12 @@ class TagManager
     public function hasTag($tagName)
     {
         // otherwise, only if its name exists as a key
-        return in_array(strtolower(str_replace(array('-', '_'), '', $tagName)), $this->tagNames);
+        return in_array(str_replace(array('-', '_'), '', $tagName), $this->tagNames);
     }
 
     public function createTag($tagName, $content = null)
     {
-        $tagName = strtolower(str_replace(array('-', '_'), '', $tagName));
+        $tagName = str_replace(array('-', '_'), '', $tagName);
 
         if (!$this->hasTag($tagName) && !isset($this->genericTag)) {
             throw new Exception\RuntimeException('This tag name is not supported by this tag manager');

Converting $tagName to lower case was causing unit test failures when retrieving params like exampleTag by name.