File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
src/Type/Doctrine/Descriptors/Symfony Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 35
35
"phpstan/phpstan-strict-rules" : " ^2.0" ,
36
36
"phpunit/phpunit" : " ^9.6.20" ,
37
37
"ramsey/uuid" : " ^4.2" ,
38
- "symfony/cache" : " ^5.4"
38
+ "symfony/cache" : " ^5.4" ,
39
+ "symfony/doctrine-bridge" : " ^5.4" ,
40
+ "symfony/uid" : " ^5.4"
39
41
},
40
42
"config" : {
41
43
"sort-packages" : true ,
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
+ #[Override]
15
+ public function getType (): string
16
+ {
17
+ return UuidType::class;
18
+ }
19
+
20
+ #[Override]
21
+ public function getWritableToPropertyType (): Type
22
+ {
23
+ return new ObjectType (Uuid::class);
24
+ }
25
+
26
+ #[Override]
27
+ public function getWritableToDatabaseType (): Type
28
+ {
29
+ return new ObjectType (Uuid::class);
30
+ }
31
+
32
+ #[Override]
33
+ public function getDatabaseInternalType (): Type
34
+ {
35
+ return new StringType ();
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments