Skip to content

Commit 098fb94

Browse files
committed
Fix including relative path
1 parent 4605833 commit 098fb94

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/Rules/Keywords/RequireFileExistsRule.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ private function doesFileExist(string $path, Scope $scope): bool
7777
private function doesFileExistForDirectory(string $path, string $workingDirectory): bool
7878
{
7979
$fileHelper = new FileHelper($workingDirectory);
80-
$normalisedPath = $fileHelper->normalizePath($path);
81-
$absolutePath = $fileHelper->absolutizePath($normalisedPath);
80+
$absolutePath = $fileHelper->absolutizePath($path);
8281

8382
return is_file($absolutePath);
8483
}

tests/PHPStan/Rules/Keywords/RequireFileExistsRuleTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,9 @@ public function testRelativePathWithSameWorkingDirectory(): void
116116
$this->analyse([__DIR__ . '/data/require-file-relative-path.php'], []);
117117
}
118118

119+
public function testBug11738(): void
120+
{
121+
$this->analyse([__DIR__ . '/data/bug-11738/bug-11738.php'], []);
122+
}
123+
119124
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
require_once('../bug-11738-included.php');

0 commit comments

Comments
 (0)