Repository: doctrine/persistence (language: php)

Issue:
Unexpected response returned from `AbstractManagerRegistry::getManagerNames()`
The `ManagerRegistry::getManagerNames()` should return `An array of object manager names. string[]`

https://github.com/doctrine/persistence/blob/0130920efd696cf5480744f499672b2d4ca47c85/lib/Doctrine/Persistence/ManagerRegistry.php#L65-L70

But the implementation in `AbstractManagerRegistry` returns an array of serviceId indexed by name.

https://github.com/doctrine/persistence/blob/0130920efd696cf5480744f499672b2d4ca47c85/lib/Doctrine/Persistence/AbstractManagerRegistry.php#L194-L197

I'm not sure what is the expected response. I would expect that `getManagerNames` returned `['foo', 'bar']`. I would expect such code worked: But this is not the case.

```php
foreach ($this->registry->getManagerNames() as $name) {
  dump($this->registry->getManager($name));
}
```

But fixing it in the `AbstractManagerRegistry` class could be a BC break.
Otherwise, we should improve the documentation of the interface.


Discussion / hints:
Note that the interface has been changed in 3.0: https://github.com/doctrine/persistence/pull/50
That method does not seem to be covered by any tests though :(

[An org-wide search](https://github.com/search?q=org%3Adoctrine+getManagerNames&type=code) shows that it is supposed to return `array<string, string>`. I think it's fine to improve the documentation in the interface. I'm on it.

Fix patch:
diff --git a/lib/Doctrine/Persistence/ManagerRegistry.php b/lib/Doctrine/Persistence/ManagerRegistry.php
index ca3443b3..5398fd1d 100644
--- a/lib/Doctrine/Persistence/ManagerRegistry.php
+++ b/lib/Doctrine/Persistence/ManagerRegistry.php
@@ -63,9 +63,12 @@ public function resetManager($name = null);
     public function getAliasNamespace($alias);
 
     /**
-     * Gets all object manager names.
+     * Gets all object manager names and associated service IDs. A service ID
+     * is a string that allows to obtain an object manager, typically from a
+     * PSR-11 container.
      *
-     * @return string[] An array of object manager names.
+     * @return array<string,string> An array with object manager names as keys,
+     *                              and service IDs as values.
      */
     public function getManagerNames();
 


Test patch: