Skip to content

Commit 9b3d89d

Browse files
committed
Merge branch '2.11.x' into 3.0.x
* 2.11.x: Run static analysis with language level PHP 8.1 (doctrine#9314) Document LockMode enums (doctrine#9319) Document PHPUnit mocks with intersection types (doctrine#9318) Run PHP CodeSniffer on PHP 8.1 (doctrine#9317) Psalm 4.17.0 (doctrine#9315) Run static analysis on PHP 8.1 (doctrine#9310)
2 parents f151daa + 1599975 commit 9b3d89d

28 files changed

+93
-85
lines changed

.github/workflows/coding-standard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ jobs:
1212
coding-standards:
1313
uses: "doctrine/.github/.github/workflows/[email protected]"
1414
with:
15-
php-version: "8.0"
15+
php-version: "8.1"

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
php-version:
21-
- "8.0"
21+
- "8.1"
2222
dbal-version:
2323
- "default"
2424

@@ -53,7 +53,7 @@ jobs:
5353
fail-fast: false
5454
matrix:
5555
php-version:
56-
- "8.0"
56+
- "8.1"
5757
dbal-version:
5858
- "default"
5959

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"phpunit/phpunit": "^9.5",
4646
"squizlabs/php_codesniffer": "3.6.2",
4747
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
48-
"vimeo/psalm": "4.16.1"
48+
"vimeo/psalm": "4.17.0"
4949
},
5050
"conflict": {
5151
"doctrine/annotations": "<1.13 || >= 2.0"

lib/Doctrine/ORM/EntityManager.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ public function flush($entity = null)
374374
* @param int|null $lockVersion The version of the entity to find when using
375375
* optimistic locking.
376376
* @psalm-param class-string<T> $className
377+
* @psalm-param LockMode::*|null $lockMode
377378
*
378379
* @return object|null The entity instance or NULL if the entity can not be found.
379380
* @psalm-return ?T
@@ -946,6 +947,8 @@ public function hasFilters()
946947
}
947948

948949
/**
950+
* @psalm-param LockMode::* $lockMode
951+
*
949952
* @throws OptimisticLockException
950953
* @throws TransactionRequiredException
951954
*/

lib/Doctrine/ORM/EntityManagerInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use DateTimeInterface;
88
use Doctrine\Common\EventManager;
99
use Doctrine\DBAL\Connection;
10+
use Doctrine\DBAL\LockMode;
1011
use Doctrine\ORM\Exception\ORMException;
1112
use Doctrine\ORM\Internal\Hydration\AbstractHydrator;
1213
use Doctrine\ORM\Proxy\ProxyFactory;
@@ -204,6 +205,7 @@ public function close();
204205
* @param object $entity
205206
* @param int $lockMode
206207
* @param int|DateTimeInterface|null $lockVersion
208+
* @psalm-param LockMode::* $lockMode
207209
*
208210
* @return void
209211
*

lib/Doctrine/ORM/EntityRepository.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Doctrine\Common\Collections\Collection;
99
use Doctrine\Common\Collections\Criteria;
1010
use Doctrine\Common\Collections\Selectable;
11+
use Doctrine\DBAL\LockMode;
1112
use Doctrine\Deprecations\Deprecation;
1213
use Doctrine\Inflector\Inflector;
1314
use Doctrine\Inflector\InflectorFactory;
@@ -164,6 +165,7 @@ public function clear()
164165
* or NULL if no specific lock mode should be used
165166
* during the search.
166167
* @param int|null $lockVersion The lock version.
168+
* @psalm-param LockMode::*|null $lockMode
167169
*
168170
* @return object|null The entity instance or NULL if the entity can not be found.
169171
* @psalm-return ?T

lib/Doctrine/ORM/LazyCriteriaCollection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Doctrine\Common\Collections\Criteria;
1010
use Doctrine\Common\Collections\Selectable;
1111
use Doctrine\ORM\Persisters\Entity\EntityPersister;
12+
use ReturnTypeWillChange;
1213

1314
/**
1415
* A lazy collection that allows a fast count when using criteria object
@@ -38,6 +39,7 @@ public function __construct(EntityPersister $entityPersister, Criteria $criteria
3839
*
3940
* @return int
4041
*/
42+
#[ReturnTypeWillChange]
4143
public function count()
4244
{
4345
if ($this->isInitialized()) {

lib/Doctrine/ORM/PersistentCollection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Doctrine\Common\Collections\Criteria;
1111
use Doctrine\Common\Collections\Selectable;
1212
use Doctrine\ORM\Mapping\ClassMetadata;
13+
use ReturnTypeWillChange;
1314
use RuntimeException;
1415

1516
use function array_combine;
@@ -504,6 +505,7 @@ public function offsetSet($offset, $value): void
504505
*
505506
* @return object|null
506507
*/
508+
#[ReturnTypeWillChange]
507509
public function offsetUnset($offset)
508510
{
509511
return $this->remove($offset);

lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,7 @@ public function lock(array $criteria, $lockMode)
15371537
* Gets the FROM and optionally JOIN conditions to lock the entity managed by this persister.
15381538
*
15391539
* @param int|null $lockMode One of the Doctrine\DBAL\LockMode::* constants.
1540+
* @psalm-param LockMode::*|null $lockMode
15401541
*
15411542
* @return string
15421543
*/

lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Doctrine\ORM\Persisters\Entity;
66

77
use Doctrine\Common\Collections\Criteria;
8+
use Doctrine\DBAL\LockMode;
89
use Doctrine\ORM\Mapping\ClassMetadata;
910
use Doctrine\ORM\Mapping\MappingException;
1011
use Doctrine\ORM\PersistentCollection;
@@ -54,6 +55,7 @@ public function getInsertSQL();
5455
* @param int|null $limit
5556
* @param int|null $offset
5657
* @param mixed[]|null $orderBy
58+
* @psalm-param LockMode::*|null $lockMode
5759
*
5860
* @return string
5961
*/
@@ -185,6 +187,7 @@ public function getOwningTable($fieldName);
185187
* @psalm-param array<string, mixed> $criteria
186188
* @psalm-param array<string, mixed>|null $assoc
187189
* @psalm-param array<string, mixed> $hints
190+
* @psalm-param LockMode::*|null $lockMode
188191
* @psalm-param array<string, string>|null $orderBy
189192
*
190193
* @return object|null The loaded and managed entity instance or NULL if the entity can not be found.
@@ -239,6 +242,7 @@ public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifie
239242
* @psalm-param array<string, mixed> $id The identifier of the entity as an
240243
* associative array from column or
241244
* field names to values.
245+
* @psalm-param LockMode::*|null $lockMode
242246
*
243247
* @return void
244248
*/
@@ -300,6 +304,7 @@ public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentC
300304
*
301305
* @param int $lockMode One of the Doctrine\DBAL\LockMode::* constants.
302306
* @psalm-param array<string, mixed> $criteria
307+
* @psalm-param LockMode::* $lockMode
303308
*
304309
* @return void
305310
*/

0 commit comments

Comments
 (0)