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 55use PHPStan \Broker \Broker ;
66use PHPStan \Reflection \ParametersAcceptorSelector ;
77use PHPStan \Type \Type ;
8+ use PHPStan \Type \TypeCombinator ;
89
910class ReflectionDescriptor implements DoctrineTypeDescriptor
1011{
@@ -32,12 +33,16 @@ public function getType(): string
3233
3334 public function getWritableToPropertyType (): Type
3435 {
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 );
3639 }
3740
3841 public function getWritableToDatabaseType (): Type
3942 {
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 );
4146 }
4247
4348}
Original file line number Diff line number Diff line change @@ -22,15 +22,15 @@ public function getName(): string
2222 return self ::NAME ;
2323 }
2424
25- public function convertToPHPValue ($ value , AbstractPlatform $ abstractPlatform ): DateTimeInterface
25+ public function convertToPHPValue ($ value , AbstractPlatform $ abstractPlatform ): ? DateTimeInterface
2626 {
2727 return new DateTimeImmutable ();
2828 }
2929
3030 /**
3131 * @param array $value
3232 */
33- public function convertToDatabaseValue ($ value , AbstractPlatform $ abstractPlatform ): string
33+ public function convertToDatabaseValue ($ value , AbstractPlatform $ abstractPlatform ): ? string
3434 {
3535 return '' ;
3636 }
You can’t perform that action at this time.
0 commit comments