File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed
src/Type/Doctrine/Descriptors/Symfony Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 3535 "phpstan/phpstan-strict-rules" : " ^2.0" ,
3636 "phpunit/phpunit" : " ^9.6.20" ,
3737 "ramsey/uuid" : " ^4.2" ,
38- "symfony/cache" : " ^5.4"
38+ "symfony/cache" : " ^5.4" ,
39+ "symfony/doctrine-bridge" : " ^5.4" ,
40+ "symfony/validator" : " ^5.4" ,
41+ "symfony/uid" : " ^5.4"
3942 },
4043 "config" : {
4144 "sort-packages" : true ,
Original file line number Diff line number Diff line change @@ -412,6 +412,9 @@ services:
412412 tags : [phpstan.doctrine.typeDescriptor ]
413413 arguments :
414414 uuidTypeName : Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType
415+ -
416+ class : PHPStan\Type\Doctrine\Descriptors\Symfony\UuidTypeDescriptor
417+ tags : [phpstan.doctrine.typeDescriptor ]
415418
416419 # Doctrine Collection
417420 -
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace PHPStan \Type \Doctrine \Descriptors \Symfony ;
4+
5+ use PHPStan \Type \Doctrine \Descriptors \DoctrineTypeDescriptor ;
6+ use PHPStan \Type \ObjectType ;
7+ use PHPStan \Type \StringType ;
8+ use PHPStan \Type \Type ;
9+ use Symfony \Bridge \Doctrine \Types \UuidType ;
10+ use Symfony \Component \Uid \Uuid ;
11+
12+ class UuidTypeDescriptor implements DoctrineTypeDescriptor
13+ {
14+
15+ public function getType (): string
16+ {
17+ return UuidType::class;
18+ }
19+
20+ public function getWritableToPropertyType (): Type
21+ {
22+ return new ObjectType (Uuid::class);
23+ }
24+
25+ public function getWritableToDatabaseType (): Type
26+ {
27+ return new ObjectType (Uuid::class);
28+ }
29+
30+ public function getDatabaseInternalType (): Type
31+ {
32+ return new StringType ();
33+ }
34+
35+ }
You can’t perform that action at this time.
0 commit comments