File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
src/Type/Doctrine/Descriptors Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 22
33namespace PHPStan \Type \Doctrine \Descriptors ;
44
5+ use PHPStan \Type \Accessory \AccessoryNumericStringType ;
56use PHPStan \Type \Type ;
67use PHPStan \Type \TypeCombinator ;
78
@@ -15,7 +16,7 @@ public function getType(): string
1516
1617 public function getWritableToPropertyType (): Type
1718 {
18- return new \PHPStan \Type \StringType ();
19+ return TypeCombinator:: intersect ( new \PHPStan \Type \StringType (), new AccessoryNumericStringType () );
1920 }
2021
2122 public function getWritableToDatabaseType (): Type
Original file line number Diff line number Diff line change 1313use PHPStan \Type \Doctrine \Descriptors \DateTimeImmutableType ;
1414use PHPStan \Type \Doctrine \Descriptors \DateTimeType ;
1515use PHPStan \Type \Doctrine \Descriptors \DateType ;
16+ use PHPStan \Type \Doctrine \Descriptors \DecimalType ;
1617use PHPStan \Type \Doctrine \Descriptors \IntegerType ;
1718use PHPStan \Type \Doctrine \Descriptors \Ramsey \UuidTypeDescriptor ;
1819use PHPStan \Type \Doctrine \Descriptors \ReflectionDescriptor ;
@@ -48,6 +49,7 @@ protected function getRule(): Rule
4849 new DateType (),
4950 new UuidTypeDescriptor (UuidType::class),
5051 new ArrayType (),
52+ new DecimalType (),
5153 ]),
5254 true
5355 );
Original file line number Diff line number Diff line change @@ -101,4 +101,22 @@ class MyBrokenEntity extends MyBrokenSuperclass
101101 */
102102 private $ arrayOfIntegersOrNull ;
103103
104+ /**
105+ * @ORM\Column(type="decimal")
106+ * @var int|float|numeric-string
107+ */
108+ private $ decimal ;
109+
110+ /**
111+ * @ORM\Column(type="decimal")
112+ * @var int|float|string
113+ */
114+ private $ decimalWithString ;
115+
116+ /**
117+ * @ORM\Column(type="decimal")
118+ * @var string
119+ */
120+ private $ decimalWithString2 ;
121+
104122}
You can’t perform that action at this time.
0 commit comments