File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 77use InvalidArgumentException ;
88use ReflectionClass ;
99
10+ use function assert ;
1011use 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
You can’t perform that action at this time.
0 commit comments