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

Remove Proxy from EntityManagerInterface contract #9001

Merged
merged 1 commit into from
Sep 11, 2021
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions lib/Doctrine/ORM/EntityManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use BadMethodCallException;
use DateTimeInterface;
use Doctrine\Common\EventManager;
use Doctrine\Common\Proxy\Proxy;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Internal\Hydration\AbstractHydrator;
use Doctrine\ORM\Proxy\ProxyFactory;
Expand Down Expand Up @@ -170,7 +169,7 @@ public function createQueryBuilder();
* @psalm-param class-string<T> $entityName
*
* @return object|null The entity reference.
* @psalm-return (T&Proxy)|null
* @psalm-return T|null
*
* @throws ORMException
*
Expand Down Expand Up @@ -198,7 +197,7 @@ public function getReference($entityName, $id);
* @psalm-param class-string<T> $entityName
*
* @return object|null The (partial) entity reference
* @psalm-return (T&Proxy)|null
* @psalm-return T|null
*
* @template T
*/
Expand Down
8 changes: 4 additions & 4 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -161,22 +161,22 @@ parameters:
path: lib/Doctrine/ORM/EntityManager.php

-
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getPartialReference\\(\\) should return \\(Doctrine\\\\Common\\\\Proxy\\\\Proxy&T\\)\\|null but returns object\\.$#"
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getPartialReference\\(\\) should return T\\|null but returns object\\.$#"
count: 1
path: lib/Doctrine/ORM/EntityManager.php

-
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getPartialReference\\(\\) should return \\(Doctrine\\\\Common\\\\Proxy\\\\Proxy&T\\)\\|null but returns object\\|null\\.$#"
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getPartialReference\\(\\) should return T\\|null but returns object\\|null\\.$#"
count: 1
path: lib/Doctrine/ORM/EntityManager.php

-
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getReference\\(\\) should return \\(Doctrine\\\\Common\\\\Proxy\\\\Proxy&T\\)\\|null but returns Doctrine\\\\Common\\\\Proxy\\\\Proxy\\.$#"
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getReference\\(\\) should return T\\|null but returns Doctrine\\\\Common\\\\Proxy\\\\Proxy\\.$#"
count: 1
path: lib/Doctrine/ORM/EntityManager.php

-
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getReference\\(\\) should return \\(Doctrine\\\\Common\\\\Proxy\\\\Proxy&T\\)\\|null but returns object\\|null\\.$#"
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getReference\\(\\) should return T\\|null but returns object\\|null\\.$#"
count: 1
path: lib/Doctrine/ORM/EntityManager.php

Expand Down
3 changes: 1 addition & 2 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@
<code>is_object($entity)</code>
<code>is_object($entity)</code>
</DocblockTypeContradiction>
<InvalidReturnStatement occurrences="10">
<InvalidReturnStatement occurrences="9">
<code>$entity</code>
<code>$entity</code>
<code>$entity</code>
Expand All @@ -496,7 +496,6 @@
<code>$entity instanceof $class-&gt;name ? $entity : null</code>
<code>$persister-&gt;load($sortedId, null, null, [], $lockMode)</code>
<code>$persister-&gt;loadById($sortedId)</code>
<code>$this-&gt;find($entityName, $sortedId)</code>
<code>$this-&gt;metadataFactory-&gt;getMetadataFor($className)</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="4">
Expand Down