Download the PHP package easyswoole/annotation without Composer
On this page you can find all versions of the php package easyswoole/annotation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download easyswoole/annotation
More information about easyswoole/annotation
Files in easyswoole/annotation
Download easyswoole/annotation
More information about easyswoole/annotation
Files in easyswoole/annotation
Vendor easyswoole
Package annotation
Short Description easyswoole component
License Apache-2.0
Homepage https://www.easyswoole.com/
Package annotation
Short Description easyswoole component
License Apache-2.0
Homepage https://www.easyswoole.com/
Please rate this library. Is it a good library?
Informations about the package annotation
annotation
实现原理
-
约定
- 每个注解行为@字符开头,格式为
- 执行流程如下:
- 利用php反射得到注释信息
- 用explode用PHP_EOL分割每行
- 解析每行的数据,若存在对应的METHOD AnnotationTagInterface ,则把解析得到的ARGS传递给 AnnotationTagInterface 中的 assetValue 方法, 用户可以在该方法中对解析得到的值进行自定义解析。
- 若为严格模式,如果解析不到正确的数值,则报错。
例子
注释每行前3个字符若存在@,说明该行为需要解析注释行,默认为非严格模式,未注册的tag信息不会解析,严格模式下,若无法解析则会抛出异常。
IDE支持
需要为PHPStorm安装"PHP Annotation"插件以提供注解自动提示能力,插件可以在PHPStorm中直接搜索安装,也可以前往Github下载安装
然后自己编写一个下面这样的注解提示类,重点在于使用@Annotation类注释,标记这是一个注解提示类,PHPStorm索引到该文件,就可以对类名和类的成员进行注解提示
即可实现下面aaa方法的自动注解提示
All versions of annotation with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.1.0
easyswoole/spl Version ^1.1
easyswoole/doctrine-annotations Version ^1.0
easyswoole/spl Version ^1.1
easyswoole/doctrine-annotations Version ^1.0
The package easyswoole/annotation contains the following files
Loading the files please wait ....