8000 throw when invalid · symfony/symfony@262906b · GitHub
[go: up one dir, main page]

Skip to content

Commit 262906b

Browse files
committed
throw when invalid
1 parent 837013b commit 262906b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ - 8B89 38,9 +38,11 @@ public function __construct($entityManager)
3838
{
3939
if ($entityManager instanceof EntityManagerInterface) {
4040
$this->entityManager = $entityManager;
41-
} else {
41+
} elseif ($entityManager instanceof ClassMetadataFactory) {
4242
@trigger_error(sprintf('Injecting an instance of "%s" in "%s" is deprecated since Symfony 4.2, inject an instance of "%s" instead.', ClassMetadataFactory::class, __CLASS__, EntityManagerInterface::class), E_USER_DEPRECATED);
4343
$this->classMetadataFactory = $entityManager;
44+
} else {
45+
throw new \InvalidArgumentException(sprintf('$entityManager must be an instance of "%s", "%s" given.', EntityManagerInterface::class, \is_object($entityManager) ? \get_class($entityManager) : \gettype($entityManager)));
4446
}
4547
}
4648

0 commit comments

Comments
 (0)
0