File tree 5 files changed +55
-3
lines changed
5 files changed +55
-3
lines changed Original file line number Diff line number Diff line change 23
23
"doctrine/annotations" : " ^2.0" ,
24
24
"doctrine/collections" : " ^1.6 || ^2.1" ,
25
25
"doctrine/common" : " ^2.7 || ^3.0" ,
26
- "doctrine/dbal" : " ^3.3.8" ,
26
+ "doctrine/dbal" : " ^3.3.8 || ^4.0 " ,
27
27
"doctrine/lexer" : " ^2.0 || ^3.0" ,
28
28
"doctrine/mongodb-odm" : " ^2.4.3" ,
29
- "doctrine/orm" : " ^2.16.0" ,
29
+ "doctrine/orm" : " ^2.16.0 || ^3.0 " ,
30
30
"doctrine/persistence" : " ^2.2.1 || ^3.2" ,
31
31
"gedmo/doctrine-extensions" : " ^3.8" ,
32
- "nesbot/carbon" : " ^2.49" ,
32
+ "nesbot/carbon" : " ^2.49 || ^3.0 " ,
33
33
"php-parallel-lint/php-parallel-lint" : " ^1.2" ,
34
34
"phpstan/phpstan-deprecation-rules" : " ^2.0.2" ,
35
35
"phpstan/phpstan-phpunit" : " ^2.0" ,
Original file line number Diff line number Diff line change @@ -353,6 +353,9 @@ services:
353
353
-
354
354
class : PHPStan\Type\Doctrine\Descriptors\DecimalType
355
355
tags : [phpstan.doctrine.typeDescriptor ]
356
+ -
357
+ class : PHPStan\Type\Doctrine\Descriptors\EnumType
358
+ tags : [phpstan.doctrine.typeDescriptor ]
356
359
-
357
360
class : PHPStan\Type\Doctrine\Descriptors\FloatType
358
361
tags : [phpstan.doctrine.typeDescriptor ]
@@ -374,6 +377,9 @@ services:
374
377
-
375
378
class : PHPStan\Type\Doctrine\Descriptors\SimpleArrayType
376
379
tags : [phpstan.doctrine.typeDescriptor ]
380
+ -
381
+ class : PHPStan\Type\Doctrine\Descriptors\SmallFloatType
382
+ tags : [phpstan.doctrine.typeDescriptor ]
377
383
-
378
384
class : PHPStan\Type\Doctrine\Descriptors\SmallIntType
379
385
tags : [phpstan.doctrine.typeDescriptor ]
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace PHPStan \Type \Doctrine \Descriptors ;
4
+
5
+ use PHPStan \Type \StringType ;
6
+ use PHPStan \Type \Type ;
7
+
8
+ class EnumType implements DoctrineTypeDescriptor
9
+ {
10
+
11
+ public function getType (): string
12
+ {
13
+ return \Doctrine \DBAL \Types \EnumType::class;
14
+ }
15
+
16
+ public function getWritableToPropertyType (): Type
17
+ {
18
+ return new StringType ();
19
+ }
20
+
21
+ public function getWritableToDatabaseType (): Type
22
+ {
23
+ return new StringType ();
24
+ }
25
+
26
+ public function getDatabaseInternalType (): Type
27
+ {
28
+ return new StringType ();
29
+ }
30
+
31
+ }
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace PHPStan \Type \Doctrine \Descriptors ;
4
+
5
+ class SmallFloatType extends FloatType
6
+ {
7
+
8
+ public function getType (): string
9
+ {
10
+ return \Doctrine \DBAL \Types \SmallFloatType::class;
11
+ }
12
+
13
+ }
Original file line number Diff line number Diff line change 3
3
namespace PHPStan \Type \Doctrine \Query ;
4
4
5
5
use BackedEnum ;
6
+ use Doctrine \DBAL \Types \EnumType as DbalEnumType ;
6
7
use Doctrine \DBAL \Types \StringType as DbalStringType ;
7
8
use Doctrine \DBAL \Types \Type as DbalType ;
8
9
use Doctrine \ORM \EntityManagerInterface ;
@@ -1235,6 +1236,7 @@ public function walkSelectExpression($selectExpression): string
1235
1236
if (
1236
1237
$ expr instanceof TypedExpression
1237
1238
&& !$ expr ->getReturnType () instanceof DbalStringType // StringType is no-op, so using TypedExpression with that does nothing
1239
+ && !$ expr ->getReturnType () instanceof DbalEnumType // EnumType is also no-op
1238
1240
) {
1239
1241
$ dbalTypeName = DbalType::getTypeRegistry ()->lookupName ($ expr ->getReturnType ());
1240
1242
$ type = TypeCombinator::intersect ( // e.g. count is typed as int, but we infer int<0, max>
You can’t perform that action at this time.
0 commit comments