Skip to content

Commit 2c64003

Browse files
committed
Add integration tests for entity manager merge return
1 parent b2fb483 commit 2c64003

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\DoctrineIntegration\ORM\EntityManagerMergeReturn;
4+
5+
use Doctrine\ORM\EntityManagerInterface;
6+
use Doctrine\ORM\Mapping as ORM;
7+
8+
class Example
9+
{
10+
/**
11+
* @var EntityManagerInterface
12+
*/
13+
private $entityManager;
14+
15+
public function __construct(EntityManagerInterface $entityManager)
16+
{
17+
$this->entityManager = $entityManager;
18+
}
19+
20+
public function merge(): void
21+
{
22+
$test = $this->entityManager->merge(new MyEntity());
23+
$test->doSomething();
24+
}
25+
}
26+
27+
/**
28+
* @ORM\Entity()
29+
*/
30+
class MyEntity
31+
{
32+
/**
33+
* @ORM\Id()
34+
* @ORM\GeneratedValue()
35+
* @ORM\Column(type="integer")
36+
*
37+
* @var int
38+
*/
39+
private $id;
40+
41+
public function doSomething(): void
42+
{
43+
}
44+
}

0 commit comments

Comments
 (0)