File tree Expand file tree Collapse file tree 5 files changed +55
-3
lines changed Expand file tree Collapse file tree 5 files changed +55
-3
lines changed Original file line number Diff line number Diff line change 2323 "doctrine/annotations" : " ^2.0" ,
2424 "doctrine/collections" : " ^1.6 || ^2.1" ,
2525 "doctrine/common" : " ^2.7 || ^3.0" ,
26- "doctrine/dbal" : " ^3.3.8" ,
26+ "doctrine/dbal" : " ^3.3.8 || ^4.0 " ,
2727 "doctrine/lexer" : " ^2.0 || ^3.0" ,
2828 "doctrine/mongodb-odm" : " ^2.4.3" ,
29- "doctrine/orm" : " ^2.16.0" ,
29+ "doctrine/orm" : " ^2.16.0 || ^3.0 " ,
3030 "doctrine/persistence" : " ^2.2.1 || ^3.2" ,
3131 "gedmo/doctrine-extensions" : " ^3.8" ,
32- "nesbot/carbon" : " ^2.49" ,
32+ "nesbot/carbon" : " ^2.49 || ^3.0 " ,
3333 "php-parallel-lint/php-parallel-lint" : " ^1.2" ,
3434 "phpstan/phpstan-deprecation-rules" : " ^2.0.2" ,
3535 "phpstan/phpstan-phpunit" : " ^2.0" ,
Original file line number Diff line number Diff line change @@ -353,6 +353,9 @@ services:
353353 -
354354 class : PHPStan\Type\Doctrine\Descriptors\DecimalType
355355 tags : [phpstan.doctrine.typeDescriptor ]
356+ -
357+ class : PHPStan\Type\Doctrine\Descriptors\EnumType
358+ tags : [phpstan.doctrine.typeDescriptor ]
356359 -
357360 class : PHPStan\Type\Doctrine\Descriptors\FloatType
358361 tags : [phpstan.doctrine.typeDescriptor ]
@@ -374,6 +377,9 @@ services:
374377 -
375378 class : PHPStan\Type\Doctrine\Descriptors\SimpleArrayType
376379 tags : [phpstan.doctrine.typeDescriptor ]
380+ -
381+ class : PHPStan\Type\Doctrine\Descriptors\SmallFloatType
382+ tags : [phpstan.doctrine.typeDescriptor ]
377383 -
378384 class : PHPStan\Type\Doctrine\Descriptors\SmallIntType
379385 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 33namespace PHPStan \Type \Doctrine \Query ;
44
55use BackedEnum ;
6+ use Doctrine \DBAL \Types \EnumType as DbalEnumType ;
67use Doctrine \DBAL \Types \StringType as DbalStringType ;
78use Doctrine \DBAL \Types \Type as DbalType ;
89use Doctrine \ORM \EntityManagerInterface ;
@@ -1235,6 +1236,7 @@ public function walkSelectExpression($selectExpression): string
12351236 if (
12361237 $ expr instanceof TypedExpression
12371238 && !$ 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
12381240 ) {
12391241 $ dbalTypeName = DbalType::getTypeRegistry ()->lookupName ($ expr ->getReturnType ());
12401242 $ 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