jeremysells / class-detail-mapper
类详情映射器。它检索有关类(例如注释和属性)的信息。
此包的规范存储库似乎已丢失,因此已冻结此包。
dev-develop
2018-12-30 15:54 UTC
Requires
- php: >=7.2
- doctrine/annotations: ^1.6
- ocramius/proxy-manager: ^2.2
- php-di/phpdoc-reader: ^2.1
Requires (Dev)
- jakub-onderka/php-parallel-lint: ^1.0
- phan/phan: ^1.1
- php-di/php-di: ^6.0
- phploc/phploc: ^4.0
- phpmd/phpmd: ^2.6
- phpmetrics/phpmetrics: ^v2.4
- phpstan/phpstan: ^0.10
- phpunit/phpunit: ^7.5
- sebastian/phpcpd: ^4.1
- sensiolabs/security-checker: ^5.0
- squizlabs/php_codesniffer: ^3.4
- vimeo/psalm: ^3.0
This package is auto-updated.
Last update: 2023-12-16 22:42:07 UTC
README
提供类详细信息的库。目前仅支持类属性和类头。它使用 Doctrine 注解和 PHP 反射(也处理 @var 注释)。将来,它可以扩展到函数(如果有需要的话)。
状态
状态:开发中
使用
有关使用说明,请参阅:tests/integration
详细了解 src/Interfaces
中的接口(特别是 src/Interfaces/Entities
),以获取有关响应的详细信息。建议从 src/Interfaces/ClassDetailRepositoryInterface.php
开始。
示例
注意:此库支持 PHP-DI。建议使用该库而不是工厂(以下)。
use JeremySells\Libraries\ClassDetailMapper\Factories\ClassDetailMapperFactory;
use JeremySells\Libraries\ClassDetailMapper\ClassDetailRepository;
use Something\Here\Product;
/** @var ClassDetailRepository $classDetailRepository */
$classDetailRepository = ClassDetailMapperFactory::createClassDetailRepository();
$productClassDetail = $classDetailRepository->getClassDetail(Product::class);
// Header annotation
$headerSomeDoctrineAnnotations = $productClassDetail->getHeader()->getClassAnnotations(SomeDoctrineAnnotation::class);
// Property annotation
$priceProperty = $productClassDetail->getProperties()->getProperty("price");
$types = $priceProperty->getTypeCollection()->getTypesList(); //@var list (with full namespaces resolved)
$someDoctrineAnnotations = $priceProperty->getClassAnnotations(SomeDoctrineAnnotation::class);
待办事项
- 添加函数信息
- 使集合类扩展/实现 ArrayObject
质量保证
要运行质量保证工具(在开发中),您需要安装 Docker(和 Docker-Compose),然后运行 ./qa-dev.sh
。要查看质量保证报告,请参阅:build/reports