Skip to content

Commit 708598a

Browse files
Fix a bug where the first compatible type was sometimes removed
1 parent 083a5b4 commit 708598a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/functional/CompatibilityTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
1717
use function array_map;
1818
use function array_search;
1919
use function explode;
20-
use function implode;
2120
use function in_array;
22-
use function is_int;
2321
use function sort;
2422
use function sprintf;
25-
use function var_dump;
2623

2724
final class CompatibilityTest extends TestCase
2825
{
@@ -144,15 +141,17 @@ public function testCompatibility(string $super, string $sub, bool $expected): v
144141
public function compatibilityCases(): iterable
145142
{
146143
$compatibleTypes = self::compatibleTypes();
147-
var_dump($compatibleTypes);
148144
foreach (self::types() as $super) {
149145
foreach (self::types() as $sub) {
150146
$compatibleTypesKey = array_search([$super, $sub], $compatibleTypes, true);
151-
$expected = is_int($compatibleTypesKey);
147+
$expected = $compatibleTypesKey !== false;
152148
$name = $expected
153149
? sprintf('%s is a subtype of %s', $sub, $super)
154150
: sprintf('%s is not a subtype of %s', $sub, $super);
155151
yield $name => [$super, $sub, $expected];
152+
if ($compatibleTypesKey === false) {
153+
continue;
154+
}
156155
unset($compatibleTypes[$compatibleTypesKey]);
157156
}
158157
}

0 commit comments

Comments
 (0)