From 4e1934796a74ba49e2ef980894b66d3d5ba2b656 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 19 May 2023 07:49:56 +0200 Subject: [PATCH] Test `@var` in and out of function --- .../Analyser/NodeScopeResolverTest.php | 1 + .../data/var-in-and-out-of-function.php | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/PHPStan/Analyser/data/var-in-and-out-of-function.php diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index 519c123bed..3958e2d8d8 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -1034,6 +1034,7 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Arrays/data/bug-7469.php'); yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Variables/data/bug-3391.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-6901.php'); + yield from $this->gatherAssertTypes(__DIR__ . '/data/var-in-and-out-of-function.php'); if (PHP_VERSION_ID >= 70400) { yield from $this->gatherAssertTypes(__DIR__ . '/data/arrow-function-argument-type.php'); diff --git a/tests/PHPStan/Analyser/data/var-in-and-out-of-function.php b/tests/PHPStan/Analyser/data/var-in-and-out-of-function.php new file mode 100644 index 0000000000..6550d139b7 --- /dev/null +++ b/tests/PHPStan/Analyser/data/var-in-and-out-of-function.php @@ -0,0 +1,25 @@ +