Skip to content

Commit bace13d

Browse files
committed
[#56] Reporter outputs an empty location if file was removed
Get the absolute path of files in the Finder. This makes it possible to strip the current working directory from the path as the full path is already resolved (which was not the case before).
1 parent 675e0b9 commit bace13d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/PHPSemVerChecker/Finder/Finder.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ public function find($path, array $includes, array $excludes = [])
2828
$finder->notPath($exclude);
2929
}
3030

31-
$files = iterator_to_array($finder->getIterator());
31+
$files = [];
32+
foreach ($finder as $file) {
33+
$files[] = $file->getRealpath();
34+
}
3235

3336
return $files;
3437
}

src/PHPSemVerChecker/Reporter/Reporter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ protected function getLocation(Operation $operation)
9090
if ($isFullPath) {
9191
$location = $operation->getLocation();
9292
} else {
93-
$fullPath = realpath($operation->getLocation());
94-
$location = str_replace($this->cwd . DIRECTORY_SEPARATOR, '', $fullPath);
93+
$location = str_replace($this->cwd . DIRECTORY_SEPARATOR, '', $operation->getLocation());
9594
}
9695
return $location . '#' . $operation->getLine();
9796
}

0 commit comments

Comments
 (0)