omasn/reflection-validator
最新稳定版本:1.0.0
Composer 安装命令:
composer require omasn/reflection-validator
包简介
Extends the capability of the symfony validator
README 文档
README
Extends the capability of the symfony validator
Installation
Install the latest version with
$ composer require omasn/reflection-validator
Basic Usage
Example 1:
class A { public int $number; /** @var B[] */ public array $rows; } class B { public int $number; /** @var C[] */ public array $rows; } class C { #[Assert\Positive] public int $number; } $reflValidator = Omasn\ReflectionValidator\ReflectionValidator::createSimple(); $violations = $reflValidator->validate(A::class, [ 'number' => 0, 'rows' => [ [ 'number' => 0, 'rows' => [ [ 'number' => -1, ], ], ], ], ]); self::assertEquals(1, $violations->count());
For contributors
Install cs-fixer
mkdir -p tools/php-cs-fixer
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer
Run tests
Exec: ./vendor/bin/phpunit
Run lint
Exec cs-fixer: tools/php-cs-fixer/vendor/bin/php-cs-fixer fix src
Exec phpstan: ./vendor/bin/phpstan analyse src tests
Exec psalm: ./vendor/bin/psalm
统计信息
- 总下载量: 1.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-15