diff --git a/src/Fixable/Patcher.php b/src/Fixable/Patcher.php index dcacfec92a..7f126361a4 100644 --- a/src/Fixable/Patcher.php +++ b/src/Fixable/Patcher.php @@ -19,6 +19,7 @@ use function sha1; use function str_starts_with; use function substr; +use const PHP_VERSION_ID; use const PREG_SPLIT_DELIM_CAPTURE; use const PREG_SPLIT_NO_EMPTY; @@ -62,7 +63,9 @@ public function applyDiffs(string $fileName, array $diffs): string $refMerge = new ReflectionClass(PhpMerge::class); $refMergeMethod = $refMerge->getMethod('mergeHunks'); - $refMergeMethod->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $refMergeMethod->setAccessible(true); + } $result = Line::createArray(array_map( static fn ($l) => [$l, Differ::OLD], diff --git a/src/Testing/TestCaseSourceLocatorFactory.php b/src/Testing/TestCaseSourceLocatorFactory.php index a87bf4d9df..9cddb78e99 100644 --- a/src/Testing/TestCaseSourceLocatorFactory.php +++ b/src/Testing/TestCaseSourceLocatorFactory.php @@ -68,7 +68,9 @@ public function create(): SourceLocator ), ]; $vendorDirProperty = $classLoaderReflection->getProperty('vendorDir'); - $vendorDirProperty->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $vendorDirProperty->setAccessible(true); + } foreach ($classLoaders as $classLoader) { $composerProjectPath = dirname($vendorDirProperty->getValue($classLoader)); if (!is_file($composerProjectPath . '/composer.json')) {