2

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

这是我的代码

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

它适用于具有如下文档块的类:

/**
 * 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();

任何帮助表示赞赏

4

1 回答 1

2

有类似的问题。我猜你有 Windows 行尾。尝试将行尾从 Windows 转换为 Unix 样式。

于 2012-10-23T06:46:50.580 回答