Skip to content

Commit e317317

Browse files
committed
Update stubs to be more strict about mixed vs. object
1 parent 062fc75 commit e317317

20 files changed

+115
-36
lines changed

stubs/Collections/ArrayCollection.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Doctrine\Common\Collections;
44

55
/**
6-
* @template TKey
6+
* @template TKey of array-key
77
* @template T
88
* @implements Collection<TKey,T>
99
* @implements Selectable<TKey,T>

stubs/DocumentManager.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class DocumentManager implements ObjectManager
5050
public function getPartialReference($documentName, $identifier);
5151

5252
/**
53-
* @template T
53+
* @template T of object
5454
* @phpstan-param T $entity
5555
* @phpstan-param bool $deep
5656
* @phpstan-return T

stubs/EntityManager.stub

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class EntityManager implements EntityManagerInterface
66
{
77

88
/**
9-
* @template T
9+
* @template T of object
1010
* @phpstan-param class-string<T> $entityName
1111
* @phpstan-param mixed $id
1212
* @phpstan-param integer|null $lockMode
@@ -16,30 +16,30 @@ class EntityManager implements EntityManagerInterface
1616
public function find($entityName, $id, $lockMode = null, $lockVersion = null);
1717

1818
/**
19-
* @template T
19+
* @template T of object
2020
* @phpstan-param T $entity
2121
* @phpstan-return T
2222
* @deprecated 2.7 This method is being removed from the ORM and won't have any replacement
2323
*/
2424
public function merge($entity);
2525

2626
/**
27-
* @template T
27+
* @template T of object
2828
* @phpstan-param class-string<T> $entityName
2929
* @phpstan-return EntityRepository<T>
3030
*/
3131
public function getRepository($entityName);
3232

3333
/**
34-
* @template T
34+
* @template T of object
3535
* @phpstan-param class-string<T> $entityName
3636
* @phpstan-param mixed $id
3737
* @phpstan-return T|null
3838
*/
3939
public function getReference($entityName, $id);
4040

4141
/**
42-
* @template T
42+
* @template T of object
4343
* @phpstan-param class-string<T> $entityName
4444
* @phpstan-param mixed $identifier
4545
*
@@ -48,7 +48,7 @@ class EntityManager implements EntityManagerInterface
4848
public function getPartialReference($entityName, $identifier);
4949

5050
/**
51-
* @template T
51+
* @template T of object
5252
* @phpstan-param T $entity
5353
* @phpstan-param bool $deep
5454
* @phpstan-return T

stubs/EntityManagerDecorator.stub

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class EntityManagerDecorator implements EntityManagerInterface
99
{
1010

1111
/**
12-
* @template T
12+
* @template T of object
1313
* @phpstan-param class-string<T> $entityName
1414
* @phpstan-param mixed $id
1515
* @phpstan-param integer|null $lockMode
@@ -19,29 +19,29 @@ class EntityManagerDecorator implements EntityManagerInterface
1919
public function find($entityName, $id, $lockMode = null, $lockVersion = null);
2020

2121
/**
22-
* @template T
22+
* @template T of object
2323
* @phpstan-param T $entity
2424
* @phpstan-return T
2525
*/
2626
public function merge($entity);
2727

2828
/**
29-
* @template T
29+
* @template T of object
3030
* @phpstan-param class-string<T> $entityName
3131
* @phpstan-return EntityRepository<T>
3232
*/
3333
public function getRepository($entityName);
3434

3535
/**
36-
* @template T
36+
* @template T of object
3737
* @phpstan-param class-string<T> $entityName
3838
* @phpstan-param mixed $id
3939
* @phpstan-return T|null
4040
*/
4141
public function getReference($entityName, $id);
4242

4343
/**
44-
* @template T
44+
* @template T of object
4545
* @phpstan-param class-string<T> $entityName
4646
* @phpstan-param mixed $identifier
4747
*
@@ -50,7 +50,7 @@ class EntityManagerDecorator implements EntityManagerInterface
5050
public function getPartialReference($entityName, $identifier);
5151

5252
/**
53-
* @template T
53+
* @template T of object
5454
* @phpstan-param T $entity
5555
* @phpstan-param bool $deep
5656
* @phpstan-return T

stubs/EntityManagerInterface.stub

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ interface EntityManagerInterface extends ObjectManager
99
{
1010

1111
/**
12-
* @template T
12+
* @template T of object
1313
* @phpstan-param class-string<T> $className
1414
* @phpstan-param mixed $id
1515
* @phpstan-return T|null
1616
*/
1717
public function find($className, $id);
1818

1919
/**
20-
* @template T
20+
* @template T of object
2121
* @phpstan-param T $object
2222
* @phpstan-return T
2323
*/
2424
public function merge($object);
2525

2626
/**
27-
* @template T
27+
* @template T of object
2828
* @phpstan-param class-string<T> $className
2929
* @phpstan-return ObjectRepository<T>
3030
*/
3131
public function getRepository($className);
3232

3333
/**
34-
* @template T
34+
* @template T of object
3535
* @phpstan-param class-string<T> $entityName
3636
* @phpstan-param mixed $id
3737
* @phpstan-return T|null
3838
*/
3939
public function getReference($entityName, $id);
4040

4141
/**
42-
* @template T
42+
* @template T of object
4343
* @phpstan-param class-string<T> $entityName
4444
* @phpstan-param mixed $identifier
4545
*
@@ -48,7 +48,7 @@ interface EntityManagerInterface extends ObjectManager
4848
public function getPartialReference($entityName, $identifier);
4949

5050
/**
51-
* @template T
51+
* @template T of object
5252
* @phpstan-param T $entity
5353
* @phpstan-param bool $deep
5454
* @phpstan-return T

stubs/EntityRepository.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use Doctrine\Common\Collections\Criteria;
66
use Doctrine\Persistence\ObjectRepository;
77

88
/**
9-
* @template TEntityClass
9+
* @template TEntityClass of object
1010
* @implements ObjectRepository<TEntityClass>
1111
*/
1212
class EntityRepository implements ObjectRepository

stubs/ORM/AbstractQuery.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ abstract class AbstractQuery
88
{
99

1010
/**
11-
* @param ArrayCollection<mixed, mixed>|array<mixed> $parameters
11+
* @param ArrayCollection<array-key, mixed>|array<mixed> $parameters
1212
* @return static
1313
*/
1414
public function setParameters($parameters)

stubs/ORM/QueryBuilder.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class QueryBuilder
66
{
77

88
/**
9-
* @param \Doctrine\Common\Collections\ArrayCollection<mixed, mixed>|array<mixed> $parameters
9+
* @param \Doctrine\Common\Collections\ArrayCollection<array-key, mixed>|array<mixed> $parameters
1010
* @return static
1111
*/
1212
public function setParameters($parameters)

stubs/Persistence/ManagerRegistry.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface ManagerRegistry
66
{
77

88
/**
9-
* @template T
9+
* @template T of object
1010
* @phpstan-param class-string<T> $persistentObject
1111
* @phpstan-param string $persistentManagerName
1212
* @phpstan-return ObjectRepository<T>

stubs/Persistence/ObjectManager.stub

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ interface ObjectManager
66
{
77

88
/**
9-
* @template T
9+
* @template T of object
1010
* @phpstan-param class-string<T> $className
1111
* @phpstan-param mixed $id
1212
* @phpstan-return T|null
1313
*/
1414
public function find($className, $id);
1515

1616
/**
17-
* @template T
17+
* @template T of object
1818
* @phpstan-param T $object
1919
* @phpstan-return T
2020
*/
2121
public function merge($object);
2222

2323
/**
24-
* @template T
24+
* @template T of object
2525
* @phpstan-param class-string<T> $className
2626
* @phpstan-return ObjectRepository<T>
2727
*/

0 commit comments

Comments
 (0)