Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/applied-auto-import/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/RenameDocblock.php:2

---------- begin diff ----------
@@ @@
@@ Line 2 @@

namespace App;

Expand Down
2 changes: 1 addition & 1 deletion e2e/applied-polyfill-php80/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/SomeStartWith.php:4

---------- begin diff ----------
@@ @@
@@ Line 4 @@
{
public function run($a)
{
Expand Down
4 changes: 2 additions & 2 deletions e2e/applied-rule-change-docblock/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/RenameDocblock.php:1

---------- begin diff ----------
@@ @@
@@ Line 1 @@
<?php

/**
Expand All @@ -22,7 +22,7 @@ Applied rules:
2) src/UselessVarTag.php:2

---------- begin diff ----------
@@ @@
@@ Line 2 @@

final class UselessVarTag
{
Expand Down
4 changes: 2 additions & 2 deletions e2e/applied-rule-removed-node-with-cache/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/AlwaysTrue.php:4

---------- begin diff ----------
@@ @@
@@ Line 4 @@
{
public function run()
{
Expand All @@ -23,7 +23,7 @@ Applied rules:
2) src/DeadConstructor.php:2

---------- begin diff ----------
@@ @@
@@ Line 2 @@

final class DeadConstructor
{
Expand Down
4 changes: 2 additions & 2 deletions e2e/applied-rule-removed-node/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/AlwaysTrue.php:4

---------- begin diff ----------
@@ @@
@@ Line 4 @@
{
public function run()
{
Expand All @@ -23,7 +23,7 @@ Applied rules:
2) src/DeadConstructor.php:2

---------- begin diff ----------
@@ @@
@@ Line 2 @@

final class DeadConstructor
{
Expand Down
4 changes: 2 additions & 2 deletions e2e/applied-rule-return-array-nodes/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/MultiRules.php:6

---------- begin diff ----------
@@ @@
@@ Line 6 @@
{
if (true === false) {
return -1;
Expand All @@ -28,7 +28,7 @@ Applied rules:
2) src/RemoveAlwaysElse.php:6

---------- begin diff ----------
@@ @@
@@ Line 6 @@
{
if ($value) {
throw new \InvalidStateException;
Expand Down
4 changes: 2 additions & 2 deletions e2e/different-path-over-skip-config/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/models/DeadConstructor.php:4

---------- begin diff ----------
@@ @@
@@ Line 4 @@

final class DeadConstructor
{
Expand All @@ -18,4 +18,4 @@ Applied rules:
* RemoveEmptyClassMethodRector


[OK] 1 file would have been changed (dry-run) by Rector
[OK] 1 file would have been changed (dry-run) by Rector
4 changes: 2 additions & 2 deletions e2e/no-parallel-reflection-resolver/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/NamespacedSomeClassFound.php:6

---------- begin diff ----------
@@ @@
@@ Line 6 @@

final class NamespacedSomeClassFound
{
Expand All @@ -19,7 +19,7 @@ Applied rules:
2) src/SomeClassNotFound.php:4

---------- begin diff ----------
@@ @@
@@ Line 4 @@

final class SomeClassNotFound
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) ../only-option/src/MultiRules.php:10

---------- begin diff ----------
@@ @@
@@ Line 10 @@
echo 'a statement';
}
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/only-option-quote-single-bsdouble/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) ../only-option/src/MultiRules.php:10

---------- begin diff ----------
@@ @@
@@ Line 10 @@
echo 'a statement';
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) ../only-option/src/MultiRules.php:10

---------- begin diff ----------
@@ @@
@@ Line 10 @@
echo 'a statement';
}
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/only-option-quote-single/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) ../only-option/src/MultiRules.php:10

---------- begin diff ----------
@@ @@
@@ Line 10 @@
echo 'a statement';
}
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/only-option/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/MultiRules.php:10

---------- begin diff ----------
@@ @@
@@ Line 10 @@
echo 'a statement';
}
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/parallel-custom-config/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/SomeClass.php:7

---------- begin diff ----------
@@ @@
@@ Line 7 @@
class SomeClass
{
public function __construct(
Expand Down
4 changes: 2 additions & 2 deletions e2e/parallel-reflection-resolver/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/NamespacedSomeClassFound.php:6

---------- begin diff ----------
@@ @@
@@ Line 6 @@

final class NamespacedSomeClassFound
{
Expand All @@ -19,7 +19,7 @@ Applied rules:
2) src/SomeClassNotFound.php:4

---------- begin diff ----------
@@ @@
@@ Line 4 @@

final class SomeClassNotFound
{
Expand Down
2 changes: 1 addition & 1 deletion e2e/print-new-node/expected-output.diff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
1) src/ExtendingTestClass.php:1

---------- begin diff ----------
@@ @@
@@ Line 1 @@
<?php

class ExtendingTestClass extends TestClass {
Expand Down
6 changes: 3 additions & 3 deletions src/Console/Formatter/ColorConsoleDiffFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/**
* @see https://regex101.com/r/8MXnfa/2
*/
private const string AT_DIFF_LINE_REGEX = '#^\<fg=cyan\>@@ \-\d+,\d+ \+\d+,\d+ @@\<\/fg=cyan\>$#';
private const string AT_DIFF_LINE_REGEX = '#^\<fg=cyan\>@@ \-(\d+),\d+ \+\d+,\d+ @@\<\/fg=cyan\>$#';

private string $template;

Expand Down Expand Up @@ -89,11 +89,11 @@ private function formatWithTemplate(string $diff, string $template): string
}

/**
* Remove number diff, eg; @@ -67,6 +67,8 @@ to become @@ @@
* Simplify diff line info, eg; @@ -67,6 +67,8 @@ to become @@ Line 67 @@
*/
private function normalizeLineAtDiff(string $string): string
{
return Strings::replace($string, self::AT_DIFF_LINE_REGEX, '<fg=cyan>@@ @@</fg=cyan>');
return Strings::replace($string, self::AT_DIFF_LINE_REGEX, '<fg=cyan>@@ Line $1 @@</fg=cyan>');
}

private function makePlusLinesGreen(string $string): string
Expand Down