Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken return types in AbstractManagerRegistry #372

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions src/Persistence/AbstractManagerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
*
* @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): ObjectManager;
abstract protected function getService(string $name): object;

/**
* Resets the given services.
Expand All @@ -55,7 +55,7 @@
return $this->name;
}

public function getConnection(string|null $name = null): ObjectManager
public function getConnection(string|null $name = null): object

Check warning on line 58 in src/Persistence/AbstractManagerRegistry.php

View check run for this annotation

Codecov / codecov/patch

src/Persistence/AbstractManagerRegistry.php#L58

Added line #L58 was not covered by tests
{
if ($name === null) {
$name = $this->defaultConnection;
Expand Down Expand Up @@ -106,7 +106,7 @@
*
* @throws InvalidArgumentException
*/
public function getManager(string|null $name = null): ObjectManager

Check failure on line 109 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / Psalm (8.3)

MoreSpecificReturnType

src/Persistence/AbstractManagerRegistry.php:109:59: MoreSpecificReturnType: The declared return type 'Doctrine\Persistence\ObjectManager' for Doctrine\Persistence\AbstractManagerRegistry::getManager is more specific than the inferred return type 'object' (see https://psalm.dev/070)
{
if ($name === null) {
$name = $this->defaultManager;
Expand All @@ -118,10 +118,10 @@
);
}

return $this->getService($this->managers[$name]);

Check failure on line 121 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (8.3)

Method Doctrine\Persistence\AbstractManagerRegistry::getManager() should return Doctrine\Persistence\ObjectManager but returns object.

Check failure on line 121 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / Psalm (8.3)

LessSpecificReturnStatement

src/Persistence/AbstractManagerRegistry.php:121:16: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'Doctrine\Persistence\ObjectManager' for Doctrine\Persistence\AbstractManagerRegistry::getManager (see https://psalm.dev/129)
}

public function getManagerForClass(string $class): ObjectManager|null

Check failure on line 124 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / Psalm (8.3)

MoreSpecificReturnType

src/Persistence/AbstractManagerRegistry.php:124:56: MoreSpecificReturnType: The declared return type 'Doctrine\Persistence\ObjectManager|null' for Doctrine\Persistence\AbstractManagerRegistry::getManagerForClass is more specific than the inferred return type 'null|object' (see https://psalm.dev/070)
{
$proxyClass = new ReflectionClass($class);
if ($proxyClass->isAnonymous()) {
Expand All @@ -141,8 +141,8 @@
foreach ($this->managers as $id) {
$manager = $this->getService($id);

if (! $manager->getMetadataFactory()->isTransient($class)) {

Check failure on line 144 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (8.3)

Call to an undefined method object::getMetadataFactory().
return $manager;

Check failure on line 145 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (8.3)

Method Doctrine\Persistence\AbstractManagerRegistry::getManagerForClass() should return Doctrine\Persistence\ObjectManager|null but returns object.

Check failure on line 145 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / Psalm (8.3)

LessSpecificReturnStatement

src/Persistence/AbstractManagerRegistry.php:145:24: LessSpecificReturnStatement: The type 'object' is more general than the declared return type 'Doctrine\Persistence\ObjectManager|null' for Doctrine\Persistence\AbstractManagerRegistry::getManagerForClass (see https://psalm.dev/129)
}
}

Expand All @@ -160,7 +160,7 @@
/**
* {@inheritDoc}
*/
public function getManagers(): array

Check failure on line 163 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / Psalm (8.3)

MoreSpecificReturnType

src/Persistence/AbstractManagerRegistry.php:163:36: MoreSpecificReturnType: The declared return type 'array<string, Doctrine\Persistence\ObjectManager>' for Doctrine\Persistence\AbstractManagerRegistry::getManagers is more specific than the inferred return type 'array<string, object>' (see https://psalm.dev/070)
{
$managers = [];

Expand All @@ -169,7 +169,7 @@
$managers[$name] = $manager;
}

return $managers;

Check failure on line 172 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (8.3)

Method Doctrine\Persistence\AbstractManagerRegistry::getManagers() should return array<string, Doctrine\Persistence\ObjectManager> but returns array<string, object>.

Check failure on line 172 in src/Persistence/AbstractManagerRegistry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / Psalm (8.3)

LessSpecificReturnStatement

src/Persistence/AbstractManagerRegistry.php:172:16: LessSpecificReturnStatement: The type 'array<string, object>' is more general than the declared return type 'array<string, Doctrine\Persistence\ObjectManager>' for Doctrine\Persistence\AbstractManagerRegistry::getManagers (see https://psalm.dev/129)
}

public function getRepository(
Expand Down
Loading