Zend_Reflection没有获取某些类的docblock

时间:2012-08-06 22:18:30

标签: php zend-framework reflection doctrine-orm

我正在尝试使用Zend_Reflection来读取某些类的docblock:

这是我的代码

  $r = new Zend_Reflection_Class($class);
  $docblock = $r->getDocblock();

适用于具有以下docblock的类:

/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Barcode
 * @subpackage Renderer
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: Image.php 23775 2011-03-01 17:25:24Z ralph $
 */

/** @see Zend_Barcode_Renderer_RendererAbstract*/
require_once 'Zend/Barcode/Renderer/RendererAbstract.php';

/**
 * Class for rendering the barcode as image
 *
 * @category   Zend
 * @package    Zend_Barcode
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Barcode_Renderer_Image extends Zend_Barcode_Renderer_RendererAbstract

但是在下面的类中,它是一个Doctrine 2实体定义,它不起作用,

<?php
namespace DbEntities\Entity;

/**
 * Class for archived companies
 * 
 * @category DbEntities
 * @package Ycode_DbEntities
 * @copyright Copyright (c) 2012
 * @licence Porprietory Code 
 * @Table(name="Archiveddeal",
 *      indexes={
 *          @index(name="textualIdentifier_idx", columns={"textualIdentifier"}),
 *          @index(name="rank_idx", columns={"rank"}),
 *          @index(name="realunique_idx", columns={"realunique"}),
 *          @index(name="coordinations_idx", columns={"latitude","longitude"})
 *      })
 * @Entity
 * @HumanFriendlyName = "Archived Companies"
 * @author Jim
 */
class Archivedcompany extends \Application_Model_Archivedcompany{

它在我的代码的第2行引发了以下错误:

 No valid tag name found within provided docblock line

第一个文件的$ class值是“Zend_Barcode_Renderer_Image”,第二个文件我尝试了“DbEntities \ Entity \ Archivedcompany”和“\ DbEntities \ Entity \ Archivedcompany”,返回相同的错误。

我不确定是否是混淆ZendReflection的命名空间,当我使用PHP的反射时,一切似乎都有效

 $rc = new ReflectionClass($class);
 $comments = $rc->getDocComment();

感谢任何帮助

1 个答案:

答案 0 :(得分:2)

有类似的问题。我想你有Windows行结尾。尝试将行结尾从Windows转换为Unix风格。