From c9b5c12d0570d703fd257ade64d6070a4a34e8e7 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 16 Apr 2021 12:59:35 +0200 Subject: [PATCH] Regression test --- .../Analyser/NodeScopeResolverTest.php | 1 + .../data/generics-reduce-types-first.php | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/PHPStan/Analyser/data/generics-reduce-types-first.php diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index b7067fa594..dc9ceac9c2 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -10339,6 +10339,7 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4700.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/phpdoc-in-closure-bind.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/multi-assign.php'); + yield from $this->gatherAssertTypes(__DIR__ . '/data/generics-reduce-types-first.php'); } /** diff --git a/tests/PHPStan/Analyser/data/generics-reduce-types-first.php b/tests/PHPStan/Analyser/data/generics-reduce-types-first.php new file mode 100644 index 0000000000..55ea5b6f4a --- /dev/null +++ b/tests/PHPStan/Analyser/data/generics-reduce-types-first.php @@ -0,0 +1,35 @@ +', $this->doFoo($a)); + assertType('array', $this->doFoo($b)); + assertType('array', $this->doFoo($c)); + assertType('string', $this->doFoo($d)); + } + +}