File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
src/Type/Doctrine/Descriptors
tests/Rules/Doctrine/ORM/data Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 5
5
use PHPStan \Broker \Broker ;
6
6
use PHPStan \Reflection \ParametersAcceptorSelector ;
7
7
use PHPStan \Type \Type ;
8
+ use PHPStan \Type \TypeCombinator ;
8
9
9
10
class ReflectionDescriptor implements DoctrineTypeDescriptor
10
11
{
@@ -32,12 +33,16 @@ public function getType(): string
32
33
33
34
public function getWritableToPropertyType (): Type
34
35
{
35
- return ParametersAcceptorSelector::selectSingle ($ this ->broker ->getClass ($ this ->type )->getNativeMethod ('convertToPHPValue ' )->getVariants ())->getReturnType ();
36
+ $ type = ParametersAcceptorSelector::selectSingle ($ this ->broker ->getClass ($ this ->type )->getNativeMethod ('convertToPHPValue ' )->getVariants ())->getReturnType ();
37
+
38
+ return TypeCombinator::removeNull ($ type );
36
39
}
37
40
38
41
public function getWritableToDatabaseType (): Type
39
42
{
40
- return ParametersAcceptorSelector::selectSingle ($ this ->broker ->getClass ($ this ->type )->getNativeMethod ('convertToDatabaseValue ' )->getVariants ())->getParameters ()[0 ]->getType ();
43
+ $ type = ParametersAcceptorSelector::selectSingle ($ this ->broker ->getClass ($ this ->type )->getNativeMethod ('convertToDatabaseValue ' )->getVariants ())->getParameters ()[0 ]->getType ();
44
+
45
+ return TypeCombinator::removeNull ($ type );
41
46
}
42
47
43
48
}
Original file line number Diff line number Diff line change @@ -22,15 +22,15 @@ public function getName(): string
22
22
return self ::NAME ;
23
23
}
24
24
25
- public function convertToPHPValue ($ value , AbstractPlatform $ abstractPlatform ): DateTimeInterface
25
+ public function convertToPHPValue ($ value , AbstractPlatform $ abstractPlatform ): ? DateTimeInterface
26
26
{
27
27
return new DateTimeImmutable ();
28
28
}
29
29
30
30
/**
31
31
* @param array $value
32
32
*/
33
- public function convertToDatabaseValue ($ value , AbstractPlatform $ abstractPlatform ): string
33
+ public function convertToDatabaseValue ($ value , AbstractPlatform $ abstractPlatform ): ? string
34
34
{
35
35
return '' ;
36
36
}
You can’t perform that action at this time.
0 commit comments