mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-09 02:59:27 +03:00
Fix the tests (#1720)
* Fix the tests * Add a comment * fix the tests * cs
This commit is contained in:
parent
318fa82cc0
commit
6faec06321
@ -48,7 +48,8 @@ class SymfonyConstraintAnnotationReader
|
|||||||
|
|
||||||
foreach ($annotations as $annotation) {
|
foreach ($annotations as $annotation) {
|
||||||
if ($annotation instanceof Assert\NotBlank || $annotation instanceof Assert\NotNull) {
|
if ($annotation instanceof Assert\NotBlank || $annotation instanceof Assert\NotNull) {
|
||||||
if ($annotation instanceof Assert\NotBlank && $annotation->allowNull) {
|
// To support symfony/validator < 4.3
|
||||||
|
if ($annotation instanceof Assert\NotBlank && \method_exists($annotation, 'allowNull') && $annotation->allowNull) {
|
||||||
// The field is optional
|
// The field is optional
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,10 @@ class SymfonyConstraintAnnotationReaderTest extends TestCase
|
|||||||
|
|
||||||
public function testOptionalProperty()
|
public function testOptionalProperty()
|
||||||
{
|
{
|
||||||
|
if (!\method_exists(Assert\NotBlank::class, 'allowNull')) {
|
||||||
|
$this->markTestSkipped('NotBlank::allowNull was added in symfony/validator 4.3.');
|
||||||
|
}
|
||||||
|
|
||||||
$entity = new class() {
|
$entity = new class() {
|
||||||
/**
|
/**
|
||||||
* @Assert\NotBlank(allowNull = true)
|
* @Assert\NotBlank(allowNull = true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user