Skip to content

Commit

Permalink
[#56] Reporter outputs an empty location if file was removed
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
tomzx committed May 3, 2015
1 parent 675e0b9 commit bace13d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/PHPSemVerChecker/Finder/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ public function find($path, array $includes, array $excludes = [])
$finder->notPath($exclude);
}

$files = iterator_to_array($finder->getIterator());
$files = [];
foreach ($finder as $file) {
$files[] = $file->getRealpath();
}

return $files;
}
Expand Down
3 changes: 1 addition & 2 deletions src/PHPSemVerChecker/Reporter/Reporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ protected function getLocation(Operation $operation)
if ($isFullPath) {
$location = $operation->getLocation();
} else {
$fullPath = realpath($operation->getLocation());
$location = str_replace($this->cwd . DIRECTORY_SEPARATOR, '', $fullPath);
$location = str_replace($this->cwd . DIRECTORY_SEPARATOR, '', $operation->getLocation());
}
return $location . '#' . $operation->getLine();
}
Expand Down

0 comments on commit bace13d

Please sign in to comment.