Skip to content

Commit ffa186c

Browse files
committed
fix test for 4.3.0
1 parent 5872b16 commit ffa186c

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tests/EnumDynamicReturnTypeExtensionGetValuesTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
namespace MabeEnumPHPStanTest;
66

77
use MabeEnum\Enum;
8+
use MabeEnum\EnumSet;
89
use MabeEnumPHPStan\EnumDynamicReturnTypeExtension;
910

1011
final class EnumDynamicReturnTypeExtensionGetValuesTest extends ExtensionTestCase
1112
{
1213
/** @var EnumDynamicReturnTypeExtension */
1314
private $extension;
1415

16+
/** @var string */
17+
private $baseType = 'array<int, array|bool|float|int|string|null>';
18+
1519
protected function setUp(): void
1620
{
1721
parent::setUp();
@@ -21,6 +25,12 @@ protected function setUp(): void
2125
}
2226

2327
$this->extension = new EnumDynamicReturnTypeExtension();
28+
29+
// The base type has been set more specific in 4.3.0
30+
// The method EnumSet::__debugInfo also where added in 4.3.0
31+
if (!method_exists(EnumSet::class, '__debugInfo')) {
32+
$this->baseType = 'array';
33+
}
2434
}
2535

2636
public function testNullType(): void
@@ -121,7 +131,7 @@ function f(MabeEnum\Enum $enum) {
121131
}
122132
CODE;
123133

124-
$this->processCode($code, '$enum->getValues()', 'array', $this->extension);
134+
$this->processCode($code, '$enum->getValues()', $this->baseType, $this->extension);
125135
}
126136

127137
public function testUnionEnum(): void

0 commit comments

Comments
 (0)