Skip to content

Commit

Permalink
Merge pull request #375 from greg0ire/fix-types-amr
Browse files Browse the repository at this point in the history
Relax type declaration
  • Loading branch information
greg0ire authored Jun 19, 2024
2 parents bf7aab0 + 4032a87 commit 53c572a
Showing 1 changed file with 9 additions and 3 deletions.
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

0 comments on commit 53c572a

Please sign in to comment.