Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/Persistence/AbstractManagerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use InvalidArgumentException;
use ReflectionClass;

use function assert;
use function sprintf;

/**
Expand Down Expand Up @@ -63,7 +64,7 @@ public function __construct(
*
* @param string $name The name of the service.
*
* @return ObjectManager The instance of the given service.
* @return object The instance of the given service.
*/
abstract protected function getService(string $name);

Expand Down Expand Up @@ -160,7 +161,10 @@ public function getManager(?string $name = null)
);
}

return $this->getService($this->managers[$name]);
$service = $this->getService($this->managers[$name]);
assert($service instanceof ObjectManager);

return $service;
}

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

foreach ($this->managers as $id) {
$manager = $this->getService($id);
assert($manager instanceof ObjectManager);

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

foreach ($this->managers as $name => $id) {
$manager = $this->getService($id);
$manager = $this->getService($id);
assert($manager instanceof ObjectManager);
$managers[$name] = $manager;
}

Expand Down