8000 minor #60021 [DoctrineBridge] Strengthen EM reset logic (nicolas-grekas) · symfony/symfony@901d933 · GitHub
[go: up one dir, main page]

Skip to content

Commit 901d933

Browse files
minor #60021 [DoctrineBridge] Strengthen EM reset logic (nicolas-grekas)
This PR was merged into the 7.3 branch. Discussion ---------- [DoctrineBridge] Strengthen EM reset logic | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Commits ------- e9c6056 [DoctrineBridge] Strengthen EM reset logic
2 parents 2468bae + e9c6056 commit 901d933

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
5959
$name = $this->aliases[$name] ?? $name;
6060
$wrappedInstance = match (true) {
6161
isset($this->fileMap[$name]) => $this->load($this->fileMap[$name], false),
62-
(new \ReflectionMethod($this, $method = $this->methodMap[$name]))->isStatic() => $this->{$method}($this, false),
62+
!$method = $this->methodMap[$name] ?? null => throw new \LogicException(\sprintf('The "%s" service is synthetic and cannot be reset.', $name)),
63+
(new \ReflectionMethod($this, $method))->isStatic() => $this->{$method}($this, false),
6364
default => $this->{$method}(false),
6465
};
6566
$manager->setProxyInitializer(null);
@@ -86,7 +87,8 @@ function () use ($name) {
8687

8788
return match (true) {
8889
isset($this->fileMap[$name]) => $this->load($this->fileMap[$name], false),
89-
(new \ReflectionMethod($this, $method = $this->methodMap[$name]))->isStatic() => $this->{$method}($this, false),
90+
!$method = $this->methodMap[$name] ?? null => throw new \LogicException(\sprintf('The "%s" service is synthetic and cannot be reset.', $name)),
91+
(new \ReflectionMethod($this, $method))->isStatic() => $this->{$method}($this, false),
9092
default => $this->{$method}(false),
9193
};
9294
},

0 commit comments

Comments
 (0)
0