Skip to content

Commit 636f9dc

Browse files
committed
Fix build
1 parent 8302a6a commit 636f9dc

File tree

6 files changed

+31
-6
lines changed

6 files changed

+31
-6
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.2 || ^8.0",
10-
"phpstan/phpstan": "^1.8.11"
10+
"phpstan/phpstan": "^1.9.7"
1111
},
1212
"conflict": {
1313
"doctrine/collections": "<1.0",

src/Doctrine/Mapping/ClassMetadataFactory.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ protected function initialize(): void
5353
}
5454

5555
/**
56-
* @param string $className
57-
* @return ClassMetadata
56+
* @template T of object
57+
* @param class-string<T> $className
58+
* @return ClassMetadata<T>
5859
*/
5960
protected function newClassMetadataInstance($className)
6061
{

src/Rules/Doctrine/ORM/PropertiesExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ public function isInitialized(PropertyReflection $property, string $propertyName
8383
return $metadata->isReadOnly && !$declaringClass->hasConstructor();
8484
}
8585

86+
/**
87+
* @param ClassMetadataInfo<object> $metadata
88+
*/
8689
private function isGeneratedIdentifier(ClassMetadataInfo $metadata, string $propertyName): bool
8790
{
8891
if ($metadata->isIdentifierNatural()) {

src/Type/Doctrine/ObjectMetadataResolver.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class ObjectMetadataResolver
2424
/** @var ObjectManager|false|null */
2525
private $objectManager;
2626

27-
/** @var ClassMetadataFactory<ClassMetadata>|null */
27+
/** @var ClassMetadataFactory<ClassMetadata<object>>|null */
2828
private $metadataFactory;
2929

3030
public function __construct(
@@ -89,7 +89,7 @@ public function isTransient(string $className): bool
8989
}
9090

9191
/**
92-
* @return ClassMetadataFactory<ClassMetadata>
92+
* @return ClassMetadataFactory<ClassMetadata<object>>
9393
*/
9494
private function getMetadataFactory(): ?ClassMetadataFactory
9595
{
@@ -101,6 +101,7 @@ private function getMetadataFactory(): ?ClassMetadataFactory
101101
return null;
102102
}
103103

104+
/** @var ClassMetadataFactory<ClassMetadata<object>> $metadataFactory */
104105
$metadataFactory = new \PHPStan\Doctrine\Mapping\ClassMetadataFactory();
105106

106107
return $this->metadataFactory = $metadataFactory;

src/Type/Doctrine/Query/QueryResultTypeWalker.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,10 @@ private function isQueryComponentNullable(string $dqlAlias): bool
12901290
return $this->nullableQueryComponents[$dqlAlias] ?? false;
12911291
}
12921292

1293-
/** @return array{string, ?class-string<BackedEnum>} Doctrine type name and enum type of field */
1293+
/**
1294+
* @param ClassMetadataInfo<object> $class
1295+
* @return array{string, ?class-string<BackedEnum>} Doctrine type name and enum type of field
1296+
*/
12941297
private function getTypeOfField(ClassMetadataInfo $class, string $fieldName): array
12951298
{
12961299
assert(isset($class->fieldMappings[$fieldName]));
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[
2+
{
3+
"message": "Method PHPStan\\DoctrineIntegration\\ORM\\QueryBuilder\\Foo::doFoo() return type with generic class Doctrine\\ORM\\Query does not specify its types: TResult",
4+
"line": 22,
5+
"ignorable": true
6+
},
7+
{
8+
"message": "Method PHPStan\\DoctrineIntegration\\ORM\\QueryBuilder\\Foo::doBar() return type with generic class Doctrine\\ORM\\Query does not specify its types: TResult",
9+
"line": 35,
10+
"ignorable": true
11+
},
12+
{
13+
"message": "Method PHPStan\\DoctrineIntegration\\ORM\\QueryBuilder\\Foo::dynamicQueryBuilder() return type with generic class Doctrine\\ORM\\Query does not specify its types: TResult",
14+
"line": 50,
15+
"ignorable": true
16+
}
17+
]

0 commit comments

Comments
 (0)