diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index 98c8d7740b..ecc5f625cd 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -443,6 +443,7 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5259.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5293.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5129.php'); + yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4970.php'); } /** diff --git a/tests/PHPStan/Analyser/data/bug-4970.php b/tests/PHPStan/Analyser/data/bug-4970.php new file mode 100644 index 0000000000..b4ac3cf0ea --- /dev/null +++ b/tests/PHPStan/Analyser/data/bug-4970.php @@ -0,0 +1,29 @@ +importFile)) { + return 1; + } + assertType('true', \file_exists($this->importFile)); + $this->importFile = '/b'; + assertType('bool', \file_exists($this->importFile)); + + if (\file_exists($this->importFile)) { + echo 'test'; + } + + return \file_exists($this->importFile) ? 0 : 1; + } +}