Skip to content

Commit 33d9bc7

Browse files
committed
Add integration tests for entity manager merge return
1 parent 3bc1e27 commit 33d9bc7

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

tests/DoctrineIntegration/ORM/EntityManagerIntegrationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function dataTopics(): array
1515
return [
1616
['entityManagerDynamicReturn'],
1717
['entityRepositoryDynamicReturn'],
18+
['entityManagerMergeReturn'],
1819
];
1920
}
2021

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\DoctrineIntegration\ORM\EntityManagerMergeReturn;
4+
5+
use Doctrine\ORM\EntityManagerInterface;
6+
use Doctrine\ORM\EntityRepository;
7+
use RuntimeException;
8+
9+
class Example
10+
{
11+
/**
12+
* @var EntityManagerInterface
13+
*/
14+
private $entityManager;
15+
16+
public function __construct(EntityManagerInterface $entityManager)
17+
{
18+
$this->entityManager = $entityManager;
19+
}
20+
21+
public function merge(): void
22+
{
23+
$test = $this->entityManager->merge(new MyEntity());
24+
$test->doSomething();
25+
}
26+
}
27+
28+
/**
29+
* @ORM\Entity()
30+
*/
31+
class MyEntity
32+
{
33+
public function doSomething(): void
34+
{
35+
}
36+
}

0 commit comments

Comments
 (0)