Skip to content

Commit 53c572a

Browse files
authored
Merge pull request #375 from greg0ire/fix-types-amr
Relax type declaration
2 parents bf7aab0 + 4032a87 commit 53c572a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Persistence/AbstractManagerRegistry.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use InvalidArgumentException;
88
use ReflectionClass;
99

10+
use function assert;
1011
use function sprintf;
1112

1213
/**
@@ -63,7 +64,7 @@ public function __construct(
6364
*
6465
* @param string $name The name of the service.
6566
*
66-
* @return ObjectManager The instance of the given service.
67+
* @return object The instance of the given service.
6768
*/
6869
abstract protected function getService(string $name);
6970

@@ -160,7 +161,10 @@ public function getManager(?string $name = null)
160161
);
161162
}
162163

163-
return $this->getService($this->managers[$name]);
164+
$service = $this->getService($this->managers[$name]);
165+
assert($service instanceof ObjectManager);
166+
167+
return $service;
164168
}
165169

166170
/**
@@ -185,6 +189,7 @@ public function getManagerForClass(string $class)
185189

186190
foreach ($this->managers as $id) {
187191
$manager = $this->getService($id);
192+
assert($manager instanceof ObjectManager);
188193

189194
if (! $manager->getMetadataFactory()->isTransient($class)) {
190195
return $manager;
@@ -210,7 +215,8 @@ public function getManagers()
210215
$managers = [];
211216

212217
foreach ($this->managers as $name => $id) {
213-
$manager = $this->getService($id);
218+
$manager = $this->getService($id);
219+
assert($manager instanceof ObjectManager);
214220
$managers[$name] = $manager;
215221
}
216222

0 commit comments

Comments
 (0)