Skip to content

Commit 2b94ec1

Browse files
authored
Merge pull request doctrine#11759 from doctrine/2.20.x
Merge 2.20.x up into 2.21.x
2 parents 2a66214 + a5c80a4 commit 2b94ec1

File tree

14 files changed

+2256
-882
lines changed

14 files changed

+2256
-882
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
"doctrine/coding-standard": "^9.0.2 || ^12.0",
4545
"phpbench/phpbench": "^0.16.10 || ^1.0",
4646
"phpstan/extension-installer": "~1.1.0 || ^1.4",
47-
"phpstan/phpstan": "~1.4.10 || 1.12.6",
48-
"phpstan/phpstan-deprecation-rules": "^1",
47+
"phpstan/phpstan": "~1.4.10 || 2.0.3",
48+
"phpstan/phpstan-deprecation-rules": "^1 || ^2",
4949
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6",
5050
"psr/log": "^1 || ^2 || ^3",
5151
"squizlabs/php_codesniffer": "3.7.2",

phpcs.xml.dist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0"?>
2-
<ruleset>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
name="PHP_CodeSniffer"
4+
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
35
<arg name="basepath" value="."/>
46
<arg name="extensions" value="php"/>
57
<arg name="parallel" value="80"/>

phpstan-baseline.neon

Lines changed: 2232 additions & 845 deletions
Large diffs are not rendered by default.

phpstan-dbal2.neon

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parameters:
77

88
ignoreErrors:
99
# PHPStan doesn't understand our method_exists() safeguards.
10+
- '/Call to function method_exists.*/'
1011
- '/Call to an undefined method Doctrine\\DBAL\\Connection::createSchemaManager\(\)\./'
1112
# Class name will change in DBAL 3.
1213
- '/^Class Doctrine\\DBAL\\Platforms\\PostgreSQLPlatform not found\.$/'
@@ -46,6 +47,16 @@ parameters:
4647
path: src/Query/AST/Functions/LocateFunction.php
4748

4849
# Won't get fixed in DBAL 2
50+
-
51+
message: '#.*deleteItem.*expects string.*#'
52+
count: 1
53+
path: src/Query.php
54+
55+
-
56+
message: '#.*get(Drop|Create)SchemaS(ql|QL).*should return list.*but returns array.*#'
57+
count: 2
58+
path: src/Tools/SchemaTool.php
59+
4960
-
5061
message: "#^Parameter \\#2 \\$start of method Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform\\:\\:getSubstringExpression\\(\\) expects int, string given\\.$#"
5162
count: 1

phpstan-params.neon

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ parameters:
99
Doctrine\ORM\Query\Parser:
1010
- syntaxError
1111
phpVersion: 80400
12-
13-
ignoreErrors:
14-
# Remove on 3.0.x
15-
- '~^Default value of the parameter #2 \$value \(array\{\}\) of method Doctrine\\ORM\\Query\\AST\\InstanceOfExpression\:\:__construct\(\) is incompatible with type non\-empty\-array<int, Doctrine\\ORM\\Query\\AST\\InputParameter\|string>\.$~'

phpstan-persistence2.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ parameters:
9898
path: src/Mapping/ClassMetadataFactory.php
9999

100100
-
101-
message: '#^Parameter \#1 \$classNames of method Doctrine\\ORM\\Mapping\\ClassMetadataInfo\<object\>\:\:setParentClasses\(\) expects array\<int, class\-string\>, array\<string\> given\.$#'
101+
message: '#^Parameter \#1 \$classNames of method Doctrine\\ORM\\Mapping\\ClassMetadataInfo\<object\>\:\:setParentClasses\(\) expects list\<class\-string\>, array\<string\> given\.$#'
102102
path: src/Mapping/ClassMetadataFactory.php

src/Cache/DefaultQueryCache.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ public function put(QueryCacheKey $key, ResultSetMapping $rsm, $result, array $h
262262
$region = $persister->getCacheRegion();
263263

264264
$cm = $this->em->getClassMetadata($entityName);
265-
assert($cm instanceof ClassMetadata);
266265

267266
foreach ($result as $index => $entity) {
268267
$identifier = $this->uow->getEntityIdentifier($entity);

src/Cache/Persister/Entity/AbstractEntityPersister.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Doctrine\ORM\UnitOfWork;
2626

2727
use function array_merge;
28-
use function assert;
2928
use function serialize;
3029
use function sha1;
3130

@@ -614,9 +613,10 @@ public function refresh(array $id, $entity, $lockMode = null)
614613
*/
615614
protected function buildCollectionCacheKey(array $association, $ownerId)
616615
{
617-
$metadata = $this->metadataFactory->getMetadataFor($association['sourceEntity']);
618-
assert($metadata instanceof ClassMetadata);
619-
620-
return new CollectionCacheKey($metadata->rootEntityName, $association['fieldName'], $ownerId);
616+
return new CollectionCacheKey(
617+
$this->metadataFactory->getMetadataFor($association['sourceEntity'])->rootEntityName,
618+
$association['fieldName'],
619+
$ownerId
620+
);
621621
}
622622
}

src/Mapping/ClassMetadataFactory.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,6 @@ private function inheritIdGeneratorMapping(ClassMetadataInfo $class, ClassMetada
830830
*/
831831
protected function wakeupReflection(ClassMetadataInterface $class, ReflectionService $reflService)
832832
{
833-
assert($class instanceof ClassMetadata);
834833
$class->wakeupReflection($reflService);
835834
}
836835

@@ -839,7 +838,6 @@ protected function wakeupReflection(ClassMetadataInterface $class, ReflectionSer
839838
*/
840839
protected function initializeReflection(ClassMetadataInterface $class, ReflectionService $reflService)
841840
{
842-
assert($class instanceof ClassMetadata);
843841
$class->initializeReflection($reflService);
844842
}
845843

src/Mapping/DefaultTypedFieldMapper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ public function validateAndComplete(array $mapping, ReflectionProperty $field):
6868
assert(is_a($type->getName(), BackedEnum::class, true));
6969
$mapping['enumType'] = $type->getName();
7070
$type = $reflection->getBackingType();
71-
72-
assert($type instanceof ReflectionNamedType);
7371
}
7472

7573
if (isset($this->typedFieldMappings[$type->getName()])) {

0 commit comments

Comments
 (0)