Skip to content

Commit 2c1397c

Browse files
committed
[DoctrineBridge] Auto-validation must work if no regex are passed
1 parent 534b6e3 commit 2c1397c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Tests/Validator/DoctrineLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function testClassValidator(bool $expected, string $classValidatorRegexp
173173
public function regexpProvider()
174174
{
175175
return [
176-
[false, null],
176+
[true, null],
177177
[true, '{^'.preg_quote(DoctrineLoaderEntity::class).'$|^'.preg_quote(Entity::class).'$}'],
178178
[false, '{^'.preg_quote(Entity::class).'$}'],
179179
];

Validator/DoctrineLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(EntityManagerInterface $entityManager, string $class
4343
public function loadClassMetadata(ClassMetadata $metadata): bool
4444
{
4545
$className = $metadata->getClassName();
46-
if (null === $this->classValidatorRegexp || !preg_match($this->classValidatorRegexp, $className)) {
46+
if (null !== $this->classValidatorRegexp && !preg_match($this->classValidatorRegexp, $className)) {
4747
return false;
4848
}
4949

0 commit comments

Comments
 (0)