From bace13dd159824dfe5fd269b745159547b597d22 Mon Sep 17 00:00:00 2001 From: Tom Rochette Date: Sun, 3 May 2015 15:22:21 -0400 Subject: [PATCH] [#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). --- src/PHPSemVerChecker/Finder/Finder.php | 5 ++++- src/PHPSemVerChecker/Reporter/Reporter.php | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/PHPSemVerChecker/Finder/Finder.php b/src/PHPSemVerChecker/Finder/Finder.php index ded3c1b..2791d1a 100644 --- a/src/PHPSemVerChecker/Finder/Finder.php +++ b/src/PHPSemVerChecker/Finder/Finder.php @@ -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; } diff --git a/src/PHPSemVerChecker/Reporter/Reporter.php b/src/PHPSemVerChecker/Reporter/Reporter.php index a96b279..f4a1e68 100644 --- a/src/PHPSemVerChecker/Reporter/Reporter.php +++ b/src/PHPSemVerChecker/Reporter/Reporter.php @@ -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(); }