diff --git a/src/Rules/Keywords/RequireFileExistsRule.php b/src/Rules/Keywords/RequireFileExistsRule.php index f2a9af9989b..8ccf92e3dfc 100644 --- a/src/Rules/Keywords/RequireFileExistsRule.php +++ b/src/Rules/Keywords/RequireFileExistsRule.php @@ -77,8 +77,7 @@ private function doesFileExist(string $path, Scope $scope): bool private function doesFileExistForDirectory(string $path, string $workingDirectory): bool { $fileHelper = new FileHelper($workingDirectory); - $normalisedPath = $fileHelper->normalizePath($path); - $absolutePath = $fileHelper->absolutizePath($normalisedPath); + $absolutePath = $fileHelper->absolutizePath($path); return is_file($absolutePath); } diff --git a/tests/PHPStan/Rules/Keywords/RequireFileExistsRuleTest.php b/tests/PHPStan/Rules/Keywords/RequireFileExistsRuleTest.php index ee96f404662..6bd3e1dfd72 100644 --- a/tests/PHPStan/Rules/Keywords/RequireFileExistsRuleTest.php +++ b/tests/PHPStan/Rules/Keywords/RequireFileExistsRuleTest.php @@ -116,4 +116,9 @@ public function testRelativePathWithSameWorkingDirectory(): void $this->analyse([__DIR__ . '/data/require-file-relative-path.php'], []); } + public function testBug11738(): void + { + $this->analyse([__DIR__ . '/data/bug-11738/bug-11738.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Keywords/data/bug-11738-included.php b/tests/PHPStan/Rules/Keywords/data/bug-11738-included.php new file mode 100644 index 00000000000..a4abe2dafcb --- /dev/null +++ b/tests/PHPStan/Rules/Keywords/data/bug-11738-included.php @@ -0,0 +1,2 @@ +