Skip to content

Commit f06ddd6

Browse files
committed
Fix IterableType->equals(TemplateIterableType)
1 parent 64512a5 commit f06ddd6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Type/IterableType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsRes
167167

168168
public function equals(Type $type): bool
169169
{
170-
if (!$type instanceof self) {
170+
if (get_class($type) !== static::class) {
171171
return false;
172172
}
173173

tests/PHPStan/Generics/TemplateTypeFactoryTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PHPStan\Type\Generic\TemplateTypeScope;
99
use PHPStan\Type\Generic\TemplateTypeVariance;
1010
use PHPStan\Type\IntegerType;
11+
use PHPStan\Type\IterableType;
1112
use PHPStan\Type\MixedType;
1213
use PHPStan\Type\ObjectType;
1314
use PHPStan\Type\StringType;
@@ -66,6 +67,10 @@ public function dataCreate(): array
6667
new IntegerType(),
6768
]),
6869
],
70+
[
71+
new IterableType(new IntegerType(), new StringType()),
72+
new IterableType(new IntegerType(), new StringType()),
73+
],
6974
];
7075
}
7176

0 commit comments

Comments
 (0)