Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a8151d9

Browse files
authored
Improve the type descriptor for SimpleArrayType
When converting database values to PHP, this type always produces a `list<string>`
1 parent 62bd362 commit a8151d9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/Type/Doctrine/Descriptors/SimpleArrayType.php‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace PHPStan\Type\Doctrine\Descriptors;
44

5+
use PHPStan\Type\Accessory\AccessoryArrayListType;
56
use PHPStan\Type\ArrayType;
7+
use PHPStan\Type\IntegerType;
68
use PHPStan\Type\MixedType;
79
use PHPStan\Type\StringType;
810
use PHPStan\Type\Type;
@@ -17,12 +19,12 @@ public function getType(): string
1719

1820
public function getWritableToPropertyType(): Type
1921
{
20-
return new ArrayType(new MixedType(), new MixedType());
22+
return AccessoryArrayListType::intersectWith(new ArrayType(new IntegerType(), new StringType()));
2123
}
2224

2325
public function getWritableToDatabaseType(): Type
2426
{
25-
return new ArrayType(new MixedType(), new MixedType());
27+
return new ArrayType(new MixedType(), new StringType());
2628
}
2729

2830
public function getDatabaseInternalType(): Type

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /