fix: SA: Fix "might not be defined" rule.

SA stands for Static Analysis.
This commit is contained in:
Pol Dellaiera
2021-11-16 11:41:12 +01:00
parent a7b96f1756
commit f8aeb08594
14 changed files with 365 additions and 620 deletions

View File

@@ -274,6 +274,8 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface
$jsonCriterias
);
$entity = null;
switch (true) {
case count($results) === 0:
$entity = $repository->getClassName();
@@ -291,6 +293,10 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface
);
}
if (null === $entity) {
throw new Exception('Unable to create entity.');
}
return $entity;
}