Skip to content

Commit 28c1ca9

Browse files
committed
Revert "Use sebastian/diff v3 for PHP 7.2+ compatibility"
This reverts commit 15994e6.
1 parent 15994e6 commit 28c1ca9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"phpstan/phpstan-deprecation-rules": "^1.2 || ^2.0",
2121
"phpstan/phpstan-phpunit": "^1.4 || ^2.0",
2222
"phpstan/phpstan-strict-rules": "^1.6 || ^2.0",
23-
"sebastian/diff": "^3.0",
23+
"sebastian/diff": "^4.0 || ^5.0 || ^6.0 || ^7.0",
2424
"swissspidy/phpstan-no-private": "^0.2.1 || ^1.0",
2525
"szepeviktor/phpstan-wordpress": "^v1.3.5",
2626
"wp-cli/config-command": "^1 || ^2",

src/Context/Support.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Exception;
1010
use Mustangostang\Spyc;
1111
use SebastianBergmann\Diff\Differ;
12+
use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
1213

1314
trait Support {
1415

@@ -315,7 +316,11 @@ protected function check_that_yaml_string_contains_yaml_string( $actual_yaml, $e
315316
* @return string The unified diff output.
316317
*/
317318
protected function generate_diff( string $expected, string $actual ): string {
318-
$differ = new Differ( "--- Expected\n+++ Actual\n" );
319+
$builder = new UnifiedDiffOutputBuilder(
320+
"--- Expected\n+++ Actual\n",
321+
false
322+
);
323+
$differ = new Differ( $builder );
319324
return $differ->diff( $expected, $actual );
320325
}
321326
}

0 commit comments

Comments
 (0)