File tree 3 files changed +22
-1
lines changed
src/Type/Doctrine/Descriptors 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace PHPStan \Type \Doctrine \Descriptors ;
4
4
5
+ use PHPStan \Type \Accessory \AccessoryNumericStringType ;
5
6
use PHPStan \Type \Type ;
6
7
use PHPStan \Type \TypeCombinator ;
7
8
@@ -15,7 +16,7 @@ public function getType(): string
15
16
16
17
public function getWritableToPropertyType (): Type
17
18
{
18
- return new \PHPStan \Type \StringType ();
19
+ return TypeCombinator:: intersect ( new \PHPStan \Type \StringType (), new AccessoryNumericStringType () );
19
20
}
20
21
21
22
public function getWritableToDatabaseType (): Type
Original file line number Diff line number Diff line change 13
13
use PHPStan \Type \Doctrine \Descriptors \DateTimeImmutableType ;
14
14
use PHPStan \Type \Doctrine \Descriptors \DateTimeType ;
15
15
use PHPStan \Type \Doctrine \Descriptors \DateType ;
16
+ use PHPStan \Type \Doctrine \Descriptors \DecimalType ;
16
17
use PHPStan \Type \Doctrine \Descriptors \IntegerType ;
17
18
use PHPStan \Type \Doctrine \Descriptors \Ramsey \UuidTypeDescriptor ;
18
19
use PHPStan \Type \Doctrine \Descriptors \ReflectionDescriptor ;
@@ -48,6 +49,7 @@ protected function getRule(): Rule
48
49
new DateType (),
49
50
new UuidTypeDescriptor (UuidType::class),
50
51
new ArrayType (),
52
+ new DecimalType (),
51
53
]),
52
54
true
53
55
);
Original file line number Diff line number Diff line change @@ -101,4 +101,22 @@ class MyBrokenEntity extends MyBrokenSuperclass
101
101
*/
102
102
private $ arrayOfIntegersOrNull ;
103
103
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
+
104
122
}
You can’t perform that action at this time.
0 commit comments