devsdmf/annotations

PHP 文档块和注解的简单直接处理器

1.0.1 2020-01-03 19:09 UTC

This package is auto-updated.

Last update: 2024-08-29 04:13:07 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License SensioLabsInsight

PHP 文档块和注解的简单直接处理器

安装

只需将以下依赖行添加到您的 composer.json 文件中

{
    "require": {
        "devsdmf/annotations": "1.*"
    }
}

用法

use Devsdmf\Annotations\Reader;
use ReflectionClass;

$reflector = new ReflectionClass('MyClass');
$reader = new Reader();

$annotation = $reader->getClassAnnotations($reflector);

上述示例与大多数 Reflector 接口实现兼容,请查看下面的可用适配器。

适配器

  • ReflectionClass
  • ReflectionFunction
  • ReflectionMethod
  • ReflectionObject
  • ReflectionProperty

测试

要运行测试套件,您需要安装 require-dev 依赖项

$ composer install --dev
$ ./vendor/bin/phpunit

许可证

本库受 MIT 许可证 许可。