From f6c62a02fb263398d0feb6f2282d7a68cfab3354 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Mon, 28 Feb 2022 08:50:28 +0100 Subject: [PATCH] Regression test Closes https://github.com/phpstan/phpstan/issues/6433 --- .../Analyser/NodeScopeResolverTest.php | 1 + tests/PHPStan/Analyser/data/bug-6433.php | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/PHPStan/Analyser/data/bug-6433.php diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index 0b01a18923..b34026b08c 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -731,6 +731,7 @@ public function dataFileAsserts(): iterable if (PHP_VERSION_ID >= 80100) { yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6695.php'); + yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6433.php'); } yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6698.php'); diff --git a/tests/PHPStan/Analyser/data/bug-6433.php b/tests/PHPStan/Analyser/data/bug-6433.php new file mode 100644 index 0000000000..9a31de7ef1 --- /dev/null +++ b/tests/PHPStan/Analyser/data/bug-6433.php @@ -0,0 +1,21 @@ += 8.1 + +namespace Bug6433; + +use Ds\Set; +use function PHPStan\Testing\assertType; + +enum E: string { + case A = 'A'; + case B = 'B'; +} + +class Foo +{ + + function x(): void { + assertType('Ds\Set', new Set([E::A, E::B])); + } + +} +