Fix property_exists for SymfonyConstraintAnnotationReader

This commit is contained in:
Alex Kalineskou 2020-09-28 22:45:24 +03:00
parent 4436c468f1
commit 3f6afe54cd
2 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ class SymfonyConstraintAnnotationReader
foreach ($annotations as $annotation) {
if ($annotation instanceof Assert\NotBlank || $annotation instanceof Assert\NotNull) {
// To support symfony/validator < 4.3
if ($annotation instanceof Assert\NotBlank && \method_exists($annotation, 'allowNull') && $annotation->allowNull) {
if ($annotation instanceof Assert\NotBlank && \property_exists($annotation, 'allowNull') && $annotation->allowNull) {
// The field is optional
continue;
}

View File

@ -49,7 +49,7 @@ class SymfonyConstraintAnnotationReaderTest extends TestCase
public function testOptionalProperty()
{
if (!\method_exists(Assert\NotBlank::class, 'allowNull')) {
if (!\property_exists(Assert\NotBlank::class, 'allowNull')) {
$this->markTestSkipped('NotBlank::allowNull was added in symfony/validator 4.3.');
}