Skip to content

Commit 4158915

Browse files
committed
Merge branch '2.12.x' into 3.0.x
* 2.12.x: Fix types on caches (#9507) Fix AbstractQuery::setParameter phpdoc (#9504) Added "false" value to $columnPrefix type declaration. (#9493)
2 parents 954439a + 4ddaa5f commit 4158915

28 files changed

+120
-111
lines changed

lib/Doctrine/ORM/AbstractQuery.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,11 @@ public function setParameters($parameters)
366366
/**
367367
* Sets a query parameter.
368368
*
369-
* @param string|int $key The parameter position or name.
370-
* @param mixed $value The parameter value.
371-
* @param string|null $type The parameter type. If specified, the given value will be run through
372-
* the type conversion of this type. This is usually not needed for
373-
* strings and numeric types.
369+
* @param string|int $key The parameter position or name.
370+
* @param mixed $value The parameter value.
371+
* @param string|int|null $type The parameter type. If specified, the given value will be run through
372+
* the type conversion of this type. This is usually not needed for
373+
* strings and numeric types.
374374
*
375375
* @return $this
376376
*/

lib/Doctrine/ORM/Cache.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ public function containsQuery($regionName);
141141
* Evicts all cached query results under the given name, or default query cache if the region name is NULL.
142142
*
143143
* @param string|null $regionName The cache name associated to the queries being cached.
144+
*
145+
* @return void
144146
*/
145147
public function evictQueryRegion($regionName = null);
146148

lib/Doctrine/ORM/Cache/AssociationCacheEntry.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,26 @@
1010
class AssociationCacheEntry implements CacheEntry
1111
{
1212
/**
13+
* The entity identifier
14+
*
1315
* @readonly Public only for performance reasons, it should be considered immutable.
14-
* @var array<string, mixed> The entity identifier
16+
* @var array<string, mixed>
1517
*/
1618
public $identifier;
1719

1820
/**
21+
* The entity class name
22+
*
1923
* @readonly Public only for performance reasons, it should be considered immutable.
20-
* @var string The entity class name
24+
* @var string
25+
* @psalm-var class-string
2126
*/
2227
public $class;
2328

2429
/**
2530
* @param string $class The entity class.
2631
* @param array<string, mixed> $identifier The entity identifier.
32+
* @psalm-param class-string $class
2733
*/
2834
public function __construct($class, array $identifier)
2935
{

lib/Doctrine/ORM/Cache/CacheException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public static function updateReadOnlyCollection($sourceEntity, $fieldName)
2626
}
2727

2828
/**
29+
* @deprecated This method is not used anymore.
30+
*
2931
* @param string $entityName
3032
*
3133
* @return CacheException
@@ -46,6 +48,8 @@ public static function nonCacheableEntity($entityName)
4648
}
4749

4850
/**
51+
* @deprecated This method is not used anymore.
52+
*
4953
* @param string $entityName
5054
* @param string $field
5155
*

lib/Doctrine/ORM/Cache/CacheFactory.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public function buildCachedEntityPersister(EntityManagerInterface $em, EntityPer
3131
/**
3232
* Build a collection persister for the given relation mapping.
3333
*
34-
* @param EntityManagerInterface $em The entity manager.
35-
* @param CollectionPersister $persister The collection persister that will be cached.
36-
* @param mixed[] $mapping The association mapping.
34+
* @param mixed[] $mapping The association mapping.
3735
*
3836
* @return CachedCollectionPersister
3937
*/
@@ -42,8 +40,7 @@ public function buildCachedCollectionPersister(EntityManagerInterface $em, Colle
4240
/**
4341
* Build a query cache based on the given region name
4442
*
45-
* @param EntityManagerInterface $em The Entity manager.
46-
* @param string $regionName The region name.
43+
* @param string|null $regionName The region name.
4744
*
4845
* @return QueryCache The built query cache.
4946
*/
@@ -52,18 +49,14 @@ public function buildQueryCache(EntityManagerInterface $em, $regionName = null);
5249
/**
5350
* Build an entity hydrator
5451
*
55-
* @param EntityManagerInterface $em The Entity manager.
56-
* @param ClassMetadata $metadata The entity metadata.
57-
*
5852
* @return EntityHydrator The built entity hydrator.
5953
*/
6054
public function buildEntityHydrator(EntityManagerInterface $em, ClassMetadata $metadata);
6155

6256
/**
6357
* Build a collection hydrator
6458
*
65-
* @param EntityManagerInterface $em The Entity manager.
66-
* @param mixed[] $mapping The association mapping.
59+
* @param mixed[] $mapping The association mapping.
6760
*
6861
* @return CollectionHydrator The built collection hydrator.
6962
*/

lib/Doctrine/ORM/Cache/CacheKey.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
abstract class CacheKey
1212
{
1313
/**
14+
* Unique identifier
15+
*
1416
* @readonly Public only for performance reasons, it should be considered immutable.
15-
* @var string Unique identifier
17+
* @var string
1618
*/
1719
public $hash;
1820
}

lib/Doctrine/ORM/Cache/CollectionCacheEntry.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
class CollectionCacheEntry implements CacheEntry
1111
{
1212
/**
13+
* The list of entity identifiers hold by the collection
14+
*
1315
* @readonly Public only for performance reasons, it should be considered immutable.
14-
* @var CacheKey[] The list of entity identifiers hold by the collection
16+
* @var CacheKey[]
1517
*/
1618
public $identifiers;
1719

lib/Doctrine/ORM/Cache/CollectionCacheKey.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,35 @@
1515
class CollectionCacheKey extends CacheKey
1616
{
1717
/**
18+
* The owner entity identifier
19+
*
1820
* @readonly Public only for performance reasons, it should be considered immutable.
19-
* @var array<string, mixed> The owner entity identifier
21+
* @var array<string, mixed>
2022
*/
2123
public $ownerIdentifier;
2224

2325
/**
26+
* The owner entity class
27+
*
2428
* @readonly Public only for performance reasons, it should be considered immutable.
25-
* @var string The owner entity class
29+
* @var string
30+
* @psalm-var class-string
2631
*/
2732
public $entityClass;
2833

2934
/**
35+
* The association name
36+
*
3037
* @readonly Public only for performance reasons, it should be considered immutable.
31-
* @var string The association name
38+
* @var string
3239
*/
3340
public $association;
3441

3542
/**
3643
* @param string $entityClass The entity class.
3744
* @param string $association The field name that represents the association.
3845
* @param array<string, mixed> $ownerIdentifier The identifier of the owning entity.
46+
* @psalm-param class-string $entityClass
3947
*/
4048
public function __construct($entityClass, $association, array $ownerIdentifier)
4149
{

lib/Doctrine/ORM/Cache/CollectionHydrator.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,13 @@
1414
interface CollectionHydrator
1515
{
1616
/**
17-
* @param ClassMetadata $metadata The entity metadata.
18-
* @param CollectionCacheKey $key The cached collection key.
1917
* @param array|mixed[]|Collection $collection The collection.
2018
*
2119
* @return CollectionCacheEntry
2220
*/
2321
public function buildCacheEntry(ClassMetadata $metadata, CollectionCacheKey $key, $collection);
2422

2523
/**
26-
* @param ClassMetadata $metadata The owning entity metadata.
27-
* @param CollectionCacheKey $key The cached collection key.
28-
* @param CollectionCacheEntry $entry The cached collection entry.
29-
* @param PersistentCollection $collection The collection to load the cache into.
30-
*
3124
* @return mixed[]|null
3225
*/
3326
public function loadCacheEntry(ClassMetadata $metadata, CollectionCacheKey $key, CollectionCacheEntry $entry, PersistentCollection $collection);

lib/Doctrine/ORM/Cache/DefaultCache.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class DefaultCache implements Cache
2929
/** @var CacheFactory */
3030
private $cacheFactory;
3131

32-
/** @var QueryCache[] */
32+
/**
33+
* @var QueryCache[]
34+
* @psalm-var array<string, QueryCache>
35+
*/
3336
private $queryCaches = [];
3437

3538
/** @var QueryCache|null */
@@ -260,8 +263,7 @@ public function getQueryCache($regionName = null)
260263
}
261264

262265
/**
263-
* @param ClassMetadata $metadata The entity metadata.
264-
* @param mixed $identifier The entity identifier.
266+
* @param mixed $identifier The entity identifier.
265267
*/
266268
private function buildEntityCacheKey(ClassMetadata $metadata, $identifier): EntityCacheKey
267269
{
@@ -273,9 +275,7 @@ private function buildEntityCacheKey(ClassMetadata $metadata, $identifier): Enti
273275
}
274276

275277
/**
276-
* @param ClassMetadata $metadata The entity metadata.
277-
* @param string $association The field name that represents the association.
278-
* @param mixed $ownerIdentifier The identifier of the owning entity.
278+
* @param mixed $ownerIdentifier The identifier of the owning entity.
279279
*/
280280
private function buildCollectionCacheKey(
281281
ClassMetadata $metadata,
@@ -290,8 +290,7 @@ private function buildCollectionCacheKey(
290290
}
291291

292292
/**
293-
* @param ClassMetadata $metadata The entity metadata.
294-
* @param mixed $identifier The entity identifier.
293+
* @param mixed $identifier The entity identifier.
295294
*
296295
* @return array<string, mixed>
297296
*/

0 commit comments

Comments
 (0)