diff --git a/bin/file-diff b/bin/file-diff index 5a7426c..adf5a02 100755 --- a/bin/file-diff +++ b/bin/file-diff @@ -60,10 +60,10 @@ function fileDiff($oldFilePath, $newFilePath) $newLineNumber = $i + 1; - $changes[] = ($oldLine === null ? "$colorGreen+ New (Line $newLineNumber): " : "$colorRed- Old (Line $oldLineNumber): ") . ($oldLine ?? $newLine) . "$colorReset"; + $changes[] = ($oldLine === null ? "$colorGreen+ $newFilePath (Line $newLineNumber): " : "$colorRed- $oldFilePath (Line $oldLineNumber): ") . ($oldLine ?? $newLine) . "$colorReset"; if ($oldLine !== null && $newLine !== null) { - $changes[] = "$colorGreen+ New (Line $newLineNumber): " . $newLine . "$colorReset"; + $changes[] = "$colorGreen+ $newFilePath (Line $newLineNumber): " . $newLine . "$colorReset"; } } diff --git a/tests/Integration/FileDiffCommandTest.php b/tests/Integration/FileDiffCommandTest.php index 52f99d9..e619b45 100644 --- a/tests/Integration/FileDiffCommandTest.php +++ b/tests/Integration/FileDiffCommandTest.php @@ -25,8 +25,8 @@ public static function commandArgumentProvider(): iterable file_put_contents("new", "this line has same old code" . PHP_EOL, FILE_APPEND); - yield ['old', 'new', 'Old (Line 1):']; - yield ['old', 'new', 'Old (Line 2):']; + yield ['old', 'new', 'old (Line 1):']; + yield ['old', 'new', 'old (Line 2):']; } public static function matchingDataProvider(): iterable @@ -35,7 +35,7 @@ public static function matchingDataProvider(): iterable file_put_contents("new", "this has matching content" . PHP_EOL, FILE_APPEND); - yield ['old', 'new', 'Old (Line 3):']; + yield ['old', 'new', 'old (Line 3):']; } #[Test]