From 2834c4b88b00140272a98e1dfccb459900d5ed62 Mon Sep 17 00:00:00 2001 From: rosier Date: Mon, 20 Jan 2020 20:11:07 +0100 Subject: [PATCH] Consider container as always set This implies removing an unnecessary check, and documenting the property holding the container as non-nullable. --- Repository/ContainerRepositoryFactory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Repository/ContainerRepositoryFactory.php b/Repository/ContainerRepositoryFactory.php index 92aa2fdc1..aa6c7f0f5 100644 --- a/Repository/ContainerRepositoryFactory.php +++ b/Repository/ContainerRepositoryFactory.php @@ -18,7 +18,7 @@ final class ContainerRepositoryFactory implements RepositoryFactory /** @var ObjectRepository[] */ private $managedRepositories = []; - /** @var ContainerInterface|null */ + /** @var ContainerInterface */ private $container; /** @@ -40,7 +40,7 @@ public function getRepository(EntityManagerInterface $entityManager, $entityName $customRepositoryName = $metadata->customRepositoryClassName; if ($customRepositoryName !== null) { // fetch from the container - if ($this->container && $this->container->has($customRepositoryName)) { + if ($this->container->has($customRepositoryName)) { $repository = $this->container->get($customRepositoryName); if (! $repository instanceof ObjectRepository) {