Skip to content

Commit 0d4ed2f

Browse files
Fix deprecation
1 parent 843a2c9 commit 0d4ed2f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Fixable/Patcher.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use function sha1;
2020
use function str_starts_with;
2121
use function substr;
22+
use const PHP_VERSION_ID;
2223
use const PREG_SPLIT_DELIM_CAPTURE;
2324
use const PREG_SPLIT_NO_EMPTY;
2425

@@ -62,7 +63,9 @@ public function applyDiffs(string $fileName, array $diffs): string
6263

6364
$refMerge = new ReflectionClass(PhpMerge::class);
6465
$refMergeMethod = $refMerge->getMethod('mergeHunks');
65-
$refMergeMethod->setAccessible(true);
66+
if (PHP_VERSION_ID < 80100) {
67+
$refMergeMethod->setAccessible(true);
68+
}
6669

6770
$result = Line::createArray(array_map(
6871
static fn ($l) => [$l, Differ::OLD],

src/Testing/TestCaseSourceLocatorFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ public function create(): SourceLocator
6868
),
6969
];
7070
$vendorDirProperty = $classLoaderReflection->getProperty('vendorDir');
71-
$vendorDirProperty->setAccessible(true);
71+
if (PHP_VERSION_ID < 80100) {
72+
$vendorDirProperty->setAccessible(true);
73+
}
7274
foreach ($classLoaders as $classLoader) {
7375
$composerProjectPath = dirname($vendorDirProperty->getValue($classLoader));
7476
if (!is_file($composerProjectPath . '/composer.json')) {

0 commit comments

Comments
 (0)