Alexander Melihov 2df454c0c3
Compound validation rule support (#1818)
* Compound validation rule support

* Compound validation rule support

* Compound validation rule support

* Compound validation rule support

* Remove duplicated method

* error during merge

* wrong variable name

* Simplify PR

* Fix CS

* Use same indentation as before

Co-authored-by: Guilhem Niot <guilhem@gniot.fr>
Co-authored-by: Guilhem Niot <guilhem.niot@gmail.com>
2021-06-16 09:59:06 +02:00

29 lines
638 B
PHP

<?php
declare(strict_types=1);
namespace Nelmio\ApiDocBundle\Tests\ModelDescriber\Annotations\Fixture;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Constraints\Compound;
if (!class_exists(Compound::class)) {
class_alias(CompoundStub::class, Compound::class);
}
/**
* @Annotation
*/
final class CompoundValidationRule extends Compound
{
protected function getConstraints(array $options): array
{
return [
new Assert\Type('numeric'),
new Assert\NotBlank(),
new Assert\Positive(),
new Assert\LessThan(5),
];
}
}