diff --git a/src/Differ/PatchDiffer.php b/src/Differ/PatchDiffer.php index 204295e9..33ecb213 100644 --- a/src/Differ/PatchDiffer.php +++ b/src/Differ/PatchDiffer.php @@ -50,7 +50,7 @@ public function diff(OldAndNewFile $oldAndNewFile): string private function resolveRelativeFilePath(string $beforeFilePath): string { - $match = Strings::match($beforeFilePath, self::LOCAL_PATH_REGEX); + $match = Strings::match(str_replace('\\', '/', $beforeFilePath), self::LOCAL_PATH_REGEX); if (! isset($match['local_path'])) { throw new ShouldNotHappenException(); diff --git a/src/FileSystem/PathResolver.php b/src/FileSystem/PathResolver.php index 4a202f19..46fa5e20 100644 --- a/src/FileSystem/PathResolver.php +++ b/src/FileSystem/PathResolver.php @@ -18,7 +18,7 @@ final class PathResolver public static function resolveVendorDirectory(string $filePath): string { - $match = Strings::match($filePath, self::VENDOR_PACKAGE_DIRECTORY_REGEX); + $match = Strings::match(str_replace('\\', '/', $filePath), self::VENDOR_PACKAGE_DIRECTORY_REGEX); if (! isset($match['vendor_package_directory'])) { throw new ShouldNotHappenException('Could not resolve vendor package directory'); }