Skip to content
This repository was archived by the owner on Jul 12, 2020. It is now read-only.

Commit f29aa86

Browse files
committed
[GH-30] Fix path not relative to current working directory. Closes GH-30
1 parent bcefb7d commit f29aa86

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/main/QafooLabs/Refactoring/Adapters/Symfony/Commands/FixClassNamesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function configure()
6060

6161
protected function execute(InputInterface $input, OutputInterface $output)
6262
{
63-
$directory = new Directory($input->getArgument('dir'));
63+
$directory = new Directory($input->getArgument('dir'), getcwd());
6464

6565
$codeAnalysis = new StaticCodeAnalysis();
6666
$phpNameScanner = new ParserPhpNameScanner();

src/main/QafooLabs/Refactoring/Domain/Model/Directory.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,23 @@ class Directory
2929
*/
3030
private $path;
3131

32-
public function __construct($path)
32+
/**
33+
* @var string
34+
*/
35+
private $workingDirectory;
36+
37+
public function __construct($path, $workingDirectory)
3338
{
3439
$this->path = $path;
40+
$this->workingDirectory = $workingDirectory;
3541
}
3642

3743
/**
3844
* @return File[]
3945
*/
4046
public function findAllPhpFilesRecursivly()
4147
{
42-
$workingPath = $this->path;
48+
$workingDirectory = $this->workingDirectory;
4349

4450
return
4551
new CallbackTransformIterator(
@@ -52,8 +58,8 @@ function (SplFileInfo $file) {
5258
return substr($file->getFilename(), -4) === ".php";
5359
}
5460
),
55-
function ($file) use ($workingPath) {
56-
return File::createFromPath($file->getPathname(), $workingPath);
61+
function ($file) use ($workingDirectory) {
62+
return File::createFromPath($file->getPathname(), $workingDirectory);
5763
}
5864
)
5965
;

0 commit comments

Comments
 (0)