Skip to content

Commit 4d2c040

Browse files
committed
Simplified stubs thanks to improvements in PHPStan 0.12.4
This reverts commit af14feb.
1 parent af14feb commit 4d2c040

7 files changed

+10
-106
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
],
88
"require": {
99
"php": "~7.1",
10-
"phpstan/phpstan": "^0.12.3"
10+
"phpstan/phpstan": "^0.12.4"
1111
},
1212
"conflict": {
1313
"doctrine/collections": "<1.0",

stubs/DocumentManager.stub

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ class DocumentManager implements ObjectManager
1818
*/
1919
public function find($documentName, $identifier, $lockMode = null, $lockVersion = null);
2020

21-
/**
22-
* @template T
23-
* @phpstan-param T $document
24-
* @phpstan-return T
25-
*/
26-
public function merge($document);
27-
2821
/**
2922
* @template T
3023
* @phpstan-param class-string<T> $documentName

stubs/DocumentRepository.stub

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class DocumentRepository implements ObjectRepository
1919
*/
2020
public function find($id, $lockMode = null, $lockVersion = null);
2121

22+
// following methods could be removed if we only supported doctrine/persistence ^1.3 because of different implemented ObjectRepository namespace
23+
2224
/**
2325
* @phpstan-return TDocumentClass[]
2426
*/

stubs/EntityManager.stub

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,4 @@ class EntityManager implements EntityManagerInterface
1515
*/
1616
public function find($entityName, $id, $lockMode = null, $lockVersion = null);
1717

18-
/**
19-
* @template T
20-
* @phpstan-param T $entity
21-
* @phpstan-return T
22-
*/
23-
public function merge($entity);
24-
25-
/**
26-
* @template T
27-
* @phpstan-param class-string<T> $entityName
28-
* @phpstan-return EntityRepository<T>
29-
*/
30-
public function getRepository($entityName);
31-
32-
/**
33-
* @template T
34-
* @phpstan-param class-string<T> $entityName
35-
* @phpstan-param mixed $id
36-
* @phpstan-return T|null
37-
*/
38-
public function getReference($entityName, $id);
39-
40-
/**
41-
* @template T
42-
* @phpstan-param class-string<T> $entityName
43-
* @phpstan-param mixed $identifier
44-
*
45-
* @phpstan-return T|null
46-
*/
47-
public function getPartialReference($entityName, $identifier);
48-
49-
/**
50-
* @template T
51-
* @phpstan-param T $entity
52-
* @phpstan-param bool $deep
53-
* @phpstan-return T
54-
*/
55-
public function copy($entity, $deep = false);
56-
5718
}

stubs/EntityManagerDecorator.stub

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,11 @@ class EntityManagerDecorator implements EntityManagerInterface
1818
*/
1919
public function find($entityName, $id, $lockMode = null, $lockVersion = null);
2020

21-
/**
22-
* @template T
23-
* @phpstan-param T $entity
24-
* @phpstan-return T
25-
*/
26-
public function merge($entity);
27-
2821
/**
2922
* @template T
3023
* @phpstan-param class-string<T> $entityName
3124
* @phpstan-return EntityRepository<T>
3225
*/
3326
public function getRepository($entityName);
3427

35-
/**
36-
* @template T
37-
* @phpstan-param class-string<T> $entityName
38-
* @phpstan-param mixed $id
39-
* @phpstan-return T|null
40-
*/
41-
public function getReference($entityName, $id);
42-
43-
/**
44-
* @template T
45-
* @phpstan-param class-string<T> $entityName
46-
* @phpstan-param mixed $identifier
47-
*
48-
* @phpstan-return T|null
49-
*/
50-
public function getPartialReference($entityName, $identifier);
51-
52-
/**
53-
* @template T
54-
* @phpstan-param T $entity
55-
* @phpstan-param bool $deep
56-
* @phpstan-return T
57-
*/
58-
public function copy($entity, $deep = false);
59-
6028
}

stubs/EntityManagerInterface.stub

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,6 @@ use Doctrine\Common\Persistence\ObjectRepository;
88
interface EntityManagerInterface extends ObjectManager
99
{
1010

11-
/**
12-
* @template T
13-
* @phpstan-param class-string<T> $className
14-
* @phpstan-param mixed $id
15-
* @phpstan-return T|null
16-
*/
17-
public function find($className, $id);
18-
19-
/**
20-
* @template T
21-
* @phpstan-param T $object
22-
* @phpstan-return T
23-
*/
24-
public function merge($object);
25-
26-
/**
27-
* @template T
28-
* @phpstan-param class-string<T> $className
29-
* @phpstan-return ObjectRepository<T>
30-
*/
31-
public function getRepository($className);
32-
3311
/**
3412
* @template T
3513
* @phpstan-param class-string<T> $entityName

stubs/EntityRepository.stub

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ use Doctrine\Common\Persistence\ObjectRepository;
1111
class EntityRepository implements ObjectRepository
1212
{
1313

14+
/**
15+
* @phpstan-return class-string<TEntityClass>
16+
*/
17+
protected function getEntityName();
18+
19+
// following methods could be removed if we only supported doctrine/persistence ^1.3 because of different implemented ObjectRepository namespace
20+
1421
/**
1522
* @phpstan-param mixed $id
1623
* @phpstan-param int|null $lockMode
@@ -45,9 +52,4 @@ class EntityRepository implements ObjectRepository
4552
*/
4653
public function getClassName();
4754

48-
/**
49-
* @phpstan-return class-string<TEntityClass>
50-
*/
51-
protected function getEntityName();
52-
5355
}

0 commit comments

Comments
 (0)