From c71e756be67acc600202a4da8b956df077690132 Mon Sep 17 00:00:00 2001 From: Jan Nedbal Date: Fri, 8 Mar 2024 23:22:50 +0100 Subject: [PATCH] ConsoleFormatter: output 'file:line' to allow jump-to-line in IDEs (#1373) --- .../OutputFormatter/ConsoleOutputFormatter.php | 4 ++-- .../ConsoleOutputFormatterTest.php | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Supportive/OutputFormatter/ConsoleOutputFormatter.php b/src/Supportive/OutputFormatter/ConsoleOutputFormatter.php index 46276d251..fda22038f 100644 --- a/src/Supportive/OutputFormatter/ConsoleOutputFormatter.php +++ b/src/Supportive/OutputFormatter/ConsoleOutputFormatter.php @@ -83,7 +83,7 @@ private function printMultilinePath(OutputInterface $output, DependencyInterface $buffer = implode( " -> \n", array_map( - static fn (array $dependency): string => sprintf("\t%s::%d", $dependency['name'], $dependency['line']), + static fn (array $dependency): string => sprintf("\t%s:%d", $dependency['name'], $dependency['line']), $dep->serialize() ) ); @@ -170,7 +170,7 @@ private function printUncovered(OutputResult $result, OutputInterface $output): private function printFileOccurrence(OutputInterface $output, FileOccurrence $fileOccurrence): void { - $output->writeLineFormatted($fileOccurrence->filepath.'::'.$fileOccurrence->line); + $output->writeLineFormatted($fileOccurrence->filepath.':'.$fileOccurrence->line); } private function printErrors(OutputResult $result, OutputInterface $output): void diff --git a/tests/Supportive/OutputFormatter/ConsoleOutputFormatterTest.php b/tests/Supportive/OutputFormatter/ConsoleOutputFormatterTest.php index 70c56181b..a498e83ee 100644 --- a/tests/Supportive/OutputFormatter/ConsoleOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/ConsoleOutputFormatterTest.php @@ -78,12 +78,12 @@ public static function basicDataProvider(): iterable 'warnings' => [], ' ClassA must not depend on ClassB (LayerA on LayerB) - originalA.php::12 - ClassInheritD::6 -> - ClassInheritC::5 -> - ClassInheritB::4 -> - ClassInheritA::3 -> - OriginalB::12 + originalA.php:12 + ClassInheritD:6 -> + ClassInheritC:5 -> + ClassInheritB:4 -> + ClassInheritA:3 -> + OriginalB:12 Report: Violations: 1 @@ -108,7 +108,7 @@ public static function basicDataProvider(): iterable 'warnings' => [], ' OriginalA must not depend on OriginalB (LayerA on LayerB) - originalA.php::12 + originalA.php:12 Report: Violations: 1 @@ -147,7 +147,7 @@ public static function basicDataProvider(): iterable [], 'warnings' => [], '[SKIPPED] OriginalA must not depend on OriginalB (LayerA on LayerB) - originalA.php::12 + originalA.php:12 Report: Violations: 0 @@ -171,7 +171,7 @@ public static function basicDataProvider(): iterable ' Uncovered dependencies: OriginalA has uncovered dependency on OriginalB (LayerA) - originalA.php::12 + originalA.php:12 Report: Violations: 0 Skipped violations: 0